Menu

#112 [Generics] Wrong parsing of generic arrays in classfile

Self_Reported
open
nobody
Parsing (9)
5
2012-11-27
2006-11-16
No

Generic arrays are parsed wrongly from classfiles.

This can be seen by putting the two attached files (A.java and B.class) into the same directory and compiling the file A.java which produces the following compiler error:
File "A.java", line 4, character 31 error: Cannot find type "[[LB<java.lang.Integer>"

As we can see, the type for which MultiJava looks still contains the type argument and part of the generic type signature which should be stripped before searching for the class.

The source code of the attached files corresponds to the following snippets, where the problem is the generic array in the class B:

==========================
public class A {
public void foo() {
B<Object> b = new B<Object>();
String s = b.f;
}
}
==========================

==========================
public class B<T> {
public B<Integer>[][][] f;
}
==========================

Discussion

  • Ovidio Mallo

    Ovidio Mallo - 2006-11-16
     
  • Ovidio Mallo

    Ovidio Mallo - 2006-11-16
     

Log in to post a comment.