-
Bug
-
Resolution: Duplicate
-
P3
-
None
-
1.3.0
-
generic
-
generic
Name: boT120536 Date: 01/03/2001
java version "1.3.0beta_refresh"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0beta_refresh-b09)
Java HotSpot(TM) Client VM (build 1.3.0beta-b07, mixed mode)
The following code is legal java and compiles fine with javac, however javadoc
claims that it's illegal and refuses to finish the documentation run.
/*
This file is licensed through the GNU public License. Please read it.
Basically you can modify this code as you wish, but you need to distribute
the source code for all applications that use this code.
I'd appreciate comments/suggestions on the code ###@###.###
*/
package org.tcfreenet.schewe.utils;
import java.util.Comparator;
/**
This interface is used to represent the uniqueness of an object. Each
object within a JVM that implements the Unique interface must return a
different uid unless those objects are to be considered equal. An easy way
to implement this is to create a new {@link DefaultUnique} object in the
constructor and delegate the getUID() method to that object.
**/
public interface Unique {
public long getUID();
/**
Comparator for comparing unique objects.
**/
final static public Comparator UNIQUE_COMPARATOR = new Comparator() {
public boolean equals(final Object o) {
return o == this;
}
/**
@throws ClassCastException if o1 and o2 are not instances of Unique
**/
public int compare(final Object o1, final Object o2) throws
ClassCastException {
if(o1.equals(o2)) {
return 0;
} else {
final Unique u1 = (Unique)o1;
final Unique u2 = (Unique)o2;
if(u1.getUID() < u2.getUID()) {
return -1;
} else {
return 1;
}
}
}
};
}
Output:
/home/jpschewe/projects/java/org/tcfreenet/schewe/utils/Unique.java:25: The type
nested type org.tcfreenet.schewe.utils.Unique. 1 can't be static. Static
members can only occur in interfaces and top-level classes.
final static public Comparator UNIQUE_COMPARATOR = new Comparator() {
^
/home/jpschewe/projects/java/org/tcfreenet/schewe/utils/Unique.java:25:
Interface fields can't be private or protected: nested type
org.tcfreenet.schewe.utils.Unique. 1
final static public Comparator UNIQUE_COMPARATOR = new Comparator() {
^
2 errors
This error occurs under Windows NT as well, so it's not just a Linux issue.
(Review ID: 110585)
======================================================================
- duplicates
-
JDK-4401422 javadoc tool: Mistakenly throws error for static innerclass & field in interface
-
- Closed
-