GithubHelp home page GithubHelp logo

tim-group / test-driven-detectors4findbugs Goto Github PK

View Code? Open in Web Editor NEW
17.0 9.0 18.0 92 KB

Test-Driven Detectors For FindBugs. Utility project to ease the development of custom plugin detectors for FindBugs.

License: Other

Java 100.00%

test-driven-detectors4findbugs's Issues

Possibly incorrect license listed

The readme of the project says it's available under the MIT license, however, I don't think we can pick that license. FindBugs is licensed under LGPL and tdd4fb dynamically links to classes from FindBugs, which means that tdd4fb should be licensed under the LGPL also.

Update the readme, and the license headers in source files to fix this issue.

missing XFactory interning in test driver

I wanted to share something I noticed last night while I was creating a testcase for one of my detectors.

I have a detector that is making frequent use of the X-Class hierarchy provided in findbugs 2.x (not sure if it was present already in 1.3.x).
So I have lines like XFactory.createXMethod(), and stuff like that.

What I noticed is, that the current findbugs "bootstrapping" in the test-driver does not seem to trigger this area to be properly initialized.

I checked the code of FindBugs2.java as well as FindBugs.java. What actually is missing from the test-drivers init is what currently happens in

FindBugs2.analyzeApplication() (lines 1056 onwards in the 2.0.1 codebase):

            XFactory factory = AnalysisContext.currentXFactory();
            Collection<ClassDescriptor> badClasses = new LinkedList<ClassDescriptor>();
            for (ClassDescriptor desc : referencedClassSet) {
                try {
                    XClass info = Global.getAnalysisCache().getClassAnalysis(XClass.class, desc);
                    factory.intern(info);
                } catch (CheckedAnalysisException e) {
                    AnalysisContext.logError("Couldn't get class info for " + desc, e);
                    badClasses.add(desc);
                } catch (RuntimeException e) {
                    AnalysisContext.logError("Couldn't get class info for " + desc, e);
                    badClasses.add(desc);
                }
            }

The factory.intern(info) statement is the key for this. It is the step where FindBugs iterates the applications classes and then "intern"s every one of it into the factory.

Without this step, all XFactory output is of type UnresolvedField and/or UnresolvedMethod, instead of MethodInfo/FieldInfo.

I worked around this, by triggering this step myself, i.e.

    private void internClass(final ClassDescriptor classDesc) {
        XFactory currentXFactory = AnalysisContext.currentXFactory();
          XClass xClass = currentXFactory.getXClass(classDesc);
          currentXFactory.intern(xClass);
    }

classDesc in the method above is a ClassDescriptor for a given class under analysis.

But it took me some time to figure out what was wrong in the first place.
Maybe there's some chance to "properly" init the XFactory before the detector is called.
I could imagine something like the above happening in

DetectorRunner.runDetectorOnClass(Detector2, Class<?>, BugReporter)

The problem with my suggested solution would be, that this however would only work for the class being handed in. Super- and SubTypes could still work by tweaking the above internClass() helper method to take this into account. But what about other types this class refers to?

I think this quickly becomes quite complex, and the "original" findbugs bootstrapping has this solved already.
Maybe it is possible to lend the setup logic from findbugs 2.x for this as well?

Support Detector2 interface

Hi ALL,

currently I want to use this library to test a FindBugs plugin which implements Detector2 interface. I can provide a patch for this issue, but this library looks inactive, so I am afraid that you will not check and merge it.

Can you review, merge my pull request and deploy new version into Maven central repository?
If you can, I will send a patch for you (and this is the best plan for me). If you cannot, I will fork this library and try to deploy with another groupId.

Thanks in advance.

BugMatcher not propagated by Detector --> Detector2 delegation method

DetectorAssert features several "adaptor" style methods, which basically convert a Detector into a Detector2 and then delegate the actual logic to the Detector2 based implementation.

I found an occurence where the BugMatcher handed to

DetectorAssert.assertBugReported(...)

is not properly handed over.

I will attach a pull request.

DetectorAssert.addRegistrar(...) has no effect

I just tried to register a custom Analysis Engine via DetectorAssert.addRegistrar(....)

This however does not work as expected, i.e. the custom engines are not used during during the initial analysis of the application classes.

To my understanding the cause is in the static nature of the initialization.
addRegistrar() mofifies the static field USER_DEFINED_ENGINE_REGISTRARS in DetectorRunner. But this happens effectively too late, because the static inner class SINGLETON is automatically initialized the moment DetectorAssert tries to touch DetectorRunner.

So effectively the whole initialization procedure is already completed once the custom registrar is added to the list.

findbugs 2.x

It appears that the detector does not work with findbugs 2.x. There are actually a couple of non-passive changes in the abstract detectors, making it difficult to develop/test with findbugs 1.3.9 but actually run with findbugs 2.x.

NullPointerException when initializing a BugAccumulator in the detector's constructor

The Junit Code
public class CipherVerifierTester {
@test public void
raisesAnyBugAgainstClassWithLongName() throws Exception {

    // Must obtain a BugReporter instance from this method
    BugReporter bugReporter = DetectorAssert.bugReporterForTesting();

    // And pass the same BugReporter to your detector
    CipherVerifier detector = new CipherVerifier(bugReporter);

    // Next assert that your detector has raised a bug against a specific class
    DetectorAssert.assertBugReported(EncryptVerifierBenchmark.class, 
                                     detector, 
                                     bugReporter);
}

}

The Detector Code
public class CipherVerifier implements Detector {
BugReporter bugReporter;
BugAccumulator bugAccumulator;
Method method;
ClassContext classContext;

public CipherVerifier(BugReporter bugReporter) {
    this.bugReporter    = bugReporter;
    this.bugAccumulator = new BugAccumulator(bugReporter);
}

}

NullPointerException at the line of the detector code:
this.bugAccumulator = new BugAccumulator(bugReporter);

2013-07-08_1143-junit

2013-07-08_1144-srccode

Compatibility with Findbugs 3

Hi,
I just tried to update the version of Findbugs in the POM, but it seems to be not that easy.
The AnalysisCacheToAnalysisContextAdapter (from Findbugs) is no more avalible. The only way to build AnalysisContext in FB3 it is using its constructor. But: there is no Project (FB) instance in DetectorRunner.
Can you update the compatibility or give some hint how to do it?
Best regards!

PluginDoesntContainMetadataException because the wrong findbugs.xml is found when looking for the core plugin

