I am working on a Bytecode analysis project, for which I am using ASM. Everything is going good, I am able to parse, get class and method informations successfully.
But I am stuck in understanding bytecode representation for Generics. Here is the one example from java.util.list
when I use visitMethod
from ClassVisitor
to print the information, this is what I am getting for one of the method's signature:
(ILjava/util/Collection<+TE;>;)Z
Here I am trying to disassemble one by one and understanding the arguments of the method:
I
stands for intLjava/util/Collection
stands for it's an argument of type Collection
But I am stuck at generics type ie <+TE>
etc. Can anyone guide me? I tried to search but not got enough information. If anyone has list of bytecode names can you please share me?
The +
stands for the generic extends
while the TE
means that there is a type var E
Thus in the source code it will look like:
Collection<? extends E> -> Ljava/util/Collection<+TE;>
Take a look at the asm user guide section 4.1.1 Generics -> Metadata
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With