Problem with TreeClassAdapter and jdk 1.5 rc1
The following TestCase:
import java.io.FileInputStream;
import java.util.List;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.tree.TreeClassAdapter;
import org.objectweb.asm.tree.MethodNode;
public class Test {
private List<String> list;
public static void main(String args[]) throws Exception {
ClassReader cr = new ClassReader(new FileInputStream("Test.class"));
ClassWriter cw = new ClassWriter(true);
TreeClassAdapter tca = new TreeClassAdapter(null);
cr.accept(tca, true);
tca.classNode.accept(cw);
cw.toByteArray();
}
}
causes the Exception:
Exception in thread "main" java.lang.IllegalArgumentException: Unknown
attribute type Signature
at org.objectweb.asm.Attribute.put(Attribute.java:228)
at org.objectweb.asm.ClassWriter.visitField(ClassWriter.java:594)
at org.objectweb.asm.tree.FieldNode.accept(FieldNode.java:116)
at org.objectweb.asm.tree.ClassNode.accept(ClassNode.java:178)
at Test.main(Test.java:21)
(I build asm myself from current CVS).
The problem is caused by the generic List.