diff --git a/java/src/processing/mode/java/JavaEditor.java b/java/src/processing/mode/java/JavaEditor.java index e9de556b3..562efca8a 100644 --- a/java/src/processing/mode/java/JavaEditor.java +++ b/java/src/processing/mode/java/JavaEditor.java @@ -2285,26 +2285,6 @@ public class JavaEditor extends Editor { } - /** - * @return the Problem for the most relevant error or warning on 'line', - * defaulting to the first. - */ - @Override - protected Problem findProblem(int line) { - List l = findProblems(line); - if (l.size() == 0) return null; - Problem worst = l.get(0); - - for (Problem p : l) { - if (p instanceof JavaProblem && ((!(worst instanceof JavaProblem)) || - ((JavaProblem)p).getPriority() > ((JavaProblem)worst).getPriority())) { - worst = p; - } - } - return worst; - } - - /** * Updates the error table in the Error Window. * Overridden to handle the fugly import suggestions text. diff --git a/java/src/processing/mode/java/pdex/JavaProblem.java b/java/src/processing/mode/java/pdex/JavaProblem.java index 597648d31..b8ef76c0a 100644 --- a/java/src/processing/mode/java/pdex/JavaProblem.java +++ b/java/src/processing/mode/java/pdex/JavaProblem.java @@ -20,10 +20,7 @@ along with this program; if not, write to the Free Software Foundation, Inc. package processing.mode.java.pdex; -import java.util.Arrays; - import org.eclipse.jdt.core.compiler.IProblem; -import static org.eclipse.jdt.core.compiler.IProblem.*; import processing.app.Problem; @@ -56,52 +53,6 @@ public class JavaProblem implements Problem { */ private int type; - /** - * Priority: bigger = higher. Currently 7 to 10 for errors, - * 4 for warning. - *

- * The logic of the numbers in the priorityN arrays is that if ECJ wants a - * token got rid of entirely it's most likely the root of the problem. If it - * wants more tokens, that might have been caused by an unterminated string - * or something but it's also likely to be the “real” error. Only if the - * syntax is good are mismatched argument lists and so on of any real - * significance. These rankings are entirely made up so can be changed to - * support any other plausible scenario. - */ - private int priority; - - static private final int[] priority10 = { - ParsingError, - ParsingErrorDeleteToken, - ParsingErrorDeleteTokens, - ParsingErrorInvalidToken, - ParsingErrorMergeTokens, - ParsingErrorMisplacedConstruct, - ParsingErrorNoSuggestion, - ParsingErrorNoSuggestionForTokens, - ParsingErrorOnKeyword, - ParsingErrorOnKeywordNoSuggestion, - ParsingErrorReplaceTokens, - ParsingErrorUnexpectedEOF - }; - static private final int[] priority9 = { - InvalidCharacterConstant, - UnterminatedString - }; - static private final int[] priority8 = { - ParsingErrorInsertToComplete, - ParsingErrorInsertToCompletePhrase, - ParsingErrorInsertToCompleteScope, - ParsingErrorInsertTokenAfter, - ParsingErrorInsertTokenBefore, - }; - // Sorted so I can do a one-line binary search later. - static { - Arrays.sort(priority10); - Arrays.sort(priority9); - Arrays.sort(priority8); - } - /** * If the error is a 'cannot find type' contains the list of suggested imports */ @@ -109,12 +60,11 @@ public class JavaProblem implements Problem { public static final int ERROR = 1, WARNING = 2; - public JavaProblem(String message, int type, int tabIndex, int lineNumber, int priority) { + public JavaProblem(String message, int type, int tabIndex, int lineNumber) { this.message = message; this.type = type; this.tabIndex = tabIndex; this.lineNumber = lineNumber; - this.priority = priority; } /** @@ -127,24 +77,13 @@ public class JavaProblem implements Problem { public static JavaProblem fromIProblem(IProblem iProblem, int tabIndex, int lineNumber, String badCode) { int type = 0; - int priority = 0; - if (iProblem.isError()) { + if(iProblem.isError()) { type = ERROR; - if (Arrays.binarySearch(priority10, iProblem.getID()) >= 0) { - priority = 10; - } else if (Arrays.binarySearch(priority9, iProblem.getID()) >= 0) { - priority = 9; - } else if (Arrays.binarySearch(priority8, iProblem.getID()) >= 0) { - priority = 8; - } else { - priority = 7; - } } else if (iProblem.isWarning()) { type = WARNING; - priority = 4; } String message = ErrorMessageSimplifier.getSimplifiedErrorMessage(iProblem, badCode); - return new JavaProblem(message, type, tabIndex, lineNumber, priority); + return new JavaProblem(message, type, tabIndex, lineNumber); } public void setPDEOffsets(int startOffset, int stopOffset){ @@ -195,10 +134,6 @@ public class JavaProblem implements Problem { importSuggestions = a; } - public int getPriority() { - return priority; - } - @Override public String toString() { return "TAB " + tabIndex + ",LN " + lineNumber + "LN START OFF: " diff --git a/java/src/processing/mode/java/pdex/PDEX.java b/java/src/processing/mode/java/pdex/PDEX.java index aa673afaa..5d37a9d51 100644 --- a/java/src/processing/mode/java/pdex/PDEX.java +++ b/java/src/processing/mode/java/pdex/PDEX.java @@ -1193,7 +1193,7 @@ public class PDEX { int tabLine = ps.tabOffsetToTabLine(tabIndex, tabOffset); String message = Language.interpolate("editor.status.bad_curly_quote", q); - JavaProblem problem = new JavaProblem(message, JavaProblem.ERROR, tabIndex, tabLine, 10); + JavaProblem problem = new JavaProblem(message, JavaProblem.ERROR, tabIndex, tabLine); problem.setPDEOffsets(tabOffset, tabOffset+1); problems.add(problem); @@ -1229,7 +1229,7 @@ public class PDEX { } else { message = Language.interpolate("editor.status.bad_curly_quote", q); } - JavaProblem p = new JavaProblem(message, JavaProblem.ERROR, in.tabIndex, line, 10); + JavaProblem p = new JavaProblem(message, JavaProblem.ERROR, in.tabIndex, line); p.setPDEOffsets(tabStart, tabStop); problems2.add(p); } @@ -1255,7 +1255,7 @@ public class PDEX { new JavaProblem(braceResult[0] < 0 ? Language.interpolate("editor.status.missing.left_curly_bracket") : Language.interpolate("editor.status.missing.right_curly_bracket"), - JavaProblem.ERROR, tabIndex, braceResult[1], 8); + JavaProblem.ERROR, tabIndex, braceResult[1]); problem.setPDEOffsets(braceResult[3], braceResult[3] + 1); problems.add(problem); }