minor formatting changes

This commit is contained in:
Ben Fry
2023-01-15 20:38:53 -05:00
parent 1fedfb2109
commit efdbb0222b
2 changed files with 29 additions and 8 deletions
@@ -1,3 +1,23 @@
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
Part of the Processing project - http://processing.org
Copyright (c) 2012-23 The Processing Foundation
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package processing.mode.java;
import java.awt.EventQueue;
@@ -84,7 +104,7 @@ public class ErrorChecker {
private void handleSketchProblems(PreprocSketch ps) {
Map<String, String[]> suggCache =
Map<String, String[]> suggestCache =
JavaMode.importSuggestEnabled ? new HashMap<>() : Collections.emptyMap();
List<IProblem> iproblems;
@@ -117,7 +137,7 @@ public class ErrorChecker {
if (p != null && JavaMode.importSuggestEnabled && isUndefinedTypeProblem(iproblem)) {
ClassPath cp = searchClassPath.updateAndGet(prev -> prev != null ?
prev : new ClassPathFactory().createFromPaths(ps.searchClassPathArray));
String[] s = suggCache.computeIfAbsent(iproblem.getArguments()[0],
String[] s = suggestCache.computeIfAbsent(iproblem.getArguments()[0],
name -> getImportSuggestions(cp, name));
p.setImportSuggestions(s);
}
@@ -243,11 +263,11 @@ public class ErrorChecker {
for (IProblem iproblem : iproblems) {
switch (iproblem.getID()) {
case IProblem.ParsingErrorDeleteToken:
case IProblem.ParsingErrorDeleteTokens:
case IProblem.ParsingErrorInvalidToken:
case IProblem.ParsingErrorReplaceTokens:
case IProblem.UnterminatedString:
case IProblem.ParsingErrorDeleteToken,
IProblem.ParsingErrorDeleteTokens,
IProblem.ParsingErrorInvalidToken,
IProblem.ParsingErrorReplaceTokens,
IProblem.UnterminatedString -> {
SketchInterval in = ps.mapJavaToSketch(iproblem);
if (in == SketchInterval.BEFORE_START) continue;
String badCode = ps.getPdeCode(in);
@@ -271,6 +291,7 @@ public class ErrorChecker {
problems2.add(p);
}
}
}
}
}
problems.addAll(problems2);
@@ -2,7 +2,7 @@
/*
Part of the Processing project - http://processing.org
Copyright (c) 2012-19 The Processing Foundation
Copyright (c) 2012-23 The Processing Foundation
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2