Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [e4-dev] Running Findbugs

Hi Tom,

findbugs is a great tool and I really was astonished to see that eclipse did not run it on a regular base (AFAIK). Correct me if i am wrong but i think until recently that was not the case.

So I contacted Dave Carver and we had a chat over that (I also submitted a eclipsecon talk but that was rejected by Oisin ;-). 
Anyway Dave setup the findbugs plugin for hudson and fixed a lot of stuff in his XML area. 
So findbugs is really worth the time investment. I just finds so much real bugs.

I think all eclipse project should use/require findbugs and build with warnings in category 1 should be rejected. BTW. Bill Pugh uses the JDK and eclipse as testcases and also will offer a cloud version in the next findbugs version. 
I am happy to talk about that at the next eclipse-summit ;-)

BTW. I also did a architectural analysis (findbugs does only code analysis) and found some interesting points regarding the dependecy of eclipse plugins. Please see my eclipse-summit 2009 talk. at http://www.slideshare.net/bmerkle

I will soon post my slides on slideshare about findbugs which i gave at ACCU last week in Oxford. I am open to help with findbugs setting it up and finetuning.

thanks and kind regards,
Berni.


On Wed, Apr 21, 2010 at 00:23, Tom Schindl <tom.schindl@xxxxxxxxxxxxxxx> wrote:
Hi,

Out of curiosity I've been running find bugs on our code base and here
are the stats:

org.eclipse.e4.core.contexts (3)
org.eclipse.e4.core.di (6)
org.eclipse.e4.core.di.extensions (1)
org.eclipse.e4.core.services (2)
org.eclipse.e4.core.tests.services (41)
org.eclipse.e4.core.tests.services.annotations (23)
org.eclipse.e4.core.tests.services.atinject (2)
org.eclipse.e4.demo.contacts (1)
org.eclipse.e4.demo.e4photo (8)
org.eclipse.e4.demo.e4photo.flickr.service.rest (2)
org.eclipse.e4.pde.webui (5)
org.eclipse.e4.tools.emf.editor (1)
org.eclipse.e4.tools.emf.editor3x (3)
org.eclipse.e4.tools.emf.liveeditor (2)
org.eclipse.e4.tools.emf.ui (10)
org.eclipse.e4.tools.ui.designer (45)
org.eclipse.e4.ui.bindings (4)
org.eclipse.e4.ui.bindings.tests (2)
org.eclipse.e4.ui.compatibility.tests (6)
org.eclipse.e4.ui.css.core (24)
org.eclipse.e4.ui.css.swt (13)
org.eclipse.e4.ui.gadgets (2)
org.eclipse.e4.ui.model.workbench (71)
org.eclipse.e4.ui.model.workbench.edit (19)
org.eclipse.e4.ui.services (1)
org.eclipse.e4.ui.tests (30)
org.eclipse.e4.ui.web (4)
org.eclipse.e4.ui.workbench (5)
org.eclipse.e4.ui.workbench.renderers.swt (8)
org.eclipse.e4.ui.workbench.swt (7)
org.eclipse.e4.xwt (100)
org.eclipse.e4.xwt.css (1)
org.eclipse.e4.xwt.pde (3)
org.eclipse.e4.xwt.tools.ui (12)
org.eclipse.e4.xwt.tools.ui.designer (93)
org.eclipse.e4.xwt.tools.ui.designer.core (33)
org.eclipse.e4.xwt.tools.ui.editor (37)
org.eclipse.e4.xwt.tools.ui.imagecapture (14)
org.eclipse.e4.xwt.tools.ui.palette (13)
org.eclipse.e4.xwt.tools.ui.xaml (14)
org.eclipse.e4.xwt.ui.workbench (1)
org.eclipse.e4.xwt.vex (37)
org.eclipse.platform (1)
===================================================
Overall bugs count: 710

And it reveals fairly cool bugs like this possible NPE in InjectorImpl:
--------------8<-------------------
> private void processClassHierarchy(Object userObject, AbstractObjectSupplier objectSupplier, boolean processStatic, boolean track, boolean normalOrder, List<Requestor> requestors) {
>               processClass(userObject, objectSupplier, (userObject == null) ? null : userObject.getClass(), new ArrayList<Class<?>>(5), processStatic, track, normalOrder, requestors);
>       }
>
>       /**
>        * Make the processor visit all declared members on the given class and all superclasses
>        */
>       private void processClass(Object userObject, AbstractObjectSupplier objectSupplier, Class<?> objectsClass, ArrayList<Class<?>> classHierarchy, boolean processStatic, boolean track, boolean normalOrder, List<Requestor> requestors) {
>               // order: superclass, fields, methods
>               if (objectsClass != null) {
>                       Class<?> superClass = objectsClass.getSuperclass();
>                       if (!superClass.getName().equals(JAVA_OBJECT)) {
>                               classHierarchy.add(objectsClass);
>                               processClass(userObject, objectSupplier, superClass, classHierarchy, processStatic, track, normalOrder, requestors);
>                               classHierarchy.remove(objectsClass);
>                       }
>               }
>               if (normalOrder) {
>                       processFields(userObject, objectSupplier, objectsClass, processStatic, track, requestors);
>                       processMethods(userObject, objectSupplier, objectsClass, classHierarchy, processStatic, track, requestors);
>               } else {
>                       processMethods(userObject, objectSupplier, objectsClass, classHierarchy, processStatic, track, requestors);
>                       processFields(userObject, objectSupplier, objectsClass, processStatic, track, requestors);
>               }
>       }
>
>       /**
>        * Make the processor visit all declared fields on the given class.
>        */
>       private void processFields(Object userObject, AbstractObjectSupplier objectSupplier, Class<?> objectsClass, boolean processStatic, boolean track, List<Requestor> requestors) {
>               Field[] fields = objectsClass.getDeclaredFields();
--------------8<-------------------

Which will lead to an NPE in the last line if userObject = null in the
2nd :-)

Tom

--
B e s t S o l u t i o n . a t                        EDV Systemhaus GmbH
------------------------------------------------------------------------
tom schindl                                        geschaeftsfuehrer/CEO
------------------------------------------------------------------------
eduard-bodem-gasse 5/1    A-6020 innsbruck      phone    ++43 512 935834
_______________________________________________
e4-dev mailing list
e4-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/e4-dev


Back to the top