I have a detector maven project. The detector tests naturally are in the same project. Using the current tdd4fb snapshot I get the exception when launching tests (launching from Eclipse here, but it's the same when invoking tests from command line with Maven):

java.lang.ExceptionInInitializerError
    at edu.umd.cs.findbugs.DetectorFactoryCollection.getCoreResource(DetectorFactoryCollection.java:392)
    at edu.umd.cs.findbugs.SystemProperties.loadPropertiesFromConfigFile(SystemProperties.java:77)
    at edu.umd.cs.findbugs.SystemProperties.<clinit>(SystemProperties.java:60)
    at edu.umd.cs.findbugs.ProjectStats.<clinit>(ProjectStats.java:68)
    at com.youdevise.fbplugins.tdd4fb.TestingBugReporter$CrossVersionTddBugReporter.<init>(TestingBugReporter.java:74)
    at com.youdevise.fbplugins.tdd4fb.TestingBugReporter$CrossVersionTddBugReporter.<init>(TestingBugReporter.java:72)
    at com.youdevise.fbplugins.tdd4fb.TestingBugReporter$BugReporterInvocationHandler.<init>(TestingBugReporter.java:57)
    at com.youdevise.fbplugins.tdd4fb.TestingBugReporter$BugReporterInvocationHandler.<init>(TestingBugReporter.java:56)
    at com.youdevise.fbplugins.tdd4fb.TestingBugReporter.crossVersionBugReporter(TestingBugReporter.java:49)
    at com.youdevise.fbplugins.tdd4fb.TestingBugReporter.tddBugReporter(TestingBugReporter.java:45)
    at com.youdevise.fbplugins.tdd4fb.DetectorRunner$Singleton.<clinit>(DetectorRunner.java:74)
    at com.youdevise.fbplugins.tdd4fb.DetectorRunner.assertInitialised(DetectorRunner.java:268)
    at com.youdevise.fbplugins.tdd4fb.DetectorAssert.bugReporterForTesting(DetectorAssert.java:112)
    at ru.argustelecom.designtimeutils.findbugs.detectors.AbstractDetectorTest.init(AbstractDetectorTest.java:27)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at org.junit.runners.Suite.runChild(Suite.java:127)
    at org.junit.runners.Suite.runChild(Suite.java:26)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at org.junit.runners.Suite.runChild(Suite.java:127)
    at org.junit.runners.Suite.runChild(Suite.java:26)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: java.lang.IllegalStateException: Unable to load core plugin
    at edu.umd.cs.findbugs.PluginLoader.loadCorePlugin(PluginLoader.java:1475)
    at edu.umd.cs.findbugs.PluginLoader.loadInitialPlugins(PluginLoader.java:1425)
    at edu.umd.cs.findbugs.PluginLoader.<clinit>(PluginLoader.java:154)
    ... 53 more
Caused by: edu.umd.cs.findbugs.PluginDoesntContainMetadataException: Core pluginfindbugs-3.0.1.jar doesn't contain findbugs.xml; got file:/F:/rep/TechService-3.11/workspace/tools/findbugs-detectors/target/classes/findbugs.xml from sun.misc.Launcher$AppClassLoader[file:/F:/rep/TechService-3.11/workspace/tools/findbugs-detectors/target/test-classes/, file:/F:/rep/TechService-3.11/workspace/tools/findbugs-detectors/target/classes/, file:/C:/Users/s.golovanov/.m2/repository/com/google/code/findbugs/findbugs/3.0.1/findbugs-3.0.1.jar, file:/C:/Users/s.golovanov/.m2/repository/net/jcip/jcip-annotations/1.0/jcip-annotations-1.0.jar, file:/C:/Users/s.golovanov/.m2/repository/com/google/code/findbugs/jsr305/2.0.1/jsr305-2.0.1.jar, file:/C:/Users/s.golovanov/.m2/repository/com/google/code/findbugs/bcel-findbugs/6.0/bcel-findbugs-6.0.jar, file:/C:/Users/s.golovanov/.m2/repository/com/google/code/findbugs/jFormatString/2.0.1/jFormatString-2.0.1.jar, file:/C:/Users/s.golovanov/.m2/repository/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar, file:/C:/Users/s.golovanov/.m2/repository/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar, file:/C:/Users/s.golovanov/.m2/repository/org/ow2/asm/asm-debug-all/5.0.2/asm-debug-all-5.0.2.jar, file:/C:/Users/s.golovanov/.m2/repository/org/ow2/asm/asm-commons/5.0.2/asm-commons-5.0.2.jar, file:/C:/Users/s.golovanov/.m2/repository/org/ow2/asm/asm-tree/5.0.2/asm-tree-5.0.2.jar, file:/C:/Users/s.golovanov/.m2/repository/org/ow2/asm/asm/5.0.2/asm-5.0.2.jar, file:/C:/Users/s.golovanov/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar, file:/C:/Users/s.golovanov/.m2/repository/com/apple/AppleJavaExtensions/1.4/AppleJavaExtensions-1.4.jar, file:/C:/Users/s.golovanov/.m2/repository/jaxen/jaxen/1.1.6/jaxen-1.1.6.jar, file:/C:/Users/s.golovanov/.m2/repository/junit/junit/4.11/junit-4.11.jar, file:/C:/Users/s.golovanov/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar, file:/C:/Users/s.golovanov/.m2/repository/com/youdevise/test-driven-detectors4findbugs/1.1-ARGUS/test-driven-detectors4findbugs-1.1-ARGUS.jar, file:/C:/Users/s.golovanov/.m2/repository/org/hamcrest/hamcrest-library/1.2/hamcrest-library-1.2.jar, file:/C:/Users/s.golovanov/.m2/repository/joda-time/joda-time/2.6/joda-time-2.6.jar, file:/F:/rep/TechService-3.11/workspace/server-conf/core/target/classes/, file:/F:/rep/TechService-3.11/workspace/server-conf/jboss-conf/target/classes/, file:/C:/Users/s.golovanov/.m2/repository/com/google/code/findbugs/annotations/3.0.1/annotations-3.0.1.jar, file:/F:/rep/TechService-3.11/workspace/server-app/system/target/classes/, file:/C:/Users/s.golovanov/.m2/repository/org/apache/commons/commons-lang3/3.1/commons-lang3-3.1.jar, file:/C:/Users/s.golovanov/.m2/repository/com/thoughtworks/xstream/xstream/1.4.7/xstream-1.4.7.jar, file:/C:/Users/s.golovanov/.m2/repository/xmlpull/xmlpull/1.1.3.1/xmlpull-1.1.3.1.jar, file:/C:/Users/s.golovanov/.m2/repository/xpp3/xpp3_min/1.1.4c/xpp3_min-1.1.4c.jar, file:/C:/Users/s.golovanov/.m2/repository/commons-beanutils/commons-beanutils/1.9.1/commons-beanutils-1.9.1.jar, file:/C:/Users/s.golovanov/.m2/repository/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar, file:/C:/Users/s.golovanov/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar, file:/C:/Users/s.golovanov/.m2/repository/org/jadira/usertype/usertype.core/3.0.0.GA/usertype.core-3.0.0.GA.jar, file:/C:/Users/s.golovanov/.m2/repository/org/hibernate/hibernate-entitymanager/4.3.7.Final/hibernate-entitymanager-4.3.7.Final.jar, file:/C:/Users/s.golovanov/.m2/repository/org/jboss/logging/jboss-logging/3.1.4.GA/jboss-logging-3.1.4.GA.jar, file:/C:/Users/s.golovanov/.m2/repository/org/jboss/logging/jboss-logging-annotations/1.2.0.Beta1/jboss-logging-annotations-1.2.0.Beta1.jar, file:/C:/Users/s.golovanov/.m2/repository/org/hibernate/hibernate-core/4.3.7.Final/hibernate-core-4.3.7.Final.jar, file:/C:/Users/s.golovanov/.m2/repository/antlr/antlr/2.7.7/antlr-2.7.7.jar, file:/C:/Users/s.golovanov/.m2/repository/org/jboss/jandex/1.1.0.Final/jandex-1.1.0.Final.jar, file:/C:/Users/s.golovanov/.m2/repository/org/hibernate/common/hibernate-commons-annotations/4.0.5.Final/hibernate-commons-annotations-4.0.5.Final.jar, file:/C:/Users/s.golovanov/.m2/repository/org/javassist/javassist/3.18.1-GA/javassist-3.18.1-GA.jar, file:/C:/Users/s.golovanov/.m2/repository/org/joda/joda-money/0.6/joda-money-0.6.jar, file:/C:/Users/s.golovanov/.m2/repository/org/slf4j/slf4j-api/1.7.5/slf4j-api-1.7.5.jar, file:/C:/Users/s.golovanov/.m2/repository/org/jadira/usertype/usertype.spi/3.0.0.GA/usertype.spi-3.0.0.GA.jar, file:/C:/Users/s.golovanov/.m2/repository/org/beanshell/bsh/2.0b4/bsh-2.0b4.jar, file:/C:/Users/s.golovanov/.m2/repository/javax/jcr/jcr/2.0/jcr-2.0.jar, file:/C:/Users/s.golovanov/.m2/repository/dumbster/dumbster/1.6/dumbster-1.6.jar, file:/C:/Users/s.golovanov/.m2/repository/javax/activation/activation/1.1.1/activation-1.1.1.jar, file:/C:/Users/s.golovanov/.m2/repository/javax/mail/mail/1.5.0-b01/mail-1.5.0-b01.jar, file:/C:/Users/s.golovanov/.m2/repository/com/jhlabs/javaproj/1.0.6/javaproj-1.0.6.jar, file:/C:/Users/s.golovanov/.m2/repository/org/optaplanner/optaplanner-core/6.0.1.Final/optaplanner-core-6.0.1.Final.jar, file:/C:/Users/s.golovanov/.m2/repository/org/kie/kie-api/6.0.1.Final/kie-api-6.0.1.Final.jar, file:/C:/Users/s.golovanov/.m2/repository/org/kie/kie-internal/6.0.1.Final/kie-internal-6.0.1.Final.jar, file:/C:/Users/s.golovanov/.m2/repository/org/drools/drools-core/6.0.1.Final/drools-core-6.0.1.Final.jar, file:/C:/Users/s.golovanov/.m2/repository/org/mvel/mvel2/2.1.8.Final/mvel2-2.1.8.Final.jar, file:/C:/Users/s.golovanov/.m2/repository/org/drools/drools-compiler/6.0.1.Final/drools-compiler-6.0.1.Final.jar, file:/C:/Users/s.golovanov/.m2/repository/org/antlr/antlr-runtime/3.5/antlr-runtime-3.5.jar, file:/C:/Users/s.golovanov/.m2/repository/com/google/protobuf/protobuf-java/2.5.0/protobuf-java-2.5.0.jar, file:/C:/Users/s.golovanov/.m2/repository/commons-io/commons-io/2.1/commons-io-2.1.jar, file:/C:/Users/s.golovanov/.m2/repository/pentaho/mondrian/3.8.0.0-ARGUS-2/mondrian-3.8.0.0-ARGUS-2.jar, file:/C:/Users/s.golovanov/.m2/repository/commons-dbcp/commons-dbcp/1.2.1/commons-dbcp-1.2.1.jar, file:/C:/Users/s.golovanov/.m2/repository/commons-math/commons-math/1.1/commons-math-1.1.jar, file:/C:/Users/s.golovanov/.m2/repository/commons-discovery/commons-discovery/0.2/commons-discovery-0.2.jar, file:/C:/Users/s.golovanov/.m2/repository/commons-pool/commons-pool/1.2/commons-pool-1.2.jar, file:/C:/Users/s.golovanov/.m2/repository/commons-vfs/commons-vfs/20100924-pentaho/commons-vfs-20100924-pentaho.jar, file:/C:/Users/s.golovanov/.m2/repository/javacup/javacup/10k/javacup-10k.jar, file:/C:/Users/s.golovanov/.m2/repository/net/java/dev/javacc/javacc/5.0/javacc-5.0.jar, file:/C:/Users/s.golovanov/.m2/repository/eigenbase/eigenbase-xom/1.3.1/eigenbase-xom-1.3.1.jar, file:/C:/Users/s.golovanov/.m2/repository/org/apache/ant/ant/1.7.1/ant-1.7.1.jar, file:/C:/Users/s.golovanov/.m2/repository/org/apache/ant/ant-launcher/1.7.1/ant-launcher-1.7.1.jar, file:/C:/Users/s.golovanov/.m2/repository/eigenbase/eigenbase-properties/1.1.2/eigenbase-properties-1.1.2.jar, file:/C:/Users/s.golovanov/.m2/repository/eigenbase/eigenbase-resgen/1.3.1/eigenbase-resgen-1.3.1.jar, file:/C:/Users/s.golovanov/.m2/repository/sun/jlfgr/1.0/jlfgr-1.0.jar, file:/C:/Users/s.golovanov/.m2/repository/javax/servlet/jsp-api/2.0/jsp-api-2.0.jar, file:/C:/Users/s.golovanov/.m2/repository/javax/servlet/servlet-api/2.4/servlet-api-2.4.jar, file:/C:/Users/s.golovanov/.m2/repository/log4j/log4j/1.2.16/log4j-1.2.16.jar, file:/C:/Users/s.golovanov/.m2/repository/xalan/xalan/2.6.0/xalan-2.6.0.jar, file:/C:/Users/s.golovanov/.m2/repository/xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.jar, file:/C:/Users/s.golovanov/.m2/repository/org/olap4j/olap4j/1.2.0/olap4j-1.2.0.jar, file:/C:/Users/s.golovanov/.m2/repository/org/pivot4j/pivot4j-core/1.0.a597fb29250dbd4c529c168da8067f496cda1fb5/pivot4j-core-1.0.a597fb29250dbd4c529c168da8067f496cda1fb5.jar, file:/C:/Users/s.golovanov/.m2/repository/commons-configuration/commons-configuration/1.10/commons-configuration-1.10.jar, file:/C:/Users/s.golovanov/.m2/repository/de/jflex/jflex/1.4.3/jflex-1.4.3.jar, file:/C:/Users/s.golovanov/.m2/repository/org/apache/poi/poi/3.10-FINAL/poi-3.10-FINAL.jar, file:/C:/Users/s.golovanov/.m2/repository/commons-codec/commons-codec/1.5/commons-codec-1.5.jar, file:/C:/Users/s.golovanov/.m2/repository/org/apache/poi/poi-ooxml/3.10-FINAL/poi-ooxml-3.10-FINAL.jar, file:/C:/Users/s.golovanov/.m2/repository/org/apache/poi/poi-ooxml-schemas/3.10-FINAL/poi-ooxml-schemas-3.10-FINAL.jar, file:/C:/Users/s.golovanov/.m2/repository/org/apache/xmlbeans/xmlbeans/2.3.0/xmlbeans-2.3.0.jar, file:/C:/Users/s.golovanov/.m2/repository/stax/stax-api/1.0.1/stax-api-1.0.1.jar, file:/C:/Users/s.golovanov/.m2/repository/org/apache/xmlgraphics/fop/1.1/fop-1.1.jar, file:/C:/Users/s.golovanov/.m2/repository/org/apache/xmlgraphics/xmlgraphics-commons/1.5/xmlgraphics-commons-1.5.jar, file:/C:/Users/s.golovanov/.m2/repository/org/apache/xmlgraphics/batik-svg-dom/1.7/batik-svg-dom-1.7.jar, file:/C:/Users/s.golovanov/.m2/repository/org/apache/xmlgraphics/batik-anim/1.7/batik-anim-1.7.jar, file:/C:/Users/s.golovanov/.m2/repository/org/apache/xmlgraphics/batik-css/1.7/batik-css-1.7.jar, file:/C:/Users/s.golovanov/.m2/repository/org/apache/xmlgraphics/batik-dom/1.7/batik-dom-1.7.jar, file:/C:/Users/s.golovanov/.m2/repository/org/apache/xmlgraphics/batik-parser/1.7/batik-parser-1.7.jar, file:/C:/Users/s.golovanov/.m2/repository/org/apache/xmlgraphics/batik-util/1.7/batik-util-1.7.jar, file:/C:/Users/s.golovanov/.m2/repository/xml-apis/xml-apis-ext/1.3.04/xml-apis-ext-1.3.04.jar, file:/C:/Users/s.golovanov/.m2/repository/org/apache/xmlgraphics/batik-bridge/1.7/batik-bridge-1.7.jar, file:/C:/Users/s.golovanov/.m2/repository/org/apache/xmlgraphics/batik-script/1.7/batik-script-1.7.jar, file:/C:/Users/s.golovanov/.m2/repository/org/apache/xmlgraphics/batik-js/1.7/batik-js-1.7.jar, file:/C:/Users/s.golovanov/.m2/repository/org/apache/xmlgraphics/batik-xml/1.7/batik-xml-1.7.jar, file:/C:/Users/s.golovanov/.m2/repository/org/apache/xmlgraphics/batik-awt-util/1.7/batik-awt-util-1.7.jar, file:/C:/Users/s.golovanov/.m2/repository/org/apache/xmlgraphics/batik-gvt/1.7/batik-gvt-1.7.jar, file:/C:/Users/s.golovanov/.m2/repository/org/apache/xmlgraphics/batik-transcoder/1.7/batik-transcoder-1.7.jar, file:/C:/Users/s.golovanov/.m2/repository/org/apache/xmlgraphics/batik-svggen/1.7/batik-svggen-1.7.jar, file:/C:/Users/s.golovanov/.m2/repository/org/apache/xmlgraphics/batik-extension/1.7/batik-extension-1.7.jar, file:/C:/Users/s.golovanov/.m2/repository/org/apache/xmlgraphics/batik-ext/1.7/batik-ext-1.7.jar, file:/C:/Users/s.golovanov/.m2/repository/avalon-framework/avalon-framework-api/4.3/avalon-framework-api-4.3.jar, file:/C:/Users/s.golovanov/.m2/repository/avalon-logkit/avalon-logkit/2.1/avalon-logkit-2.1.jar, file:/C:/Users/s.golovanov/.m2/repository/geronimo-spec/geronimo-spec-javamail/1.3.1-rc3/geronimo-spec-javamail-1.3.1-rc3.jar, file:/C:/Users/s.golovanov/.m2/repository/geronimo-spec/geronimo-spec-jms/1.1-rc4/geronimo-spec-jms-1.1-rc4.jar, file:/C:/Users/s.golovanov/.m2/repository/avalon-framework/avalon-framework-impl/4.3/avalon-framework-impl-4.3.jar, file:/C:/Users/s.golovanov/.m2/repository/xml-apis/xmlParserAPIs/2.0.2/xmlParserAPIs-2.0.2.jar, file:/C:/Users/s.golovanov/.m2/repository/jmock/jmock/1.0.1/jmock-1.0.1.jar, file:/C:/Users/s.golovanov/.m2/repository/org/freemarker/freemarker/2.3.20/freemarker-2.3.20.jar, file:/C:/Users/s.golovanov/.m2/repository/org/apache/lucene/lucene-highlighter/3.6.2/lucene-highlighter-3.6.2.jar, file:/C:/Users/s.golovanov/.m2/repository/org/apache/lucene/lucene-queries/3.6.2/lucene-queries-3.6.2.jar, file:/C:/Users/s.golovanov/.m2/repository/jakarta-regexp/jakarta-regexp/1.4/jakarta-regexp-1.4.jar, file:/C:/Users/s.golovanov/.m2/repository/net/sf/jasperreports/jasperreports/5.6.1/jasperreports-5.6.1.jar, file:/C:/Users/s.golovanov/.m2/repository/com/lowagie/itext/2.1.7.js2/itext-2.1.7.js2.jar, file:/C:/Users/s.golovanov/.m2/repository/bouncycastle/bcmail-jdk14/138/bcmail-jdk14-138.jar, file:/C:/Users/s.golovanov/.m2/repository/bouncycastle/bcprov-jdk14/138/bcprov-jdk14-138.jar, file:/C:/Users/s.golovanov/.m2/repository/org/bouncycastle/bctsp-jdk14/1.38/bctsp-jdk14-1.38.jar, file:/C:/Users/s.golovanov/.m2/repository/org/bouncycastle/bcprov-jdk14/1.38/bcprov-jdk14-1.38.jar, file:/C:/Users/s.golovanov/.m2/repository/org/bouncycastle/bcmail-jdk14/1.38/bcmail-jdk14-1.38.jar, file:/C:/Users/s.golovanov/.m2/repository/jfree/jcommon/1.0.15/jcommon-1.0.15.jar, file:/C:/Users/s.golovanov/.m2/repository/jfree/jfreechart/1.0.12/jfreechart-1.0.12.jar, file:/C:/Users/s.golovanov/.m2/repository/org/codehaus/castor/castor/1.2/castor-1.2.jar, file:/C:/Users/s.golovanov/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.4.1/jackson-core-2.4.1.jar, file:/C:/Users/s.golovanov/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.4.1/jackson-databind-2.4.1.jar, file:/C:/Users/s.golovanov/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.4.1/jackson-annotations-2.4.1.jar, file:/C:/Users/s.golovanov/.m2/repository/org/apache/lucene/lucene-core/4.5.1/lucene-core-4.5.1.jar, file:/C:/Users/s.golovanov/.m2/repository/net/sf/jasperreports/jasperreports-fonts/5.6.1/jasperreports-fonts-5.6.1.jar, file:/C:/Users/s.golovanov/.m2/repository/org/glassfish/javax.json/1.0.3/javax.json-1.0.3.jar, file:/C:/Users/s.golovanov/.m2/repository/org/jboss/resteasy/jaxrs-api/3.0.10.Final/jaxrs-api-3.0.10.Final.jar, file:/C:/Users/s.golovanov/.m2/repository/org/jboss/spec/javax/batch/jboss-batch-api_1.0_spec/1.0.0.Final/jboss-batch-api_1.0_spec-1.0.0.Final.jar, file:/C:/Users/s.golovanov/.m2/repository/javax/inject/javax.inject/1/javax.inject-1.jar, file:/C:/Users/s.golovanov/.m2/repository/org/jboss/spec/javax/ejb/jboss-ejb-api_3.2_spec/1.0.0.Final/jboss-ejb-api_3.2_spec-1.0.0.Final.jar, file:/C:/Users/s.golovanov/.m2/repository/org/jboss/spec/javax/el/jboss-el-api_3.0_spec/1.0.4.Final/jboss-el-api_3.0_spec-1.0.4.Final.jar, file:/C:/Users/s.golovanov/.m2/repository/org/jboss/spec/javax/enterprise/concurrent/jboss-concurrency-api_1.0_spec/1.0.0.Final/jboss-concurrency-api_1.0_spec-1.0.0.Final.jar, file:/C:/Users/s.golovanov/.m2/repository/org/jboss/spec/javax/faces/jboss-jsf-api_2.2_spec/2.2.8/jboss-jsf-api_2.2_spec-2.2.8.jar, file:/C:/Users/s.golovanov/.m2/repository/org/jboss/spec/javax/interceptor/jboss-interceptors-api_1.2_spec/1.0.0.Final/jboss-interceptors-api_1.2_spec-1.0.0.Final.jar, file:/C:/Users/s.golovanov/.m2/repository/org/jboss/spec/javax/jms/jboss-jms-api_2.0_spec/1.0.0.Final/jboss-jms-api_2.0_spec-1.0.0.Final.jar, file:/C:/Users/s.golovanov/.m2/repository/org/jboss/spec/javax/resource/jboss-connector-api_1.7_spec/1.0.0.Final/jboss-connector-api_1.7_spec-1.0.0.Final.jar, file:/C:/Users/s.golovanov/.m2/repository/org/jboss/spec/javax/security/auth/message/jboss-jaspi-api_1.1_spec/1.0.0.Final/jboss-jaspi-api_1.1_spec-1.0.0.Final.jar, file:/C:/Users/s.golovanov/.m2/repository/org/jboss/spec/javax/security/jacc/jboss-jacc-api_1.5_spec/1.0.0.Final/jboss-jacc-api_1.5_spec-1.0.0.Final.jar, file:/C:/Users/s.golovanov/.m2/repository/org/jboss/spec/javax/servlet/jboss-servlet-api_3.1_spec/1.0.0.Final/jboss-servlet-api_3.1_spec-1.0.0.Final.jar, file:/C:/Users/s.golovanov/.m2/repository/org/jboss/spec/javax/servlet/jsp/jboss-jsp-api_2.3_spec/1.0.1.Final/jboss-jsp-api_2.3_spec-1.0.1.Final.jar, file:/C:/Users/s.golovanov/.m2/repository/org/jboss/spec/javax/servlet/jstl/jboss-jstl-api_1.2_spec/1.1.2.Final/jboss-jstl-api_1.2_spec-1.1.2.Final.jar, file:/C:/Users/s.golovanov/.m2/repository/org/jboss/spec/javax/transaction/jboss-transaction-api_1.2_spec/1.0.0.Final/jboss-transaction-api_1.2_spec-1.0.0.Final.jar, file:/C:/Users/s.golovanov/.m2/repository/org/jboss/spec/javax/websocket/jboss-websocket-api_1.1_spec/1.1.0.Final/jboss-websocket-api_1.1_spec-1.1.0.Final.jar, file:/C:/Users/s.golovanov/.m2/repository/org/jboss/spec/javax/xml/bind/jboss-jaxb-api_2.2_spec/1.0.4.Final/jboss-jaxb-api_2.2_spec-1.0.4.Final.jar, file:/C:/Users/s.golovanov/.m2/repository/org/jboss/spec/javax/xml/rpc/jboss-jaxrpc-api_1.1_spec/1.0.1.Final/jboss-jaxrpc-api_1.1_spec-1.0.1.Final.jar, file:/C:/Users/s.golovanov/.m2/repository/org/jboss/spec/javax/xml/soap/jboss-saaj-api_1.3_spec/1.0.3.Final/jboss-saaj-api_1.3_spec-1.0.3.Final.jar, file:/C:/Users/s.golovanov/.m2/repository/org/jboss/spec/javax/xml/ws/jboss-jaxws-api_2.2_spec/2.0.2.Final/jboss-jaxws-api_2.2_spec-2.0.2.Final.jar, file:/C:/Users/s.golovanov/.m2/repository/org/hibernate/javax/persistence/hibernate-jpa-2.1-api/1.0.0.Final/hibernate-jpa-2.1-api-1.0.0.Final.jar, file:/C:/Users/s.golovanov/.m2/repository/javax/enterprise/cdi-api/1.2/cdi-api-1.2.jar, file:/C:/Users/s.golovanov/.m2/repository/javax/el/javax.el-api/3.0.0/javax.el-api-3.0.0.jar, file:/C:/Users/s.golovanov/.m2/repository/javax/interceptor/javax.interceptor-api/1.2/javax.interceptor-api-1.2.jar, file:/C:/Users/s.golovanov/.m2/repository/org/osgi/org.osgi.core/5.0.0/org.osgi.core-5.0.0.jar, file:/C:/Users/s.golovanov/.m2/repository/com/sun/mail/javax.mail/1.5.1/javax.mail-1.5.1.jar, file:/C:/Users/s.golovanov/.m2/repository/org/jboss/spec/javax/annotation/jboss-annotations-api_1.2_spec/1.0.0.Final/jboss-annotations-api_1.2_spec-1.0.0.Final.jar, file:/C:/Users/s.golovanov/.m2/repository/javax/validation/validation-api/1.1.0.Final/validation-api-1.1.0.Final.jar, file:/C:/Users/s.golovanov/.m2/repository/org/jboss/spec/javax/management/j2ee/jboss-j2eemgmt-api_1.1_spec/1.0.1.Final/jboss-j2eemgmt-api_1.1_spec-1.0.1.Final.jar, file:/C:/Users/s.golovanov/.m2/repository/org/wildfly/wildfly-build-config/8.2.0.Final/wildfly-build-config-8.2.0.Final.jar, file:/C:/Users/s.golovanov/.m2/repository/org/mockito/mockito-core/1.9.5/mockito-core-1.9.5.jar, file:/C:/Users/s.golovanov/.m2/repository/org/objenesis/objenesis/1.0/objenesis-1.0.jar, file:/C:/Users/s.golovanov/.m2/repository/org/powermock/powermock-module-junit4/1.5.5/powermock-module-junit4-1.5.5.jar, file:/C:/Users/s.golovanov/.m2/repository/org/powermock/powermock-module-junit4-common/1.5.5/powermock-module-junit4-common-1.5.5.jar, file:/C:/Users/s.golovanov/.m2/repository/org/powermock/powermock-core/1.5.5/powermock-core-1.5.5.jar, file:/C:/Users/s.golovanov/.m2/repository/org/powermock/powermock-reflect/1.5.5/powermock-reflect-1.5.5.jar, file:/C:/Users/s.golovanov/.m2/repository/org/powermock/powermock-api-mockito/1.5.5/powermock-api-mockito-1.5.5.jar, file:/C:/Users/s.golovanov/.m2/repository/org/mockito/mockito-all/1.9.5/mockito-all-1.9.5.jar, file:/C:/Users/s.golovanov/.m2/repository/org/powermock/powermock-api-support/1.5.5/powermock-api-support-1.5.5.jar, file:/C:/Users/s.golovanov/.m2/repository/com/google/guava/guava/16.0.1/guava-16.0.1.jar, file:/C:/Users/s.golovanov/.m2/repository/commons-validator/commons-validator/1.4.0/commons-validator-1.4.0.jar, file:/C:/Users/s.golovanov/.m2/repository/commons-digester/commons-digester/1.8/commons-digester-1.8.jar, file:/F:/ide/jbdevstudio9_beta2/studio/configuration/org.eclipse.osgi/388/0/.cp/, file:/F:/ide/jbdevstudio9_beta2/studio/configuration/org.eclipse.osgi/387/0/.cp/]
    at edu.umd.cs.findbugs.PluginLoader.getPluginDescriptor(PluginLoader.java:1172)
    at edu.umd.cs.findbugs.PluginLoader.init(PluginLoader.java:653)
    at edu.umd.cs.findbugs.PluginLoader.<init>(PluginLoader.java:400)
    at edu.umd.cs.findbugs.PluginLoader.loadCorePlugin(PluginLoader.java:1471)
    ... 55 more

In the edu.umd.cs.findbugs.PluginLoader.getCoreResource(String) the execution doesn't know findbugs home dir. I don't have the environment variable FINDBUGS_HOME defined, since I rely on findbugs-maven-plugin. The execution finds findbugs.xml with the last attempt:

u = PluginLoader.class.getResource("/"+name);

, but finds the wrong one, in my detector project's target\classes directory.

If I rename/remove findbugs.xml in target\classes then getCoreResource finds the right one in the findbugs-3.0.1.jar.

But then another exception happens:

java.lang.ExceptionInInitializerError
    at edu.umd.cs.findbugs.DetectorFactoryCollection.getCoreResource(DetectorFactoryCollection.java:392)
    at edu.umd.cs.findbugs.SystemProperties.loadPropertiesFromConfigFile(SystemProperties.java:77)
    at edu.umd.cs.findbugs.SystemProperties.<clinit>(SystemProperties.java:60)
    at edu.umd.cs.findbugs.ProjectStats.<clinit>(ProjectStats.java:68)
    at com.youdevise.fbplugins.tdd4fb.TestingBugReporter$CrossVersionTddBugReporter.<init>(TestingBugReporter.java:74)
    at com.youdevise.fbplugins.tdd4fb.TestingBugReporter$CrossVersionTddBugReporter.<init>(TestingBugReporter.java:72)
    at com.youdevise.fbplugins.tdd4fb.TestingBugReporter$BugReporterInvocationHandler.<init>(TestingBugReporter.java:57)
    at com.youdevise.fbplugins.tdd4fb.TestingBugReporter$BugReporterInvocationHandler.<init>(TestingBugReporter.java:56)
    at com.youdevise.fbplugins.tdd4fb.TestingBugReporter.crossVersionBugReporter(TestingBugReporter.java:49)
    at com.youdevise.fbplugins.tdd4fb.TestingBugReporter.tddBugReporter(TestingBugReporter.java:45)
    at com.youdevise.fbplugins.tdd4fb.DetectorRunner$Singleton.<clinit>(DetectorRunner.java:74)
    at com.youdevise.fbplugins.tdd4fb.DetectorRunner.assertInitialised(DetectorRunner.java:268)
    at com.youdevise.fbplugins.tdd4fb.DetectorAssert.bugReporterForTesting(DetectorAssert.java:112)
    at ru.argustelecom.designtimeutils.findbugs.detectors.AbstractDetectorTest.init(AbstractDetectorTest.java:27)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at org.junit.runners.Suite.runChild(Suite.java:127)
    at org.junit.runners.Suite.runChild(Suite.java:26)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at org.junit.runners.Suite.runChild(Suite.java:127)
    at org.junit.runners.Suite.runChild(Suite.java:26)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: java.lang.IllegalStateException: Unable to load core plugin
    at edu.umd.cs.findbugs.PluginLoader.loadCorePlugin(PluginLoader.java:1475)
    at edu.umd.cs.findbugs.PluginLoader.loadInitialPlugins(PluginLoader.java:1425)
    at edu.umd.cs.findbugs.PluginLoader.<clinit>(PluginLoader.java:154)
    ... 53 more
Caused by: edu.umd.cs.findbugs.PluginException: Missing Cloud description for cloud edu.umd.cs.findbugs.cloud.doNothingCloud
    at edu.umd.cs.findbugs.PluginLoader.findMessageNode(PluginLoader.java:1330)
    at edu.umd.cs.findbugs.PluginLoader.loadPluginComponents(PluginLoader.java:686)
    at edu.umd.cs.findbugs.PluginLoader.<init>(PluginLoader.java:401)
    at edu.umd.cs.findbugs.PluginLoader.loadCorePlugin(PluginLoader.java:1471)
    ... 55 more

RuntimeException: Failed to setup FindBugs dependencies for testing caused by FileNotFoundException

If I run

$ mvn test

on

https://github.com/tomfitzhenry/findbugs-guice

in cygwin, several unit tests fail/error with

Caused by: java.lang.RuntimeException: Failed to setup FindBugs dependencies for testing.
at com.youdevise.fbplugins.tdd4fb.DetectorRunner.(DetectorRunner.java:70)
at com.youdevise.fbplugins.tdd4fb.DetectorRunner.(DetectorRunner.java:56)
at com.youdevise.fbplugins.tdd4fb.DetectorRunner$Singleton.(DetectorRunner.java:63)
... 34 more
Caused by: java.io.FileNotFoundException: C:\cygwin\home\xxx\working\findbugs-guice\C (The system cannot find the file specified)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.(ZipFile.java:127)
at java.util.zip.ZipFile.(ZipFile.java:143)
at edu.umd.cs.findbugs.classfile.impl.ZipFileCodeBase.(ZipFileCodeBase.java:53)
at edu.umd.cs.findbugs.classfile.impl.ZipCodeBaseFactory.countUsingZipFile(ZipCodeBaseFactory.java:92)
at edu.umd.cs.findbugs.classfile.impl.ZipCodeBaseFactory.makeZipCodeBase(ZipCodeBaseFactory.java:46)
at edu.umd.cs.findbugs.classfile.impl.ClassFactory.createFilesystemCodeBase(ClassFactory.java:97)
at edu.umd.cs.findbugs.classfile.impl.FilesystemCodeBaseLocator.openCodeBase(FilesystemCodeBaseLocator.java:75)
at com.youdevise.fbplugins.tdd4fb.DetectorRunner.addAuxCodeBasesFromClassPath(DetectorRunner.java:111)
at com.youdevise.fbplugins.tdd4fb.DetectorRunner.setUpStaticDependenciesWithinFindBugs(DetectorRunner.java:92)
at com.youdevise.fbplugins.tdd4fb.DetectorRunner.(DetectorRunner.java:68)
... 36 more

nonFinalFieldInjectionIsNotReported(uk.me.tom_fitzhenry.findbugs.guice.FinalFieldInjectionDetectorTest) Time elapsed: 0 sec <<< ERROR!
java.lang.NoClassDefFoundError: Could not initialize class com.youdevise.fbplugins.tdd4fb.DetectorRunner$Singleton

It appears that FilesystemCodeBaseLocator.openCodeBase is attempting to create an invalid path.

$ mvn -v
Apache Maven 3.0.3 (r1075438; 2011-02-28 11:31:09-0600)
Maven home: C:\cygwin\home\xxx\bin\apache-maven-3.0.3
Java version: 1.6.0_30, vendor: Sun Microsystems Inc.
Java home: C:\jdk1.6.0_30\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows xp", version: "5.1", arch: "x86", family: "windows"

jdk 1.6

FindBugs runs on java 1.5[1]. So I want to build my plugins in 1.5. However, this project is compiled in 1.6, which prevents me building my project using the 1.5 jdk.

[1] - http://findbugs.sourceforge.net/

Using Java 8 lambdas as tested classes

I'm currently using parameterized tests with anonymous inner classes:

@RunWith(Parameterized.class)
public class RulesTest extends AbstractDetectorTest<MyDetector> {

    enum Expectation {
        FAIL, PASS
    };

    private Expectation expectation;
    private Object parameter;

    public RulesTest(int ln, Expectation expectation, Object parameter) {
        this.expectation = expectation;
        this.parameter = parameter;
    }

    // use source line number in test's name to quickly find the failing dataset
    @Parameters(name = "Line {0}")
    @SuppressWarnings({ "unused" })
    public static Collection<Object[]> data() {
        return Arrays.asList(new Object[][] {
            //@formatter:off
            { ln(), PASS, new Object() { void $() { someCodeToCheck(); } } },
            { ln(), PASS, new Object() { void $() { moreCodeToCheck(); } } },
            // ... more parameter sets ...
            //@formatter:on
        });
    }

    @Test
    public void test() throws Exception {
        switch (expectation) {
        case FAIL:
            DetectorAssert.assertBugReported(parameter.getClass(), detector, bugReporter);
            break;
        case PASS:
            DetectorAssert.assertNoBugsReported(parameter.getClass(), detector, bugReporter);
            break;
        default:
            checkState(false);
        }
    }

}

I want to get rid on the verbose new Object() { void $() { } stuff. Let's try using lambdas for this:

interface $ {
    public void method();
}

...
    { ln(), PASS, ($)() -> someCodeToCheck() },

This fails when running the test:

edu.umd.cs.findbugs.classfile.MissingClassException: Resource not found: ru/argustelecom/designtimeutils/findbugs/detectors/RulesTest$$Lambda$1/42121758.class
    at edu.umd.cs.findbugs.classfile.engine.ClassDataAnalysisEngine.analyze(ClassDataAnalysisEngine.java:60)
    at edu.umd.cs.findbugs.classfile.engine.ClassDataAnalysisEngine.analyze(ClassDataAnalysisEngine.java:42)
    at edu.umd.cs.findbugs.classfile.impl.AnalysisCache.getClassAnalysis(AnalysisCache.java:262)
    at edu.umd.cs.findbugs.classfile.engine.bcel.JavaClassAnalysisEngine.analyze(JavaClassAnalysisEngine.java:57)
    at edu.umd.cs.findbugs.classfile.engine.bcel.JavaClassAnalysisEngine.analyze(JavaClassAnalysisEngine.java:42)
    at edu.umd.cs.findbugs.classfile.impl.AnalysisCache.getClassAnalysis(AnalysisCache.java:262)
    at edu.umd.cs.findbugs.classfile.engine.bcel.ClassContextClassAnalysisEngine.analyze(ClassContextClassAnalysisEngine.java:49)
    at edu.umd.cs.findbugs.classfile.engine.bcel.ClassContextClassAnalysisEngine.analyze(ClassContextClassAnalysisEngine.java:37)
    at edu.umd.cs.findbugs.classfile.impl.AnalysisCache.getClassAnalysis(AnalysisCache.java:262)
    at edu.umd.cs.findbugs.DetectorToDetector2Adapter.visitClass(DetectorToDetector2Adapter.java:72)
    at com.youdevise.fbplugins.tdd4fb.DetectorRunner$Singleton.doRunDetectorOnClass(DetectorRunner.java:247)
    at com.youdevise.fbplugins.tdd4fb.DetectorRunner$Singleton.access$000(DetectorRunner.java:70)
    at com.youdevise.fbplugins.tdd4fb.DetectorRunner.runDetectorOnClass(DetectorRunner.java:286)
    at com.youdevise.fbplugins.tdd4fb.DetectorAssert.assertNoBugsReported(DetectorAssert.java:107)
    at com.youdevise.fbplugins.tdd4fb.DetectorAssert.assertNoBugsReported(DetectorAssert.java:98)
    at ru.argustelecom.designtimeutils.findbugs.detectors.RulesTest.test(RulesTest.java:166)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at org.junit.runners.Suite.runChild(Suite.java:127)
    at org.junit.runners.Suite.runChild(Suite.java:26)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at org.junit.runners.Suite.runChild(Suite.java:127)
    at org.junit.runners.Suite.runChild(Suite.java:26)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: edu.umd.cs.findbugs.classfile.ResourceNotFoundException: Resource not found: ru/argustelecom/designtimeutils/findbugs/detectors/RulesTest$$Lambda$1/42121758.class
    at edu.umd.cs.findbugs.classfile.impl.ClassPathImpl.lookupResource(ClassPathImpl.java:164)
    at edu.umd.cs.findbugs.classfile.engine.ClassDataAnalysisEngine.analyze(ClassDataAnalysisEngine.java:53)
    ... 55 more

Is it possible to support lambdas for such usage?

Test "createsFileSystemCodeBaseLocatorForEachJarPathGiven" is failed on Windows

Operation system: Windows 7, test executed in cygwin (gitbash).

Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.07 sec <<< FAILURE!
createsFileSystemCodeBaseLocatorForEachJarPathGiven(com.youdevise.fbplugins.tdd4fb.AuxCodeBaseLocatorProviderTest)  Time elapsed: 0.019 sec  <<< FAILURE!
java.lang.AssertionError: 
Expected: (a collection containing a FileSystemCodeBaseLocator with directory equal to "/some/path/to/myFirstJar.jar" and a collection containing a FileSystemCodeBaseLocator with directory equal to "/some/path/to/mySecondJar.jar" and a collection containing a FileSystemCodeBaseLocator with directory equal to "/some/path/to/myDirectory")
     got: <[filesystem:C:\some\path\to\myFirstJar.jar, filesystem:C:\some\path\to\mySecondJar.jar, filesystem:C:\some\path\to\myDirectory]>

Exception/error messages of DetectorAssert is not informative

DetectorAssert throws exception but the exception error messages are not very clear. Currently, exception errors like native message: false/true. It could help if there are more information, for example: Expected: detector [DetectorX] to report a bug against class [ClassY], but: no bugs were reported.

DetectorAssert usability problem for multiple matchers

When using mulitple matchers with the DetectorAssert's assertAllBugs methods, usability is somewhat low in case of problems.

Currently the assertion routine first checks the count of expected and reported bugs to match, and then the lists are compared in detail.

In general the approach is fine, but the amount of information in case of problems is too low to be helpful.

Example:
I have three expected bugs A, B and C. But the detector only reports two.

Current result:
This leads to the test to correctly fail.
Information however is only that detector reported 2 instead of 3 bugs.

Required result:
Test still needs to fail :)
Information should be given as to what bugs are missing from the expected list, e.g.:

"Expected bugs A,B,C but only got A,C."

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.