This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 179799 - Api review: Added constant ClassPath.EMPTY
Summary: Api review: Added constant ClassPath.EMPTY
Alias: None
Product: java
Classification: Unclassified
Component: Classpath (show other bugs)
Version: 6.x
Hardware: All All
: P3 normal (vote)
Assignee: Tomas Zezula
Depends on:
Reported: 2010-01-22 11:05 UTC by Tomas Zezula
Modified: 2010-02-22 22:01 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:

Diff file (4.07 KB, patch)
2010-01-22 11:18 UTC, Tomas Zezula
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tomas Zezula 2010-01-22 11:05:45 UTC
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[0]). 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.
Comment 1 Tomas Zezula 2010-01-22 11:18:05 UTC
Created attachment 93498 [details]
Diff file
Comment 2 Jesse Glick 2010-01-22 11:49:40 UTC
[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[0]) probably still holds onto listeners. Better to replace with a ClassPathImplementation that ignores addPropertyChangeListener calls.
Comment 3 Tomas Zezula 2010-01-22 12:17:27 UTC
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).
Comment 4 Tomas Zezula 2010-02-05 05:41:24 UTC
fixed in jet-main: 8093f649bb6a
Comment 5 Quality Engineering 2010-02-05 22:50:55 UTC
Integrated into 'main-golden', will be available in build *201002060200* on (upload may still be in progress)
User: Tomas Zezula <>
Log: #179799:Api review: Added constant ClassPath.EMPTY
Comment 6 Quality Engineering 2010-02-22 22:01:27 UTC
Integrated into 'main-golden', will be available in build *201002230200* on (upload may still be in progress)
User: Jan Lahoda <>
Log: #179799: Do not keep listeners for ClassPath.EMPTY.