Closed DhanJaya closed 1 year ago
You may be surprised, but the compiler erases the generic types. Hence, the class file does no longer have the information what type you used in the source file. And indeed, you can invoke this method at runtime with a list of different types.
Thank you for your response.
I went through the class files that were created for the jar files. The generic type was mentioned under the LocalVariableTypeTable and the Signature for the method.
Class file before modification:
test1 (Ljava/util/List;)V arg1 Ljava/util/List; LocalVariableTypeTable $Ljava/util/List<Ljava/lang/String;>; Signature '(Ljava/util/List<Ljava/lang/String;>;)
Class file after modification:
test1 (Ljava/util/List;)V arg1 Ljava/util/List; LocalVariableTypeTable %Ljava/util/List<Ljava/lang/Integer;>; Signature ((Ljava/util/List<Ljava/lang/Integer;>;)
Could these information be used by the tool to extract the type change of the parameters?
Yes, it should be possible to evaluate the information inside the LocalVariableTypeTable. I have started a PoC implementation and will let you know, once I have a releasable result.
Added support for generic types. Will be released with 0.17.0
The type parameter change(generics) in Java is not detected. For an example if a method signature
Changes to
JAPICmp tool output: