Name: laC46010 Date: 05/08/97
JDK1.1.2D compiler fails to compile the following example
taken directly from the Inner Classes specification.
(Note that this code can't be compiled with both JDK1.1, JDK1.1.1
compilers as well).
It looks like the bug appears only when anonymous inner class
implements MORE than ONE abstract method. It is true for both
interfaces and abstract classes used as super class of the
anonymous class. If a base interface (or abstract class) has only
one abstract method, compilation succeeds.
--------------------icls00601.java----------------------
import java.util.Enumeration;
class a {
Enumeration myEnumerate(final Object array[]) {
return new Enumeration() {
int count = 0;
public boolean hasMoreElements()
{ return count < array.length; }
public Object nextElemnt()
{ return array[count++]; }
};
}
}
---------------------------------------------------------
producing the following output:
icls00601.java:5: interface java.util.Enumeration is an abstract class. It can't be instantiated.
return new Enumeration() {
^
icls00601.java:5: local class a. 1 must be declared abstract and not final. It does not define java.lang.Object nextElement() from interface java.util.Enumeration.
return new Enumeration() {
^
2 errors
======================================================================