[ 
https://issues.apache.org/jira/browse/BCEL-285?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Tom Brus updated BCEL-285:
--------------------------
    Description: 
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.

  was:
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 (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.


> "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.4#6332)

Reply via email to