timboudreau opened a new pull request, #4868:
URL: https://github.com/apache/netbeans/pull/4868

   I noticed, in a project that generates a lot of classes using annotation 
processors, that frequently the IDE would not reparse after code generation, 
and so error markers on code that references generated classes and similar 
would not be updated.
   
   I tracked it down to this:
   
   The previous code calls `WeakListeners.propertyChange()` *with a lambda*. 
The lambda will be garbage collected instantaneously and never fire changes, 
which was exactly the behavior.
   
   On JDK-8, lambdas and method references would hang around a while before 
being garbage collected - so this code might have looked like it worked 
originally.  On newer JDKs, the lambda will be garbage collected almost as soon 
as it is allocated, so notifications will never propagate.
   
   I've been running this patch for a month or so without problems.
   
   One slightly questionable thing:  There was commented out code to also 
listen on `proj.getProjectWatcher()`.  It seemed harmless, now that the class 
is implementing `PropertyChangeListener` directly, and the code wanted the same 
listener implementation, to uncomment it, so I did.
   
   I can definitely verify that it works, because I had to fix in a deadlock in 
the icon-badging support in my Antlr plugins that could only be triggered by 
the events that were never fired :-)
   


-- 
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: notifications-unsubscr...@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org
For additional commands, e-mail: notifications-h...@netbeans.apache.org

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

Reply via email to