cleaning up warnings

This commit is contained in:
Ben Fry
2021-06-27 21:26:21 -04:00
parent 2925a75234
commit 0f8d418c56
2 changed files with 8 additions and 22 deletions

View File

@@ -52,7 +52,7 @@ public class CompileErrorMessageSimplifier {
private static void prepareConstantsList() {
constantsMap = new TreeMap<>();
Class<DefaultProblem> probClass = DefaultProblem.class;
Field f[] = probClass.getFields();
Field[] f = probClass.getFields();
for (Field field : f) {
if (Modifier.isStatic(field.getModifiers()))
try {
@@ -88,7 +88,7 @@ public class CompileErrorMessageSimplifier {
public static String getSimplifiedErrorMessage(IProblem iprob, String badCode) {
if (iprob == null) return null;
String args[] = iprob.getArguments();
String[] args = iprob.getArguments();
if (DEBUG) {
Messages.log("Simplifying message: " + iprob.getMessage() +
@@ -214,10 +214,6 @@ public class CompileErrorMessageSimplifier {
} else {
result = Language.interpolate("editor.status.wrong_param",
args[1], args[1], removePackagePrefixes(args[2]));
// String method = q(args[1]);
// String methodDef = " \"" + args[1] + "(" + getSimpleName(args[2]) + ")\"";
// result = result.replace("method", method);
// result += methodDef;
}
}
break;
@@ -256,8 +252,6 @@ public class CompileErrorMessageSimplifier {
case IProblem.TypeMismatch:
if (args.length > 1) {
result = Language.interpolate("editor.status.type_mismatch", args[0], args[1]);
// result = result.replace("typeA", q(args[0]));
// result = result.replace("typeB", q(args[1]));
}
break;
@@ -313,17 +307,11 @@ public class CompileErrorMessageSimplifier {
return input;
}
String[] names = PApplet.split(input, ',');
// List<String> names = new ArrayList<String>();
// if (inp.indexOf(',') >= 0) {
// names.addAll(Arrays.asList(inp.split(",")));
// } else {
// names.add(inp);
// }
StringList result = new StringList();
for (String name : names) {
int dot = name.lastIndexOf('.');
if (dot >= 0) {
name = name.substring(dot + 1, name.length());
name = name.substring(dot + 1);
}
result.append(name);
}

View File

@@ -32,15 +32,15 @@ class ErrorChecker {
// Delay delivering error check result after last sketch change #2677
private final static long DELAY_BEFORE_UPDATE = 650;
private ScheduledExecutorService scheduler;
final private ScheduledExecutorService scheduler;
private volatile ScheduledFuture<?> scheduledUiUpdate = null;
private volatile long nextUiUpdate = 0;
private volatile boolean enabled = true;
private volatile boolean enabled;
private final Consumer<PreprocSketch> errorHandlerListener = this::handleSketchProblems;
private JavaEditor editor;
private PreprocService pps;
final private JavaEditor editor;
final private PreprocService pps;
public ErrorChecker(JavaEditor editor, PreprocService pps) {
@@ -85,8 +85,6 @@ class ErrorChecker {
Map<String, String[]> suggCache =
JavaMode.importSuggestEnabled ? new HashMap<>() : Collections.emptyMap();
final List<Problem> problems = new ArrayList<>();
IProblem[] iproblems;
if (ps.compilationUnit == null) {
iproblems = new IProblem[0];
@@ -94,7 +92,7 @@ class ErrorChecker {
iproblems = ps.compilationUnit.getProblems();
}
problems.addAll(ps.otherProblems);
final List<Problem> problems = new ArrayList<>(ps.otherProblems);
if (problems.isEmpty()) { // Check for curly quotes
List<JavaProblem> curlyQuoteProblems = checkForCurlyQuotes(ps);