There are lots of places in the java.source and other module where the API requires non null ClassPath parameter, which forces the caller to create a new empty ClassPath. To create a new empty ClassPath you neede to call ClassPathSupport.createClassPath(new URL). Also each such a client creates a new useless instance of an empty ClassPath.
This API change adds a new constant EMPTY into the ClassPath which can be used by these clients.
The API change is a compatible addition to final class, the API should be stable in 6.9.
Created attachment 93498 [details]
[JG01] Checking modifiers on the constant in a unit test is just noise. Accidental API changes would anyway be notified on the list.
[JG02] ClassPathSupport.createClassPath(new URL) probably still holds onto listeners. Better to replace with a ClassPathImplementation that ignores addPropertyChangeListener calls.
JG01: Agree, this is not needed. Signature test will catch the final removal.
JG02: Will not help. As the API ClassPath.addPropertyChangeListener() does not add the listeners into SPI ClassPathImplementation. It holds them in its PropertyChangeSupport. The ClassPathImplementation, in this case, has a single listener in its listeners list, the Weak(ClassPath.spiListener).
fixed in jet-main: 8093f649bb6a
Integrated into 'main-golden', will be available in build *201002060200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
User: Tomas Zezula <email@example.com>
Log: #179799:Api review: Added constant ClassPath.EMPTY
Integrated into 'main-golden', will be available in build *201002230200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
User: Jan Lahoda <firstname.lastname@example.org>
Log: #179799: Do not keep listeners for ClassPath.EMPTY.