-
Bug
-
Resolution: Fixed
-
P5
-
9
Let's consider following example:
class Test19_2 <T> {
private static class MyClass {}
public static MyClass v1 = new MyClass();
Test19_2(T t, MyClass ... mc) {}
}
public class Test19 {
public static void main(String[] args) {
new Test19_2<>(1, Test19_2.v1){};
}
}
On JDK9b73 compilation fails with following errors:
Error:(9, 21) java: incompatible types: cannot infer type arguments for Test19_2<>
reason: formal varargs element type Test19_2.MyClass is not accessible from class Test19
Error:(9, 39) java: Test19_2.MyClass has private access in Test19_2
Error:(9, 24) java: incompatible types: int cannot be converted to T
The last error message is nonrelevant.
class Test19_2 <T> {
private static class MyClass {}
public static MyClass v1 = new MyClass();
Test19_2(T t, MyClass ... mc) {}
}
public class Test19 {
public static void main(String[] args) {
new Test19_2<>(1, Test19_2.v1){};
}
}
On JDK9b73 compilation fails with following errors:
Error:(9, 21) java: incompatible types: cannot infer type arguments for Test19_2<>
reason: formal varargs element type Test19_2.MyClass is not accessible from class Test19
Error:(9, 39) java: Test19_2.MyClass has private access in Test19_2
Error:(9, 24) java: incompatible types: int cannot be converted to T
The last error message is nonrelevant.