Home > database >  JVM field descriptor for array of multiple types
JVM field descriptor for array of multiple types

Time:11-01

I am looking at enter image description here

CodePudding user response:

There seems to be some confusion as you’re looking at a field descriptor but asking a question about a method. So you have to look at the method descriptor documentation just beneath the “Field Descriptors” section.

A method descriptor has the form

( ParameterDescriptor* ) ReturnDescriptor

where the parameter descriptors have the same form as field descriptors, concatenated without any separators and the return descriptor only differs from field descriptors in also allowing V, to denote a void method.

Since your question doesn’t include the return type, and also doesn’t show the qualified name of the second parameter¹ (we might assume the first one is java.lang.String), no complete answer can be given for this example. If the method has been declared like

void callthismethod(java.lang.String a, some.location.ArrayMap<String, Task<String>> aa)

the method descriptor would look like

(Ljava/lang/String;Lsome/location/ArrayMap;)V

Note that neither, field descriptors nor method descriptors, encode type arguments. Generic signatures are an entirely different thing, only used for Reflection and debugging, not for the normal execution of code.

Getting the generic signature for your example is as problematic as getting the method descriptor, due to the missing information. Further, com.this.location is not a valid package name. Assuming some.location for Task as well, the generic signature would look like

(Ljava/lang/String;Lsome/location/ArrayMap<Ljava/lang/String;Lsome/location/Task<Ljava/lang/String;>;>;)V

¹ in fact, your declaration is entirely invalid as it tries to assign names to type arguments but not to the actual parameter.

CodePudding user response:

There are no arrays, and type erasure means generics don't matter. So this is just Ljava/lang/String;Lwhatever/package/ArrayMap;. Task doesn't show up at all.

  • Related