commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Roberts (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (BCEL-285) "ClassFormatException: Invalid signature" thrown on generics
Date Fri, 24 Feb 2017 21:50:44 GMT

    [ https://issues.apache.org/jira/browse/BCEL-285?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15883584#comment-15883584
] 

Mark Roberts commented on BCEL-285:
-----------------------------------

This does look like an invalid signature to me.  The error message does not show the entire
signature, just the part it could not parse. The "\!" should not be there.  The remainder
of the signature (after the \!) looks correct and corresponds to "extends Object"  the "?"
should have been compiled into a "\*" in the signature.  Perhaps this is a bug in the compiler
you mention that it is using "\!" instead of "\*"?

> "ClassFormatException: Invalid signature" thrown on generics
> ------------------------------------------------------------
>
>                 Key: BCEL-285
>                 URL: https://issues.apache.org/jira/browse/BCEL-285
>             Project: Commons BCEL
>          Issue Type: Bug
>          Components: Parser
>    Affects Versions: 6.0
>         Environment: java 8, macOS 10.12.2
>            Reporter: Tom Brus
>
> The following stripped down example throws an Exception in {{BCEL}}:
> {code:title=Bar.java|borderStyle=solid}
> import java.io.IOException;
> import java.util.stream.Stream;
> import org.apache.bcel.classfile.ClassParser;
> public class Main {
>   public static void main(String[] args) throws IOException {
>     ClassParser parser = new ClassParser(Main.class.getResourceAsStream("Main.class"),
"Main.class");
>     parser.parse().getMethods()[2].getCode().toString(); /* <- EXCEPTION thrown */
> 		
>     ((Stream<? extends Object>)null).peek(x -> {}); /* <- problem spot */
>   }
> }
> {code}
> The exception is:
> {code}
> Exception in thread "main" org.apache.bcel.classfile.ClassFormatException: Invalid signature:
`!+Ljava/lang/Object;'
> 	at org.apache.bcel.classfile.Utility.signatureToString(Utility.java:930)
> 	at org.apache.bcel.classfile.LocalVariable.toStringShared(LocalVariable.java:187)
> 	at org.apache.bcel.classfile.LocalVariableTypeTable.toString(LocalVariableTypeTable.java:121)
> 	at java.lang.String.valueOf(String.java:2994)
> 	at java.lang.StringBuilder.append(StringBuilder.java:131)
> 	at org.apache.bcel.classfile.Code.toString(Code.java:316)
> 	at org.apache.bcel.classfile.Code.toString(Code.java:328)
> 	at Main.main(Main.java:9)
> {code}
> This problem only occurs in eclipse (I am using NEON.2) and does not occur in Intellij
(I am using 2016.3.2). This probably indicates that {{ecj}} and {{javac}} differ in their
class code generator.
> Since our project uses {{sonar:findbugs}} which uses {{BCEL}} this is a major problem
for us.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message