10000 fix dodgy commit · Arthurm1/scip-java@1df5ede · GitHub
[go: up one dir, main page]

Skip to content

Commit 1df5ede

Browse files
committed
fix dodgy commit
1 parent 2e6cabc commit 1df5ede

File tree

2 files changed

+42
-39
lines changed

2 files changed

+42
-39
lines changed

semanticdb-javac/src/main/java/com/sourcegraph/semanticdb_javac/SemanticdbReporter.java

Lines changed: 41 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -12,44 +12,47 @@
1212
/**
1313
* Utilities to report error messages.
1414
*
15-
* <p>
16-
* NOTE(olafur): this class exists because I couldn't find compiler APIs to
17-
* report diagnostics. This class can be removed if the Java compiler has APIs
18-
* to report info/warning/error messages.
15+
* <p>NOTE(olafur): this class exists because I couldn't find compiler APIs to report diagnostics.
16+
* This class can be removed if the Java compiler has APIs to report info/warning/error messages.
1917
*/
2018
public class SemanticdbReporter {
21-
private final Trees trees;
22-
23-
public SemanticdbReporter(Trees trees) {
24-
this.trees = trees;
25-
}
26-
27-
public void exception(Throwable e, Tree tree, CompilationUnitTree root) {
28-
ByteArrayOutputStream baos = new ByteArrayOutputStream();
29-
PrintWriter writer = new PrintWriter(baos);
30-
e.printStackTrace(writer);
31-
writer.println(
32-
"Please report a bug to https://github.com/sourcegraph/semanticdb-java with the stack trace above.");
33-
trees.printMessage(Diagnostic.Kind.ERROR, baos.toString(), tree, root);
34-
}
35-
36-
private void info(String message, TaskEvent e) {
37-
trees.printMessage(Diagnostic.Kind.NOTE, "semanticdb-javac: " + message, e.getCompilationUnit(),
38-
e.getCompilationUnit());
39-
}
40-
41-
public void error(String message, TaskEvent e) {
42-
trees.printMessage(Diagnostic.Kind.ERROR, "semanticdb-javac: " + message, e.getCompilationUnit(),
43-
e.getCompilationUnit());
44-
}
45-
46-
}
47-
48-
public void error(String message, Tree tree, CompilationUnitTree root) {
49-
// NOTE(olafur): ideally, this message should be reported as a compiler
50-
// diagnostic, but I dind't
51-
// find
52-
// the reporter API so the message goes to stderr instead for now.
53-
trees.printMessage(Diagnostic.Kind.ERROR, String.format("semanticdb-javac: %s", message), tree, root);
54-
}
19+
private final Trees trees;
20+
21+
public SemanticdbReporter(Trees trees) {
22+
this.trees = trees;
23+
}
24+
25+
public void exception(Throwable e, Tree tree, CompilationUnitTree root) {
26+
ByteArrayOutputStream baos = new ByteArrayOutputStream();
27+
PrintWriter writer = new PrintWriter(baos);
28+
e.printStackTrace(writer);
29+
writer.println(
30+
"Please report a bug to https://github.com/sourcegraph/semanticdb-java with the stack trace above.");
31+
trees.printMessage(Diagnostic.Kind.ERROR, baos.toString(), tree, root);
32+
}
33+
34+
public void info(String message, TaskEvent e) {
35+
trees.printMessage(
36+
Diagnostic.Kind.NOTE,
37+
"semanticdb-javac: " + message,
38+
e.getCompilationUnit(),
39+
e.getCompilationUnit());
40+
}
41+
42+
public void error(String message, TaskEvent e) {
43+
trees.printMessage(
44+
Diagnostic.Kind.ERROR,
45+
"semanticdb-javac: " + message,
46+
e.getCompilationUnit(),
47+
e.getCompilationUnit());
48+
}
49+
50+
public void error(String message, Tree tree, CompilationUnitTree root) {
51+
// NOTE(olafur): ideally, this message should be reported as a compiler
52+
// diagnostic, but I dind't
53+
// find
54+
// the reporter API so the message goes to stderr instead for now.
55+
trees.printMessage(
56+
Diagnostic.Kind.ERROR, String.format("semanticdb-javac: %s", message), tree, root);
57+
}
5558
}

semanticdb-javac/src/main/java/com/sourcegraph/semanticdb_javac/SemanticdbTaskListener.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ private void onFinishedAnalyze(TaskEvent e) {
8585
.buildTextDocument(e.getCompilationUnit());
8686
writeSemanticdb(e, path.getOrThrow(), textDocument);
8787
} else {
88-
reporter.error(path.getErrorOrThrow(), e)
88+
reporter.error(path.getErrorOrThrow(), e);
8989
}
9090
}
9191
}

0 commit comments

Comments
 (0)
0