commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dave Brosius (JIRA)" <>
Subject [jira] [Commented] (BCEL-273) Regressions running FindBugs on BCEL6
Date Tue, 07 Jun 2016 03:31:20 GMT


Dave Brosius commented on BCEL-273:

I see this problem

Exception analyzing JPAI_Sample$MyEntity using detector edu.umd.cs.findbugs.detect.NoteUnconditionalParamDerefs
    java.lang.ClassCastException: edu.umd.cs.findbugs.bcel.generic.NULL2Z cannot be cast to
      At org.apache.commons.bcel6.generic.BranchHandle.getBI(
      At org.apache.commons.bcel6.generic.BranchHandle.getPosition(

This is caused by Findbugs optimization pass in BetterCFGBuilder2.optimize, specifically

                            if (nullIsTrue) {
                                // System.out.println("Found NULL2Z instruction");
                                head.swapInstruction(new NULL2Z());

                            } else {
                                // System.out.println("Found NONNULL2Z instruction");
                                head.swapInstruction(new NONNULL2Z());

This takes an IFNONNULL BranchHandle, and injects a special NULL2Z BranchInstruction into
it. It does not however change what head is, and so head is still a BranchInstruction that
is pointing to a ConversionInstruction. 

Really, the head instruction should be removed from the InstructionList, and replaced with
the NULL2Z (or at least a non-BranchHandle), but it does not.

Now this broke because of Sebb's changes, to BranchInstruction, here

    private BranchInstruction getBI() {
        return (BranchInstruction) super.getInstruction();

    public int getPosition() {
        return getBI().getPosition();

where getBI() assumes, (probably correctly) the the instruction is going to be of type BranchInstruction,
but NULL2Z is a ConversionInstruction.

So while this was caused by BCEL changes, i actually think the changes were right, and findbugs
needs to rewrite the InstructionList to take out the BranchHandle and replace it with a plain

> Regressions running FindBugs on BCEL6
> -------------------------------------
>                 Key: BCEL-273
>                 URL:
>             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
> I'm trying to port FindBugs to the latest greatest BCEL 6 state from trunk, see
> 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
> 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
> To see commits I needed to port FB to BCEL6 port, go to
> h5. How to reproduce
> {code}
> git clone
> 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:
> 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

View raw message