Comments (4)
Ack :)
Will take a look, no ETA at the moment though.
from test-driven-detectors4findbugs.
Hi @GrimmiMeloni I've taken a stab at surgically removing the necessary parts of FindBugs2.analyzeApplication. I have written a test which has a detector using XFactory to create a method. I did observe this being returned as an UnresolvedMethod, then change to MethodInfo once I made the appropriate interning calls.
Could you build a jar from HEAD to test?
I couldn't reproduce the problem with accessing super/subtypes. That's probably because I am less familiar with how to use XFactory in this way -- it's not what I tend to in custom detectors. There's a test case here: https://github.com/youdevise/test-driven-detectors4findbugs/blob/master/src/test/java/com/youdevise/fbplugins/tdd4fb/DetectorRunnerTest.java#L97 . Would you be able to tell me what I'm doing wrong, or any cases that I should cover? If you could share some of your example uses of XClass that would also be really handy.
from test-driven-detectors4findbugs.
Hi @Grundlefleck !
I pulled your change. It solves the problem for the class under test, as well as it's supertypes.
The problem that still remains, is that all classes touched by the one under test are not interned into the factory.
I have pushed an additional test into my fork. The commit is:
GrimmiMeloni@c6398cb#diff-a8816d1f4768a47ae5230a0defa5839cR120
I think what we are really lacking here, is the possibility to add more classes to the classpath. Right now, when we use the DetectorAssert, the call includes only the Class under test itself. This is contrary to the way the classpath is setup when findbugs is executed "for real", because I there I can provide a whole set of classes.
Basically the situation we now have, is the one that findbugs typically reports as "missing classfiles".
I could imagine several solutions.
Maybe it is already sufficient to setup the Aux-Classpath. I am not sure if this is already possible with the test harness? (cough documentation cough :) )
If that is not working (or possible), than the other option could be to add a possibility to add more than just the class under test to the classpath, maybe in form of a Collection of classes.
Third option could be to automatically resolve all classes referenced by the class under test. I am not sure if this is feasable though.
from test-driven-detectors4findbugs.
The way I intended it to be setup was that you ran your unit test with a classpath that contained all the classes you referenced. It gets all the files to analyse by looking up the java.class.path SystemProperty. So it's not intended just to put the class under test onto the classpath, if you run unit tests under Maven/Eclipse/etc, you should have your entire project and it's dependencies on the classpath. There may be a mistake in how that's achieved, or I may be misremembering, but that was the goal anyway -- you just pass your class under test to DetectorAssert, and it should Just Work.
Maybe it is already sufficient to setup the Aux-Classpath. I am not sure if this is already possible with the test harness? (cough documentation cough :) )
No, that's not available, I wanted to shield users from having to worry about it. Not adverse to allowing extra config where necessary, just want to get as close as possible to working out-of-the-box, so that option is open.
I'm not sure why it's not currently working. You can see the aux code base paths being added from the current classpath in this code. Maybe there is a mismatch between the classes added to the aux code base paths, and those that are used for interning. Thanks for the test case, will have a look :)
from test-driven-detectors4findbugs.
Related Issues (17)
- Make available from Maven Central HOT 3
- Possibly incorrect license listed HOT 1
- RuntimeException: Failed to setup FindBugs dependencies for testing caused by FileNotFoundException HOT 6
- jdk 1.6 HOT 1
- java.lang.ExceptionInitializerError will thrown many times HOT 3
- Support Detector2 interface HOT 3
- findbugs 2.x HOT 7
- NullPointerException when initializing a BugAccumulator in the detector's constructor HOT 6
- Test "createsFileSystemCodeBaseLocatorForEachJarPathGiven" is failed on Windows HOT 5
- Exception/error messages of DetectorAssert is not informative HOT 1
- BugMatcher not propagated by Detector --> Detector2 delegation method HOT 2
- DetectorAssert usability problem for multiple matchers HOT 1
- DetectorAssert.addRegistrar(...) has no effect HOT 3
- Compatibility with Findbugs 3 HOT 3
- PluginDoesntContainMetadataException because the wrong findbugs.xml is found when looking for the core plugin HOT 3
- Using Java 8 lambdas as tested classes
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from test-driven-detectors4findbugs.