The following program does not compile:
class A<X> {
class B<Y> {}
A<? extends Integer>.B<String> b;
Object o = (A<Integer>.B<String>[][])b;
}
OUTPUT:
maurizio@maurizio-laptop:~/Desktop$ testws/dist/bin/javac Test3.java
Test3.java:5: ')' expected
Object o = (A<Integer>.B<String>[])b;
^
Test3.java:5: ';' expected
Object o = (A<Integer>.B<String>[])b;
^
Test3.java:5: illegal start of type
Object o = (A<Integer>.B<String>[])b;
^
3 errors
class A<X> {
class B<Y> {}
A<? extends Integer>.B<String> b;
Object o = (A<Integer>.B<String>[][])b;
}
OUTPUT:
maurizio@maurizio-laptop:~/Desktop$ testws/dist/bin/javac Test3.java
Test3.java:5: ')' expected
Object o = (A<Integer>.B<String>[])b;
^
Test3.java:5: ';' expected
Object o = (A<Integer>.B<String>[])b;
^
Test3.java:5: illegal start of type
Object o = (A<Integer>.B<String>[])b;
^
3 errors
- relates to
-
JDK-6665356 Cast not allowed when both qualifying type and inner class are parameterized
- Closed