neilcsmith-net commented on code in PR #4899:
URL: https://github.com/apache/netbeans/pull/4899#discussion_r1011466779
##########
java/maven/src/org/netbeans/modules/maven/classpath/ClassPathProviderImpl.java:
##########
@@ -721,18 +722,14 @@ public AnnotationPathSelector(NbMavenProjectImpl proj,
ClassPath anno, Supplier<
this.annotationCP = anno;
this.compileClassPath = compile;
- anno.addPropertyChangeListener(WeakListeners.propertyChange(
- e -> {
- active = null;
- support.firePropertyChange(PROP_ACTIVE_CLASS_PATH,
null, null);
- }, ClassPath.PROP_ROOTS, anno
- ));
-// proj.getProjectWatcher().addPropertyChangeListener((e) -> {
-// if (NbMavenProject.PROP_PROJECT.equals(e.getPropertyName()))
{
-// active = null;
-// support.firePropertyChange(PROP_ACTIVE_CLASS_PATH, null,
null);
-// }
-// });
+ anno.addPropertyChangeListener(WeakListeners.propertyChange(this,
anno));
+
proj.getProjectWatcher().addPropertyChangeListener(WeakListeners.propertyChange(this,
anno));
Review Comment:
@mbien from the docs, the property name should be passed to both
`WeakListeners::propertyChange` and `addPropertyChangeListener`. As not used
for the latter, I assume this might have been firing for all properties but
only trying to remove a listener on `ClassPath.PROP_ROOTS`?!
@sdedic is right, that second weak listener should be passed
`proj::getProjectWatcher`, or `null`. I think the underlying code can handle
events from alternative sources though, so shouldn't cause a problem?
I (or one of you) can add a second commit here to tidy this up, but need a
call ASAP if we're going to get in rc3.
cc @timboudreau
--
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