-
Bug
-
Resolution: Won't Fix
-
P5
-
None
-
1.1.8, 1.3.0
-
generic, sparc
-
generic, solaris_7
allan.jacobs@Eng 1997-10-27
Javac may not allow a local class instance creation expression to
occur in a block. The problem code occurs when this block is
inside a method of an enclosing instance that is also a local, inner
class.
The source code is derived from Modena (2.2) test ciner062.
algol% uname -a
SunOS algol 5.6 Generic sun4u sparc SUNW,Ultra-1
algol% java -fullversion
java full version "1.1.8"
algol% setenv CLASSPATH .
algol% javac -d . X.java
X.java:14: Class X. 1$Z not found in type declaration.
return new Z().test();
^
1 error
algol% cat X.java
class X {
int s=0;
X() { s=0; }
int test() {
class Y { //enclosing class is X
Y() { s=1; }
int test() {
class Z { // enclosing instance is Y
Z() { new X().super(); }
int test() { return s; }
}
// javac error message:
// X.java:14: Class X. 1$Z not found in type declaration.
return new Z().test();
}
}
return new Y().test();
}
public static void main(String[] s) {
X x=new X();
System.out.println(x.test());
}
}
- duplicates
-
JDK-4314674 javac: incorrect compilation a class contains an inner classes
-
- Closed
-