fix: Non-error diagnostics causing recompile failures
@@ -31,12 +31,17 @@ public class JavaErrorHandling extends ErrorHandling
// Update javac problems
@Override
public void report(Diagnostic<? extends VirtualJavaFileObject> diagnostic) {
+ // Skip non-errors
+ if (diagnostic.getKind() != Diagnostic.Kind.ERROR)
+ return;
// Convert the diagnostic to location data
// 0-index the line number
int line = (int) diagnostic.getLineNumber() - 1;
int column = (int) diagnostic.getColumnNumber();
int literalStart = calculate(Position.pos(line + 1, column));
- int wordLength = codeArea.getText().substring(literalStart).split("[^\\w.]")[0].length();
+ // TODO: Properly fix this not fetching the correct section of text in weird cases
+ String[] split = codeArea.getText().substring(literalStart).split("[^\\w.]+");
+ int wordLength = split.length == 0 ? 1 : split[0].length();
int to = column + wordLength;
String msg = diagnostic.getMessage(Locale.ENGLISH);
Diagnostic.Kind kind = diagnostic.getKind();
