1+ /* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2+
3+ /*
4+ Part of the Processing project - http://processing.org
5+ Copyright (c) 2012-23 The Processing Foundation
6+
7+ This program is free software; you can redistribute it and/or modify
8+ it under the terms of the GNU General Public License version 2
9+ as published by the Free Software Foundation.
10+
11+ This program is distributed in the hope that it will be useful,
12+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+ GNU General Public License for more details.
15+
16+ You should have received a copy of the GNU General Public License
17+ along with this program; if not, write to the Free Software Foundation, Inc.
18+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19+ */
20+
121package processing .mode .java ;
222
323import java .awt .EventQueue ;
@@ -84,7 +104,7 @@ public void dispose() {
84104
85105
86106 private void handleSketchProblems (PreprocSketch ps ) {
87- Map <String , String []> suggCache =
107+ Map <String , String []> suggestCache =
88108 JavaMode .importSuggestEnabled ? new HashMap <>() : Collections .emptyMap ();
89109
90110 List <IProblem > iproblems ;
@@ -117,7 +137,7 @@ private void handleSketchProblems(PreprocSketch ps) {
117137 if (p != null && JavaMode .importSuggestEnabled && isUndefinedTypeProblem (iproblem )) {
118138 ClassPath cp = searchClassPath .updateAndGet (prev -> prev != null ?
119139 prev : new ClassPathFactory ().createFromPaths (ps .searchClassPathArray ));
120- String [] s = suggCache .computeIfAbsent (iproblem .getArguments ()[0 ],
140+ String [] s = suggestCache .computeIfAbsent (iproblem .getArguments ()[0 ],
121141 name -> getImportSuggestions (cp , name ));
122142 p .setImportSuggestions (s );
123143 }
@@ -243,11 +263,11 @@ static private List<JavaProblem> checkForCurlyQuotes(PreprocSketch ps) {
243263
244264 for (IProblem iproblem : iproblems ) {
245265 switch (iproblem .getID ()) {
246- case IProblem .ParsingErrorDeleteToken :
247- case IProblem .ParsingErrorDeleteTokens :
248- case IProblem .ParsingErrorInvalidToken :
249- case IProblem .ParsingErrorReplaceTokens :
250- case IProblem .UnterminatedString :
266+ case IProblem .ParsingErrorDeleteToken ,
267+ IProblem .ParsingErrorDeleteTokens ,
268+ IProblem .ParsingErrorInvalidToken ,
269+ IProblem .ParsingErrorReplaceTokens ,
270+ IProblem .UnterminatedString -> {
251271 SketchInterval in = ps .mapJavaToSketch (iproblem );
252272 if (in == SketchInterval .BEFORE_START ) continue ;
253273 String badCode = ps .getPdeCode (in );
@@ -271,6 +291,7 @@ static private List<JavaProblem> checkForCurlyQuotes(PreprocSketch ps) {
271291 problems2 .add (p );
272292 }
273293 }
294+ }
274295 }
275296 }
276297 problems .addAll (problems2 );
0 commit comments