Re: [Fb-contrib-discuss] BigDecimal.equals() usage
Brought to you by:
dbrosius
From: Dave B. <dbr...@ba...> - 2010-02-18 02:03:25
|
Jean-Noël, Thanks for the mail, I updated the findbugs.xml file as per your suggestion, thanks! >> So I was wondering whether you would be interested in integrating the piece looking where the equals() method was declared in the class hierarchy? Sure! Can you rework it as part of MoreDumbMethods ? That would be great. >> Another interesting thing with this piece of code are the unit tests. That would be great. I'd like to stick to actually Unit tests, where the test was a method, rather than a detector, however. Otherwise, it would seem, that the unit tests would have to be based on reading class files and such that would really slow down the process. If we could build a framework for mocking the findbugs framework, such that each individual method (say sawOpcode) could be tested, that would be awesome. dave Jean-Noël Rouvignac wrote: > Hi Dave, > > I took a look at the differences between MoreDumbMethods and > FindBadUseOfBigDecimalEquals and I could see that the later warns of > the following case: > > GIVEN > A inhertis from BigDecimal but does not override equals() > THEN > soemone calls A.equals() > > This scenario also applies to sub classes of A that do not override > equals(). > > But obviously MoreDumbMethods takes care of a lot more methods. > So I was wondering whether you would be interested in integrating the > piece looking where the equals() method was declared in the class > hierarchy? > > > Another interesting thing with this piece of code are the unit tests. > I was thinking that this could be improved by using annotations > (possibly the findbugs annotations). I am not sure how you run the > tests currently, even though I saw a great deal of test samples. Let > me know if you are interested in using JUnit to run the tests. The > first test is very slow: arund 8 seconds, the next ones are still > slow: 1 second each. This can definitely be improved. > > One last thing is a typo in findbugs.xml file: It is refering > to EQ_BIGDECIMAL_EQUALS instead of MDM_BIGDECIMAL_EQUALS. > > I better included my patch inside fb-contrib source code, and enclosed > a patch for it. I am using maven to compile the code and run the tests > with "mvn install". > > Jean-Noel > > > 2010/2/4 Dave Brosius <dbr...@ba... > <mailto:dbr...@ba...>> > > Hi Jean-Noel, > > The MDM detector was contributed by Chris Peterson, and as > such, i'm not sure what the differences are between what you have > posted here, and what the original MDM detector. Can you > elaborate, thanks!. And thanks for helping out. > > dave > > Jean-Noël Rouvignac wrote: >> Hi, >> >> I saw you added recently the mesage MDM_BIGDECIMAL_EQUALS. >> As I was already working on this, I send you what I have so far. >> I think it might need some last minute polishing. >> >> But I have a test (FindBadUseOfBigDecimalEqualsTest) to ensure >> the detector correctly fnds vioaltions and does not show false >> positives. I use Junit 4 to run it. >> >> You can do whatever change you want on the code as per the >> licence (LGPL 2.1 or posterior, just like fb-confrib). >> If you require me to do more work on it, please let me know. >> >> Cheers, >> Jean-Noel > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------------ > SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, > Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW > http://p.sf.net/sfu/solaris-dev2dev > ------------------------------------------------------------------------ > > _______________________________________________ > Fb-contrib-discuss mailing list > Fb-...@li... > https://lists.sourceforge.net/lists/listinfo/fb-contrib-discuss > |