Bug 179799 - Api review: Added constant ClassPath.EMPTY
Api review: Added constant ClassPath.EMPTY
Status: RESOLVED FIXED
Product: java
Classification: Unclassified
Component: Classpath
6.x
All All
: P3 (vote)
: 6.x
Assigned To: Tomas Zezula
issues@java
: API_REVIEW_FAST
Depends on:
Blocks:
  Show dependency treegraph
 
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
:


Attachments
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 http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/8093f649bb6a
User: Tomas Zezula <tzezula@netbeans.org>
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 http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/b066191f3cb4
User: Jan Lahoda <jlahoda@netbeans.org>
Log: #179799: Do not keep listeners for ClassPath.EMPTY.


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo