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.
Created attachment 150135 [details] The diff file Make GlobalPathRegistry pluggable by SPI to allow different implementations. The SPI interface is looked up from default Lookup.
Created attachment 150325 [details] Difffile
Created attachment 150326 [details] Diff file The original patch introduced semantic incompatibility. In order to listen on GlobalPathRegistry the client code needed to hold the GPR instance. Unfortunately on several places in the IDE the GPR listening is done by: GlobalPathRegistry.getDefault().addGlobalPathRegistryListener(this); Such a code would be broken. The SPI was changed to keep the semantic compatibility.
The patch itself seems OK to me; I would recommend to change javadoc (again, semantic-incompatibly) and give an explicit warning to clients to *not* keep an instance of GPR.getDefault(), as it may change based on Lookup context. I've found some such usages: contrib/portalpack.servers.base_psframework/src/org/netbeans/modules/portalpack/servers/core/common/ServerLogSupport.java contrib/gsf/src/org/netbeans/modules/gsfret/source/GlobalSourcePath.java j2ee.sun.appsrv81/src/org/netbeans/modules/j2ee/sun/ide/j2ee/LogHyperLinkSupport.java tomcat5/src/org/netbeans/modules/tomcat5/util/LogViewer.java tomcat5/src/org/netbeans/modules/tomcat5/util/ServerLog.java The following clients keep GPR instance in a singleton: parsing.indexing/src/org/netbeans/modules/parsing/impl/indexing/PathRegistry.java java.sourceui/src/org/netbeans/modules/java/source/ui/OpenProjectFastIndex.java javadoc/src/org/netbeans/modules/javadoc/search/JavadocRegistry.java None of the above should do any harm in desktop NetBeans, where the context (and thus GPR) is just one.
OK. I will update javadoc and fix relevant usages. The parsing.indexing/src/org/netbeans/modules/parsing/impl/indexing/PathRegistry.java needs default composite GPR so it's OK that it holds the instance. But it has to be started from the SessionContextListener.
Fixed jet-main ec84953fb5cd
Integrated into 'main-silver', will be available in build *201411210001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/ec84953fb5cd User: Tomas Zezula <tzezula@netbeans.org> Log: #248216:Allow different implementations of the GlobalPathRegistry