-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
6
-
x86
-
windows_xp
FULL PRODUCT VERSION :
java version "1.6.0_10-rc"
Java(TM) SE Runtime Environment (build 1.6.0_10-rc-b28)
Java HotSpot(TM) Client VM (build 11.0-b15, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Windows XP
A DESCRIPTION OF THE PROBLEM :
From JCK
"ASSERTION clss360 - Anonymous class instance creation expression within explicit constructor invocation.
ASSERTION
If an anonymous class instance creation expression appears within an explicit constructor invocation statement, then the anonymous class may *not* refer to *any* of the enclosing instances of the class whose constructor is being invoked."
Javac fails this test the actual implementation in JCK ensures that the compiler does the exact opposite!
TEST clss36002 reads:
"DESCRIPTION
The test checks that it is *allowed* to refer to any of the enclosing instances of the class whose constructor is being invoked." (compiler positive)
In the case of method calls JLS explicitly specifies a compile-time error
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
compile the test case
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The compilation should fail
ACTUAL -
It compiles without error
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
class clss36002a {
int a1 = 5;
class a {
a(Object o) {}
}
class c extends a {
int c = 555;
c() {
super(new Object() { int r = a1; } );
}
}
}
---------- END SOURCE ----------
java version "1.6.0_10-rc"
Java(TM) SE Runtime Environment (build 1.6.0_10-rc-b28)
Java HotSpot(TM) Client VM (build 11.0-b15, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Windows XP
A DESCRIPTION OF THE PROBLEM :
From JCK
"ASSERTION clss360 - Anonymous class instance creation expression within explicit constructor invocation.
ASSERTION
If an anonymous class instance creation expression appears within an explicit constructor invocation statement, then the anonymous class may *not* refer to *any* of the enclosing instances of the class whose constructor is being invoked."
Javac fails this test the actual implementation in JCK ensures that the compiler does the exact opposite!
TEST clss36002 reads:
"DESCRIPTION
The test checks that it is *allowed* to refer to any of the enclosing instances of the class whose constructor is being invoked." (compiler positive)
In the case of method calls JLS explicitly specifies a compile-time error
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
compile the test case
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The compilation should fail
ACTUAL -
It compiles without error
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
class clss36002a {
int a1 = 5;
class a {
a(Object o) {}
}
class c extends a {
int c = 555;
c() {
super(new Object() { int r = a1; } );
}
}
}
---------- END SOURCE ----------
- duplicates
-
JDK-6782005 JLS section 8.8.5.1 contains an example which does not conforms to javac of JDK6
- Closed