-
Bug
-
Resolution: Fixed
-
P2
-
9
-
b86
-
generic
-
generic
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8142251 | emb-9 | Srikanth Adayapalam | P2 | Resolved | Fixed | team |
The following program should compile, but does not with 9 dev tip not with 8u40:
// ------ 8< --------
public class X {
public static void main(String[] args) {
new Neg19_01<Object>(null) {}; // OK.
}
}
class Neg19_01<T> {
private class Private {}
Neg19_01(Private p) {
System.out.println("Neg19_01");
}
}
// ------ 8< --------
The last para of 15.9.5.1 "Anonymous constructor reads":
"Note that it is possible for the signature of the anonymous constructor to refer
to an inaccessible type (for example, if such a type occurred in the signature of
the superclass constructor cs ). This does not, in itself, cause any errors at either
compile-time or run-time."
Thus this access check implemented by javac has no sanction in JLS.
ECJ compiles and run the code fine.
// ------ 8< --------
public class X {
public static void main(String[] args) {
new Neg19_01<Object>(null) {}; // OK.
}
}
class Neg19_01<T> {
private class Private {}
Neg19_01(Private p) {
System.out.println("Neg19_01");
}
}
// ------ 8< --------
The last para of 15.9.5.1 "Anonymous constructor reads":
"Note that it is possible for the signature of the anonymous constructor to refer
to an inaccessible type (for example, if such a type occurred in the signature of
the superclass constructor cs ). This does not, in itself, cause any errors at either
compile-time or run-time."
Thus this access check implemented by javac has no sanction in JLS.
ECJ compiles and run the code fine.
- backported by
-
JDK-8142251 Extraneous access checks implemented by javac
-
- Resolved
-