2020
2121package processing .mode .java .pdex ;
2222
23- import java .util .Arrays ;
24-
2523import org .eclipse .jdt .core .compiler .IProblem ;
26- import static org .eclipse .jdt .core .compiler .IProblem .*;
2724
2825import processing .app .Problem ;
2926
@@ -56,65 +53,18 @@ public class JavaProblem implements Problem {
5653 */
5754 private int type ;
5855
59- /**
60- * Priority: bigger = higher. Currently 7 to 10 for errors,
61- * 4 for warning.
62- * <p>
63- * The logic of the numbers in the priorityN arrays is that if ECJ wants a
64- * token got rid of entirely it's most likely the root of the problem. If it
65- * wants more tokens, that might have been caused by an unterminated string
66- * or something but it's also likely to be the “real” error. Only if the
67- * syntax is good are mismatched argument lists and so on of any real
68- * significance. These rankings are entirely made up so can be changed to
69- * support any other plausible scenario.
70- */
71- private int priority ;
72-
73- static private final int [] priority10 = {
74- ParsingError ,
75- ParsingErrorDeleteToken ,
76- ParsingErrorDeleteTokens ,
77- ParsingErrorInvalidToken ,
78- ParsingErrorMergeTokens ,
79- ParsingErrorMisplacedConstruct ,
80- ParsingErrorNoSuggestion ,
81- ParsingErrorNoSuggestionForTokens ,
82- ParsingErrorOnKeyword ,
83- ParsingErrorOnKeywordNoSuggestion ,
84- ParsingErrorReplaceTokens ,
85- ParsingErrorUnexpectedEOF
86- };
87- static private final int [] priority9 = {
88- InvalidCharacterConstant ,
89- UnterminatedString
90- };
91- static private final int [] priority8 = {
92- ParsingErrorInsertToComplete ,
93- ParsingErrorInsertToCompletePhrase ,
94- ParsingErrorInsertToCompleteScope ,
95- ParsingErrorInsertTokenAfter ,
96- ParsingErrorInsertTokenBefore ,
97- };
98- // Sorted so I can do a one-line binary search later.
99- static {
100- Arrays .sort (priority10 );
101- Arrays .sort (priority9 );
102- Arrays .sort (priority8 );
103- }
104-
10556 /**
10657 * If the error is a 'cannot find type' contains the list of suggested imports
10758 */
10859 private String [] importSuggestions ;
10960
11061 public static final int ERROR = 1 , WARNING = 2 ;
11162
112- public JavaProblem (String message , int type , int tabIndex , int lineNumber , int priority ) {
63+ public JavaProblem (String message , int type , int tabIndex , int lineNumber ) {
11364 this .message = message ;
11465 this .type = type ;
11566 this .tabIndex = tabIndex ;
11667 this .lineNumber = lineNumber ;
117- this .priority = priority ;
11868 }
11969
12070 /**
@@ -127,24 +77,13 @@ public JavaProblem(String message, int type, int tabIndex, int lineNumber, int p
12777 public static JavaProblem fromIProblem (IProblem iProblem ,
12878 int tabIndex , int lineNumber , String badCode ) {
12979 int type = 0 ;
130- int priority = 0 ;
131- if (iProblem .isError ()) {
80+ if (iProblem .isError ()) {
13281 type = ERROR ;
133- if (Arrays .binarySearch (priority10 , iProblem .getID ()) >= 0 ) {
134- priority = 10 ;
135- } else if (Arrays .binarySearch (priority9 , iProblem .getID ()) >= 0 ) {
136- priority = 9 ;
137- } else if (Arrays .binarySearch (priority8 , iProblem .getID ()) >= 0 ) {
138- priority = 8 ;
139- } else {
140- priority = 7 ;
141- }
14282 } else if (iProblem .isWarning ()) {
14383 type = WARNING ;
144- priority = 4 ;
14584 }
14685 String message = ErrorMessageSimplifier .getSimplifiedErrorMessage (iProblem , badCode );
147- return new JavaProblem (message , type , tabIndex , lineNumber , priority );
86+ return new JavaProblem (message , type , tabIndex , lineNumber );
14887 }
14988
15089 public void setPDEOffsets (int startOffset , int stopOffset ){
@@ -195,10 +134,6 @@ public void setImportSuggestions(String[] a) {
195134 importSuggestions = a ;
196135 }
197136
198- public int getPriority () {
199- return priority ;
200- }
201-
202137 @ Override
203138 public String toString () {
204139 return "TAB " + tabIndex + ",LN " + lineNumber + "LN START OFF: "
0 commit comments