sdedic commented on PR #7665:
URL: https://github.com/apache/netbeans/pull/7665#issuecomment-2315091892

   During testing, I've discovered that `GradleSourcesImplTest` fails quite 
often. I invested nearly one day into hunting the cause - and was only able to 
cure some symptoms.
   The main issue is that the project Lookup initializes lazily; although the 
project impl itself uses `ProxyLookup.setLookups`, the delegates (actully 
wrapped `FolderLookup` ) start to initialize / recognize layer registrations 
and only after a while they asynchronously finalize, firing events that are 
propagated upwards through wrapper ProxyLookups. 
   
   This is a general problem and affetcs all (even production) code that uses 
pattern:
   ```
   Project p = FileOwnerQuery.findOwner(someFile);
   OpenProjects.open(new Project[] { p }, false);
   OpenProjects.openProjects().get();
   Sources srcs = ProjectUtils.getSources(p);
   ```
   though the client code even opens the project in a hope it will be fully 
initialized afterwards, the Sources may report no source groups as the 
java-specific provider might not be recognized/loaded yet. This happens 
randomly.
   
   In this PR, I've introduced 
[waitForProjectLookup](https://github.com/apache/netbeans/pull/7665/files#diff-efbe457805d005d95375ecf666a13cac9b397d17855e7911e4e4445acf34a9c2R47)
 that hides a hacky way how to wait for the project lookup's implementations to 
initialize.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to