2828import org .eclipse .jdt .core .compiler .IProblem ;
2929import org .eclipse .jdt .internal .compiler .problem .DefaultProblem ;
3030
31+ import processing .app .Base ;
32+
3133public class ErrorMessageSimplifier {
3234 /**
3335 * Mapping between ProblemID constant and the constant name. Holds about 650
@@ -85,12 +87,12 @@ public static String getSimplifiedErrorMessage(Problem problem) {
8587 return null ;
8688 IProblem iprob = problem .getIProblem ();
8789 String args [] = iprob .getArguments ();
88- // log("Simplifying message: " + problem.getMessage() + " ID: "
89- // + getIDName(iprob.getID()));
90- // log("Arg count: " + args.length);
91- // for (int i = 0; i < args.length; i++) {
92- // log("Arg " + args[i]);
93- // }
90+ Base . log ("Simplifying message: " + problem .getMessage () + " ID: "
91+ + getIDName (iprob .getID ()));
92+ Base . log ("Arg count: " + args .length );
93+ for (int i = 0 ; i < args .length ; i ++) {
94+ Base . log ("Arg " + args [i ]);
95+ }
9496
9597 String result = null ;
9698
@@ -114,6 +116,9 @@ public static String getSimplifiedErrorMessage(Problem problem) {
114116 if (args [0 ].equals ("AssignmentOperator Expression" )){
115117 result = "Consider adding a \" =\" " ;
116118 }
119+ else if (args [0 ].equalsIgnoreCase (") Statement" )){
120+ result = getErrorMessageForBracket (args [0 ].charAt (0 ));
121+ }
117122 else {
118123 result = "Error on \" " + args [0 ] + "\" " ;
119124 }
@@ -141,7 +146,12 @@ public static String getSimplifiedErrorMessage(Problem problem) {
141146 result = getErrorMessageForBracket (args [1 ].charAt (0 ));
142147 }
143148 else {
144- result = "Error on \" " + args [0 ] + "\" Consider adding a \" " + args [1 ] + "\" " ;
149+ if (args [1 ].equalsIgnoreCase ("Statement" )){ // See #3104
150+ result = "Error on \" " + args [0 ] + "\" , statement expected after this." ;
151+ }
152+ else {
153+ result = "Error on \" " + args [0 ] + "\" Consider adding a \" " + args [1 ] + "\" " ;
154+ }
145155 }
146156 }
147157 break ;
0 commit comments