commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebb (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (BCEL-273) Regressions running FindBugs on BCEL6
Date Tue, 07 Jun 2016 09:22:20 GMT

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

Sebb edited comment on BCEL-273 at 6/7/16 9:22 AM:
---------------------------------------------------

I see this problem
{code}
 Exception analyzing FPEnumValueOf using detector edu.umd.cs.findbugs.detect.NoteNonnullReturnValues
    java.lang.IllegalArgumentException: Cannot be used on an array type
      At org.apache.commons.bcel6.generic.InvokeInstruction.getClassName(InvokeInstruction.java:135)
      At edu.umd.cs.findbugs.ba.Hierarchy2.findExactMethod(Hierarchy2.java:84)
{code}

And it does seem to be a problem with BCEL, due to a new construct that i didn't notice before,
namely for enums, the generated values() method of enum looks like
{code}
 public static FPEnumValueOf[] values();
    descriptor: ()[LFPEnumValueOf;
    flags: ACC_PUBLIC, ACC_STATIC
    Code:
      stack=1, locals=0, args_size=0
         0: getstatic     #1                  // Field $VALUES:[LFPEnumValueOf;
         3: invokevirtual #2                  // Method "[LFPEnumValueOf;".clone:()Ljava/lang/Object;
         6: checkcast     #3                  // class "[LFPEnumValueOf;"
         9: areturn
      LineNumberTable:
        line 56: 0
{code}
notice the call to clone on an array!!

and in the constant pool, is this
{code}
Constant pool:
   #1 = Fieldref           #4.#40         // FPEnumValueOf.$VALUES:[LFPEnumValueOf;
   #2 = Methodref          #41.#42        // "[LFPEnumValueOf;".clone:()Ljava/lang/Object;
{code}

So java 8 is calling methods on arrays that bcel doesn't expect. I'll see if i can track down
where that is handled. In theory, you can call toString() on an array, and BCEL doesn't have
a fit, so we should be able to address this.

I'll keep looking




was (Author: dbrosius):
I see this problem

 Exception analyzing FPEnumValueOf using detector edu.umd.cs.findbugs.detect.NoteNonnullReturnValues
    java.lang.IllegalArgumentException: Cannot be used on an array type
      At org.apache.commons.bcel6.generic.InvokeInstruction.getClassName(InvokeInstruction.java:135)
      At edu.umd.cs.findbugs.ba.Hierarchy2.findExactMethod(Hierarchy2.java:84)


And it does seem to be a problem with BCEL, due to a new construct that i didn't notice before,
namely for enums, the generated values() method of enum looks like

 public static FPEnumValueOf[] values();
    descriptor: ()[LFPEnumValueOf;
    flags: ACC_PUBLIC, ACC_STATIC
    Code:
      stack=1, locals=0, args_size=0
         0: getstatic     #1                  // Field $VALUES:[LFPEnumValueOf;
         3: invokevirtual #2                  // Method "[LFPEnumValueOf;".clone:()Ljava/lang/Object;
         6: checkcast     #3                  // class "[LFPEnumValueOf;"
         9: areturn
      LineNumberTable:
        line 56: 0

notice the call to clone on an array!!

and in the constant pool, is this

Constant pool:
   #1 = Fieldref           #4.#40         // FPEnumValueOf.$VALUES:[LFPEnumValueOf;
   #2 = Methodref          #41.#42        // "[LFPEnumValueOf;".clone:()Ljava/lang/Object;


So java 8 is calling methods on arrays that bcel doesn't expect. I'll see if i can track down
where that is handled. In theory, you can call toString() on an array, and BCEL doesn't have
a fit, so we should be able to address this.

I'll keep looking



> Regressions running FindBugs on BCEL6
> -------------------------------------
>
>                 Key: BCEL-273
>                 URL: https://issues.apache.org/jira/browse/BCEL-273
>             Project: Commons BCEL
>          Issue Type: Bug
>          Components: Main
>    Affects Versions: 6.0
>            Reporter: Andrey Loskutov
>            Priority: Blocker
>             Fix For: 6.0
>
>         Attachments: bcel6_test_result.txt, invokedynamic.txt
>
>
> h5. PREFACE
> I'm trying to port FindBugs to the latest greatest BCEL 6 state from trunk, see https://github.com/findbugsproject/findbugs/issues/106.
> In short, FindBugs was using some manually created BCEL 5.2 fork which allowed us somehow
run BCEL on Java 8 and even Java 9.
> Unfortunately I have no idea how to rebuild that fork, because no one in the project
left any documentation.
> So anyway, my goal was to use unmodified BCEL6, therefore I fixed all compile issues
caused by BCEL-222 ((n)) and was able to run FB with BCEL6 head.
>  
> Unfortunately I found some regressions.
> h5. Environment
> I'm using my own git clone from BCEL mirror https://github.com/iloveeclipse/commons-bcel/commits/trunk
> The clone only adds few Eclipse files and fixes some obvious errors, nothing worth to
mention here. The reason why I'm not using svn because it is too slow and I won't waste my
time.
> To see commits I needed to port FB to BCEL6 port, go to https://github.com/findbugsproject/findbugs/tree/java9_bcel6
> h5. How to reproduce
> {code}
> git clone https://github.com/findbugsproject/findbugs.git
> cd findbugs
> git checkout java9_bcel6
> cd findbugs
> ant
> cd ../findbugsTestCases
> ant
> {code}
> You should run Java 8.
> After running tests, you should see many various errors, like: https://github.com/findbugsproject/findbugs/files/300401/bcel6_test_result.txt
> None of those error appear with the old private patched BCEL5.2 snapshot we've used before.
> It would be nice to fix the errors before the BCEL release.



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

Mime
View raw message