[FB-Discuss] findbugs problem

Kelly O'Hair Kelly.Ohair at Sun.COM
Wed May 14 22:27:29 EDT 2008


By the way, here is a smaller testcase:

package findbugsbug1;
public class Main {
     static int trips;
     public static void main(String[] args) {
         long msecs = 0;
         for ( ; msecs < 2; msecs++) {
            trips++;
         }
     }
}


I'm using a 32bit Intel Mac (Intel Core Duo) not a 64bit Mac
(Intel Core 2 Duo).

I suspect this has something to do with 64bit long arithmetic
on the Mac, or maybe with the Mac JDK 1.5? But it still only
happens when findbugs is run inside NetBeans.
It's a 1.3.0 findbugs, and NetBeans 6.1, but it doesn't seem
to matter what version of NetBeans is used.

Please don't treat this as a high priority issue. I've worked
around it.

-kto


Bill Pugh wrote:
> Can you attach the class file?
> 
> 	Bill
> 
> On Jan 29, 2008, at 2:33 PM, Kelly O'Hair wrote:
> 
>> I can only reproduce this when running findbugs from the NetBeans 6
>> plus
>> SQE code quality plugin. How frustrating. :^(
>>
>> Changed file to:
>> package findbugsbug1;
>> public class Main {
>>    static int trips;
>>    public static void main(String[] args) {
>>        // TODO code application logic here
>>        long onemin  1000L * 60L;
>>        long onehour  60L * onemin;
>>        long oneday  24L * onehour;
>>        for (long msecs  0L; msecs < (oneday*5L); msecs +> onehour*5L + onemin*13L) {
>>           trips++;
>>        }
>>    }
>> }
>>
>> Class file attached. Along with what I see from javap -all.
>>
>> Using jdk5 on the Mac from Apple.
>> java version "1.5.0_13"
>> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_13-
>> b05-237)
>> Java HotSpot(TM) Client VM (build 1.5.0_13-119, mixed mode, sharing)
>>
>> I'm using the SQE NetBeans 6 plugin from
>> URL: https://sqe.dev.java.net/updatecenters/sqe/updates.xml
>>
>> Hard to tell exactly what findbugs version it is, but I found a
>> version
>> properties file in one of the findbugs jar files, looks like:
>> release.number1.3.0
>> release.date	:39:19 EST, 08 November, 2007
>>
>> Looks like they might have used the eclipse plugin to create the
>> NetBeans plugin? :^(
>>
>> -kto
>>
>> Bill Pugh wrote:
>>> I don't get that warning on that file.
>>> Can you send a compiled class file?
>>> What version of FindBugs did you use?
>>>    Bill
>>> On Jan 29, 2008, at 1:01 PM, Kelly O'Hair wrote:
>>>> public class Main {
>>>>    public static void main(String[] args) {
>>>>        long onemin  1000L * 60L;
>>>>        long onehour  60L * onemin;
>>>>        long oneday  24L * onehour;
>>>>        for (long msecs  0L; msecs < (oneday*5L); msecs +>>> onehour*5L + onemin*13L) {
>>>>           System.out.println("msecs" + msecs);
>>>>        }
>>>>    }
>>>> }
>> Êþº¾
>>
>> SourceFile
>> `³
>> !
>>
>>
>>
>> Compiled from "Main.java"
>> public class findbugsbug1.Main extends java.lang.Object
>>  SourceFile: "Main.java"
>> {
>> static int trips;
>>
>> public findbugsbug1.Main();
>>  Code:
>>   0:	aload_0
>>   1:	invokespecial	#1; //Method java/lang/Object."<init>":()V
>>   4:	return
>>  LineNumberTable:
>>   line 2: 0
>>  LocalVariableTable:
>>   Start  Length  Slot  Name   Signature
>>   0      5      0    this       Lfindbugsbug1/Main;
>>
>> public static void main(java.lang.String[]);
>>  Code:
>>   0:	ldc2_w	#2; //long 60000l
>>   3:	lstore_1
>>   4:	ldc2_w	#4; //long 60l
>>   7:	lload_1
>>   8:	lmul
>>   9:	lstore_3
>>   10:	ldc2_w	#6; //long 24l
>>   13:	lload_3
>>   14:	lmul
>>   15:	lstore	5
>>   17:	lconst_0
>>   18:	lstore	7
>>   20:	lload	7
>>   22:	lload	5
>>   24:	ldc2_w	#8; //long 5l
>>   27:	lmul
>>   28:	lcmp
>>   29:	ifge	59
>>   32:	getstatic	#10; //Field trips:I
>>   35:	iconst_1
>>   36:	iadd
>>   37:	putstatic	#10; //Field trips:I
>>   40:	lload	7
>>   42:	lload_3
>>   43:	ldc2_w	#8; //long 5l
>>   46:	lmul
>>   47:	lload_1
>>   48:	ldc2_w	#11; //long 13l
>>   51:	lmul
>>   52:	ladd
>>   53:	ladd
>>   54:	lstore	7
>>   56:	goto	20
>>   59:	return
>>  LineNumberTable:
>>   line 6: 0
>>   line 7: 4
>>   line 8: 10
>>   line 9: 17
>>   line 10: 32
>>   line 9: 40
>>   line 12: 59
>>  LocalVariableTable:
>>   Start  Length  Slot  Name   Signature
>>   20      39      7    msecs       J
>>   0      60      0    args       [Ljava/lang/String;
>>   4      56      1    onemin       J
>>   10      50      3    onehour       J
>>   17      43      5    oneday       J
>>
>> }
>>
>> _______________________________________________
>> Findbugs-discuss mailing list
>> Findbugs-discuss at mcfeely.cs.umd.edu
>> http://mailman.cs.umd.edu/mailman/listinfo/findbugs-discuss
> 
> 
> _______________________________________________
> Findbugs-discuss mailing list
> Findbugs-discuss at mcfeely.cs.umd.edu
> http://mailman.cs.umd.edu/mailman/listinfo/findbugs-discuss



More information about the Findbugs-discuss mailing list