[
https://issues.apache.org/jira/browse/BCEL-178?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Will N updated BCEL-178:
------------------------
Attachment: BCEL-178-Utility.java.patch
> ClassFormatException: [Invalid signature: `TT;'] when using
> Utility.signatureToString
> -------------------------------------------------------------------------------------
>
> Key: BCEL-178
> URL: https://issues.apache.org/jira/browse/BCEL-178
> Project: Commons BCEL
> Issue Type: Bug
> Reporter: Will N
> Attachments: BCEL-178-Utility.java.patch
>
>
> A very similar issue to [Bug
> 48279|https://issues.apache.org/bugzilla/show_bug.cgi?id=48279] -
> {{Utility.signatureToString(...)}} can fail with this exception:
> {noformat}
> Caused by: org.apache.bcel.classfile.ClassFormatException: Invalid signature:
> `TT;'
> at org.apache.bcel.classfile.Utility.signatureToString(Utility.java:855)
> at org.apache.bcel.classfile.Utility.signatureToString(Utility.java:765)
> at
> org.apache.bcel.classfile.LocalVariable.toString(LocalVariable.java:236)
> at
> org.apache.bcel.classfile.LocalVariableTypeTable.toString(LocalVariableTypeTable.java:122)
> ...
> {noformat}
> This is failing for my code which has a variable typed as {{T}} like this:
> {code:java}
> <T> Envelope buildRequest(Class<T> contentClass) {
> Envelope result = buildEnvelope(); // some holder type
> T body = Utils.newInstance(contentClass); // generic method returning an
> instance of contentClass
> // ... more work ...
> return result;
> }
> {code}
> I've fixed this locally following the pattern used in [Bug
> 48279|https://issues.apache.org/bugzilla/show_bug.cgi?id=48279]'s fix (see
> r897699), essentially adding the {{'T'}} option next to {{'L'}} in the
> {{Switch}} statement (see attached patch)
--
This message was sent by Atlassian JIRA
(v6.2#6252)