This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hi Per, We recently upgraded some of our third-party jars (Eclipse target platform to be precise). Upon switch, one of our class was not compiling correctly anymore, kawa compiler was throwing a `MalformedParameterizedTypeException` when calling `public final Field addField(java.lang.reflect.Field field)`. It seems that one of the used class's fields, which is generic, is throwing the exception when `getGenericType` is called on the Field. I'm not sure exactly why the type is malformed but it looks like it's related to constructor arity looking at the generated stack trace. I tried to synthesis a test case without external dependencies but was not able to do so. When I create a similar class hierarchy, I don't have the problem. I have a minimal test case using the least possible amount of jars to reproduce. I could send it to you if you want to take a look. I wrote a patch that fix the problem. For me, it seems like a good fix but it might be possible to do something better. Tell me if you would prefer a proper issue to be open for this, it will be my pleasure. Regards, Matt P.S. # Test case (static-field <org.eclipse.core.resources.ResourcesPlugin> 'PI_RESOURCES) ;; Field causing problem in class <org.eclipse.core.resources.ResourcesPlugin> is `private ServiceRegistration<IWorkspace> workspaceRegistration`. Type ServiceRegistration is an interface taking a generic parameter <S> and type IWorkspace is a non-generic interface. # Partial stack trace (compiling preference.scm to preference) preference.scm:1:1: caught exception in inliner for #<procedure static-field> - java.lang.reflect.MalformedParameterizedTypeException sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.validateConstructorArguments(ParameterizedTypeImpl.java:60) sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.<init>(ParameterizedTypeImpl.java:53) sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.make(ParameterizedTypeImpl.java:95) sun.reflect.generics.factory.CoreReflectionFactory.makeParameterizedType(CoreReflectionFactory.java:105) sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:140) sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49) sun.reflect.generics.repository.FieldRepository.getGenericType(FieldRepository.java:85) java.lang.reflect.Field.getGenericType(Field.java:237) gnu.bytecode.ClassType.addField(ClassType.java:629) gnu.bytecode.ClassType.addFields(ClassType.java:658) gnu.bytecode.ClassType.getFields(ClassType.java:538) gnu.bytecode.ClassType.getDeclaredField(ClassType.java:552) gnu.bytecode.ClassType.getField(ClassType.java:571) gnu.kawa.reflect.SlotGet.lookupMember(SlotGet.java:227) ...
Attachment:
fix-generic-type-problem.patch
Description: Binary data
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |