Skip to content

Commit

Permalink
Continue when RefasterRuleBuilderScanner throws (#904)
Browse files Browse the repository at this point in the history
Continue when RefasterRuleBuilderScanner throws
  • Loading branch information
carterkozak authored and bulldozer-bot[bot] committed Sep 30, 2019
1 parent 6ab7504 commit 92cd655
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions baseline-refaster-javac-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apply from: "${rootDir}/gradle/publish-jar.gradle"

dependencies {
compile 'com.google.errorprone:error_prone_refaster'
compile 'org.slf4j:slf4j-api'

annotationProcessor 'com.google.auto.service:auto-service'
compileOnly 'com.google.auto.service:auto-service'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* TaskListener that receives compilation of a Refaster rule class and outputs a combined serialized analyzer
Expand All @@ -41,6 +43,7 @@
*/
public final class BaselineRefasterCompilerAnalyzer implements TaskListener {

private static final Logger log = LoggerFactory.getLogger(BaselineRefasterCompilerAnalyzer.class);
private final Context context;
private final Path destinationPath;

Expand Down Expand Up @@ -72,7 +75,11 @@ public void finished(TaskEvent taskEvent) {
new TreeScanner<Void, Context>() {
@Override
public Void visitClass(ClassTree node, Context classContext) {
rules.addAll(RefasterRuleBuilderScanner.extractRules(node, classContext));
try {
rules.addAll(RefasterRuleBuilderScanner.extractRules(node, classContext));
} catch (RuntimeException | Error e) {
log.warn("Failed to extract rules", e);
}
return super.visitClass(node, classContext);
}
}.scan(tree, context);
Expand Down
5 changes: 5 additions & 0 deletions changelog/@unreleased/pr-904.v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
type: fix
fix:
description: Continue when RefasterRuleBuilderScanner throws
links:
- https://github.com/palantir/gradle-baseline/pull/904

0 comments on commit 92cd655

Please sign in to comment.