[ASM 5.1] Error when reading nested type of type variable bound in method signature
Michael Gumowski <[email protected]> Thu, 11 Aug 2016 11:37:48 +0200
| Newsgroups | gmane.comp.java.objectweb.asm |
|---|---|
| Message-ID | <CABGmqnkGgJABpjRH-6RA1CggkEAXG=vGY9AuaW6VBzSrWVt60Q@mail.gmail.com> |
Hello all,
I'm working for the SonarSource Language Team, and I'm participating to the
development of the Java Analyzer of SonarQube. I'm currently facing an
issue with ASM when trying to read a very particular kind of methods
signature.
Consider the following case:
- A first generic class having a nested generic class:
public class TypeWithNestedGenericClass {
public static class Nested<Y> { }
}
- A second generic class having its first type variable with a bound to
the first class. The class contains a single method, using the nested type
of the bound as argument.
public class GenericTypeUsingNestedTypeFromBound<U extends
TypeWithNestedGenericClass> {
void method(U.Nested<String> nested) {
// usage '^^^^^^^^^^^^^^^^'
}
}
Now, when visiting the byte code of the 2nd class and trying to read the
signature of the method (with a SignatureReader), I end up with the
following situation:
- The signature of the method "method" is : "
(TU.Nested<Ljava/lang/String;>;)V"
- When visiting the first parameter, the SignatureReader extract from
the signature the following name as type variable:
"U.Nested<Ljava/lang/String"
- I would have expected to have only "U.Nested", and then the visit of
the type variable "Ljava/lang/String" in order to correctly
reconstructed my parameterized type.
- As a consequence, we fail to retrieve the type of the method
parameter (related JIRA ticket on our side: SONARJAVA-1817
<https://jira.sonarsource.com/browse/SONARJAVA-1817>).
- We are using ASM 5.0.3 but I reproduced the issue with ASM 5.1.
Is there something wrong with the parsing of method the signature in ASM
when dealing with nested class of bound?
To me, it seems that there is an issue in
org.objectweb.asm.signature.SignatureReader.parseType(String,
int, SignatureVisitor), when dealing with Type variables (lines 168-170),
as type arguments are then lost.
Best regards,
*Michael GUMOWSKI* | *SonarSource*
*Software Developer @ Language Team*
http://sonarsource.com
--
You receive this message as a subscriber of the [email protected] mailing list.
To unsubscribe: mailto:[email protected]
For general help: mailto:[email protected]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws