-
Bug
-
Resolution: Duplicate
-
P3
-
None
-
1.3.0
-
sparc
-
solaris_7
During compile the following simple test javac prints the error message:
class X {
String s=null;
X() {
s="CLASS_X";
}
String test() {
class Y {
Y() {
s="CLASS_Y";
}
String test() {
class Z extends X {
Z() {
X.new Y().super(); //Y's constructor is expected to be called.
}
String test() {
return s;
}
}
return new Z().test();
}
}
return new Y().test();
}
public static void main(String[] s) {
X x=new X();
System.out.println(x.s); // String "CLASS_X" should appear.
}
}
<cos@ultracos: (screen:1).1063> javac -server test.java
test.java:17: illegal qualifier; X is not an inner class
X.new Y().super(); //Y's constructor is expected to be called.
^
1 error
This test has been succesfully compiled by both of Classic and Solaris refs v. 1.2.2.
konstantin.boudnik@eng 2000-02-22
class X {
String s=null;
X() {
s="CLASS_X";
}
String test() {
class Y {
Y() {
s="CLASS_Y";
}
String test() {
class Z extends X {
Z() {
X.new Y().super(); //Y's constructor is expected to be called.
}
String test() {
return s;
}
}
return new Z().test();
}
}
return new Y().test();
}
public static void main(String[] s) {
X x=new X();
System.out.println(x.s); // String "CLASS_X" should appear.
}
}
<cos@ultracos: (screen:1).1063> javac -server test.java
test.java:17: illegal qualifier; X is not an inner class
X.new Y().super(); //Y's constructor is expected to be called.
^
1 error
This test has been succesfully compiled by both of Classic and Solaris refs v. 1.2.2.
konstantin.boudnik@eng 2000-02-22
- duplicates
-
JDK-4247757 Javac does not allow local class instance creation in an enclosing local class.
- Closed