commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tom Brus (JIRA)" <>
Subject [jira] [Created] (BCEL-285) "ClassFormatException: Invalid signature" thrown on generics
Date Tue, 17 Jan 2017 21:05:26 GMT
Tom Brus created BCEL-285:

             Summary: "ClassFormatException: Invalid signature" thrown on generics
                 Key: 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}}:

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 */

The exception is:
Exception in thread "main" org.apache.bcel.classfile.ClassFormatException: Invalid signature:
	at org.apache.bcel.classfile.Utility.signatureToString(
	at org.apache.bcel.classfile.LocalVariable.toStringShared(
	at org.apache.bcel.classfile.LocalVariableTypeTable.toString(
	at java.lang.String.valueOf(
	at java.lang.StringBuilder.append(
	at org.apache.bcel.classfile.Code.toString(
	at org.apache.bcel.classfile.Code.toString(
	at Main.main(

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

View raw message