-
Bug
-
Resolution: Fixed
-
P4
-
9
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8098768 | emb-9 | Srikanth Adayapalam | P4 | Resolved | Fixed | team |
Let's consider following example:
class Clazz2 {
private static class A {};
public A a;
}
public class Test2 {
static class FooNest<Q> {
FooNest(Q q, Foo<Q> foo) { }
}
static class Foo<T> { }
static Clazz2 clazz = new Clazz2();
public static void test() {
FooNest fooNest = new FooNest<>(clazz.a, new Foo<>() {});
}
}
When it's compiled by JDK9b66 following messages are produced:
Error:(16, 17) java: Clazz2.A has private access in Clazz2
Error:(16, 50) java: incompatible types: <anonymous Test2.Foo<Clazz2.A>> cannot be converted to Test2.FooNest
The second message seem not to correspond to the code.
The error doesn't occur, provided assignment is removed, that is resulting in following code:
new FooNest<>(clazz.a, new Foo<>() {});
class Clazz2 {
private static class A {};
public A a;
}
public class Test2 {
static class FooNest<Q> {
FooNest(Q q, Foo<Q> foo) { }
}
static class Foo<T> { }
static Clazz2 clazz = new Clazz2();
public static void test() {
FooNest fooNest = new FooNest<>(clazz.a, new Foo<>() {});
}
}
When it's compiled by JDK9b66 following messages are produced:
Error:(16, 17) java: Clazz2.A has private access in Clazz2
Error:(16, 50) java: incompatible types: <anonymous Test2.Foo<Clazz2.A>> cannot be converted to Test2.FooNest
The second message seem not to correspond to the code.
The error doesn't occur, provided assignment is removed, that is resulting in following code:
new FooNest<>(clazz.a, new Foo<>() {});
- backported by
-
JDK-8098768 Compiler has trouble compiling nested diamond allocation constructs involving anonymous classes.
-
- Resolved
-