…s.addPropertyChangeListener.

WeakListeners.propertyChange(lister, source) expected, that it can
detach from the supplied source by invoking removePropertyChangeListener
on it. This contract is violated in this construct:

DocumentUtilities.addPropertyChangeListener(doc, 
WeakListeners.propertyChange(this, doc));

DocumentUtilities does not attach the PropertyChangeListener to the
document, but to a PropertyChangeLister contained in it. The Document
itself does not support removePropertyChangeListener.

The solution is to add a new api method addWeakPropertyChangeListener,
that hides the complexity from the user.

The issue was raised and diagnosed by Eirik Bakke.

[ Full content available at: 
https://github.com/apache/incubator-netbeans/pull/848 ]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to