You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Tom Brus (JIRA)" <ji...@apache.org> on 2017/01/17 21:05:26 UTC

[jira] [Created] (BCEL-285) "ClassFormatException: Invalid signature" thrown on generics

Tom Brus created BCEL-285:
-----------------------------

             Summary: "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 en 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 (NEON.2) and does not occur in Intellij (2016.3.2). This probably indicates that {{ecj}} and {{javac}}.

Since we are using {{sonar:findbugs}} which uses {{BCEL}} this is a major problem for us.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)