-
Bug
-
Resolution: Fixed
-
P3
-
1.3.0
-
beta
-
generic, x86
-
generic, linux, windows_nt
-
Verified
Name: boT120536 Date: 01/03/2001
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)
With the source code below, calling
javadoc NotStaticProtected.java
results in a contradictious error message though javac accepts the source code.
First, javadoc complains that the anonymous inner class for the static field
"op" can only be static in an interface or top-level class. But it is a
static field in an interface. Second, javadoc does not want the field to be
private or protected although it is public.
--NotStaticProtected.java--
import java.util.Comparator;
public
interface NotStaticProtected {
public static final Comparator op = new Comparator() {
public int compare(Object x, Object y) {
return 0;
}
};
}
--End of NotStaticProtected.java--
Javadoc will print the following error messages
-------
Loading source file NotStaticProtected.java...
NotStaticProtected.java:5: The type nested type NotStaticProtected. 1 can't be
static. Static members can only occur in interfaces and top-level classes.
public static final Comparator op = new Comparator() {
^
NotStaticProtected.java:5: Interface fields can't be private or protected:
nested type NotStaticProtected. 1
public static final Comparator op = new Comparator() {
^
2 errors
-------
(Review ID: 108742)
======================================================================
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)
With the source code below, calling
javadoc NotStaticProtected.java
results in a contradictious error message though javac accepts the source code.
First, javadoc complains that the anonymous inner class for the static field
"op" can only be static in an interface or top-level class. But it is a
static field in an interface. Second, javadoc does not want the field to be
private or protected although it is public.
--NotStaticProtected.java--
import java.util.Comparator;
public
interface NotStaticProtected {
public static final Comparator op = new Comparator() {
public int compare(Object x, Object y) {
return 0;
}
};
}
--End of NotStaticProtected.java--
Javadoc will print the following error messages
-------
Loading source file NotStaticProtected.java...
NotStaticProtected.java:5: The type nested type NotStaticProtected. 1 can't be
static. Static members can only occur in interfaces and top-level classes.
public static final Comparator op = new Comparator() {
^
NotStaticProtected.java:5: Interface fields can't be private or protected:
nested type NotStaticProtected. 1
public static final Comparator op = new Comparator() {
^
2 errors
-------
(Review ID: 108742)
======================================================================
- duplicates
-
JDK-4401419 Javadoc throws error for anonymous classes in interfaces
-
- Closed
-