Community
Participate
Working Groups
From the jdt newgroup, I am using the package org.eclipse.jdt.core to explore the Java Model of .class files of libraries which are in the classpath of a Java Project. I noticed that generics are lost for IField in .class files. For example : import java.util.List; public class A { protected List<String> myField; } I call IField.getTypeSignature() : In the .java file : Ljava.util.List<Ljava.lang.String;>; In the .class file : Ljava.util.List; Strangely, we don't have this problem with the IMethod. ====================================================================== It looks like the implementation of org.eclipse.jdt.internal.core.BinaryField.getTypeSignature() is boggus: public String getTypeSignature() throws JavaModelException { IBinaryField info = (IBinaryField) getElementInfo(); return new String(ClassFile.translatedName(info.getTypeName())); } It should check if the info has a generic signature.
Created attachment 132249 [details] Proposed fix + regression test I'll run all existing tests to validate the fix.
Jérôme, please review.
Looks good
Released for 3.5M7. Regression test added in org.eclipse.jdt.core.tests.model.ClassFileTests#testGenericFieldGetTypeSignature
Created attachment 132930 [details] Additional patch for tests This patch is needed to have no failure while running ClassFileTests test suite with an 1.4 VM.
(In reply to comment #5) > Created an attachment (id=132930) [details] > Additional patch for tests > Released in HEAD
Verified for 3.5M7 using I20090426-2000