-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
5.0
-
generic
-
solaris_7
cannot create an array where the type is an inner interface of a
generic class...
frog:~/workspaces/test/InnerInterfaceArray $ cat -n InnerInterfaceArray.java
1 class Outer {
2 interface Inner {}
3 interface GenericInner<X> {}
4 }
5
6 class GenericOuter<X> {
7 interface Inner {}
8 interface GenericInner<Y> { }
9 }
10
11 class User {
12
13 // non generic version - this is OK
14 Outer.Inner[] inners=new Outer.Inner[10];
15
16 // non generic class with generic inner Interface - this is OK
17 Outer.GenericInner<String>[] genericInners=new Outer.GenericInner<String>[10];
18
19 // compiler chokes on generic class with inner interface thus
20 GenericOuter<String>.Inner[] nonGensgens=new GenericOuter<String>.Inner[10];
21
22 // compiler chokes on generic class with generic inner interface thus
23 GenericOuter<String>.GenericInner<String>[] gengens=new GenericOuter<String>.GenericInner<String>[10];
24
25 }
frog:~/workspaces/test/InnerInterfaceArray $ newjavac -gj InnerInterfaceArray.java
InnerInterfaceArray.java:20: '(' or '[' expected
GenericOuter<String>.Inner[] nonGensgens=new GenericOuter<String>.Inner[10];
^
InnerInterfaceArray.java:23: '(' or '[' expected
GenericOuter<String>.GenericInner<String>[] gengens=new GenericOuter<String>.GenericInner<String>[10];
^
2 errors
frog:~/workspaces/test/InnerInterfaceArray $
generic class...
frog:~/workspaces/test/InnerInterfaceArray $ cat -n InnerInterfaceArray.java
1 class Outer {
2 interface Inner {}
3 interface GenericInner<X> {}
4 }
5
6 class GenericOuter<X> {
7 interface Inner {}
8 interface GenericInner<Y> { }
9 }
10
11 class User {
12
13 // non generic version - this is OK
14 Outer.Inner[] inners=new Outer.Inner[10];
15
16 // non generic class with generic inner Interface - this is OK
17 Outer.GenericInner<String>[] genericInners=new Outer.GenericInner<String>[10];
18
19 // compiler chokes on generic class with inner interface thus
20 GenericOuter<String>.Inner[] nonGensgens=new GenericOuter<String>.Inner[10];
21
22 // compiler chokes on generic class with generic inner interface thus
23 GenericOuter<String>.GenericInner<String>[] gengens=new GenericOuter<String>.GenericInner<String>[10];
24
25 }
frog:~/workspaces/test/InnerInterfaceArray $ newjavac -gj InnerInterfaceArray.java
InnerInterfaceArray.java:20: '(' or '[' expected
GenericOuter<String>.Inner[] nonGensgens=new GenericOuter<String>.Inner[10];
^
InnerInterfaceArray.java:23: '(' or '[' expected
GenericOuter<String>.GenericInner<String>[] gengens=new GenericOuter<String>.GenericInner<String>[10];
^
2 errors
frog:~/workspaces/test/InnerInterfaceArray $