This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
This code: ProjectClassPathExtender pce = project.getLookup().lookup(ProjectClassPathExtender.class); ProjectClassPathModifierImplementation pcm = project.getLookup().lookup(ProjectClassPathModifierImplementation.class); if (pcm != null) { for (String type : classPathTypes) { ProjectClassPathModifier.addLibraries(new Library[] { swdpLibrary }, sourceRoot, type); } } else if (pce != null) { pce.addLibrary(swdpLibrary); } else{ throw new IllegalStateException("Current project does not have support " + "for ProjectClassPathModifier or ProjectClassPathExtender"); } can simply be replaced with for (String type : classPathTypes) { ProjectClassPathModifier.addLibraries(new Library[] { swdpLibrary }, sourceRoot, type); } PCPM.aL already checks for both PCPMI and PCPE in lookup and insulates client code from future SPI changes.
Fixed as suggested.
v.