Skip to content

Upgrade to FindBugs 3 #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ jdk:
- openjdk7
env:
matrix:
- FB_VERSION=1
- FB_VERSION=2
- FB_VERSION=3
script: "mvn clean install -P build-with-findbugs-v${FB_VERSION}"

20 changes: 7 additions & 13 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,15 @@
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<findbugs.version>[1.3.9, 2.0.2]</findbugs.version>
</properties>
</profile>
<profile>
<id>build-with-findbugs-v1</id>
<properties>
<findbugs.version>1.3.9</findbugs.version>
</properties>
</profile>
<profile>
<id>build-with-findbugs-v2</id>
<properties>
<findbugs.version>2.0.2</findbugs.version>
<findbugs.version>[3.0.0,4.0.0)</findbugs.version>
</properties>
</profile>
<profile>
<id>build-with-findbugs-v3</id>
<properties>
<findbugs.version>3.0.1</findbugs.version>
</properties>
</profile>
</profiles>
<build>
<plugins>
Expand Down
21 changes: 17 additions & 4 deletions src/main/java/com/youdevise/fbplugins/tdd4fb/DetectorRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
import edu.umd.cs.findbugs.DetectorToDetector2Adapter;
import edu.umd.cs.findbugs.NoOpFindBugsProgress;
import edu.umd.cs.findbugs.Priorities;
import edu.umd.cs.findbugs.ba.AnalysisCacheToAnalysisContextAdapter;
import edu.umd.cs.findbugs.Project;
import edu.umd.cs.findbugs.ba.AnalysisContext;
import edu.umd.cs.findbugs.ba.FieldSummary;
import edu.umd.cs.findbugs.ba.XClass;
Expand Down Expand Up @@ -73,7 +73,7 @@ private static class Singleton {
static final AuxCodeBaseLocatorProvider AUX_CODEBASE_LOCATOR_PROVIDER = new AuxCodeBaseLocatorProvider();
static final BugReporter STATIC_BUG_REPORTER = TestingBugReporter.tddBugReporter();
static final InitialisationResult INITIALISATION_RESULT = attemptSetup();


private static InitialisationResult attemptSetup() {
try {
Expand All @@ -83,7 +83,18 @@ private static InitialisationResult attemptSetup() {
return new InitialisationResult(e);
}
}


/**
* Build a project instance.
*
* TODO: Any further initialization?
*
* @return A project instance.
*/
private static Project buildProject() {
return new Project();
}

private static void setUpStaticDependenciesWithinFindBugs(BugReporter bugReporter) throws Exception {
bugReporter.setPriorityThreshold(Priorities.LOW_PRIORITY);
ClassPathImpl classPath = new ClassPathImpl();
Expand Down Expand Up @@ -112,7 +123,9 @@ private static void setUpStaticDependenciesWithinFindBugs(BugReporter bugReporte
builder.build(classPath, progress);
List<ClassDescriptor> appClassList = builder.getAppClassList();

AnalysisCacheToAnalysisContextAdapter analysisContext = new AnalysisCacheToAnalysisContextAdapter();
Project project = buildProject();

AnalysisContext analysisContext = new AnalysisContext(project);
AnalysisContext.setCurrentAnalysisContext(analysisContext);
analysisContext.setAppClassList(appClassList);
analysisContext.setFieldSummary(new FieldSummary());
Expand Down