2020
2121package processing .mode .java ;
2222
23- import java .util .Optional ;
24-
2523import org .eclipse .jdt .core .compiler .IProblem ;
2624
2725import processing .app .Problem ;
@@ -44,9 +42,9 @@ public class JavaProblem implements Problem {
4442 /** Line number (pde code) of the error */
4543 private final int lineNumber ;
4644
47- private Optional < Integer > startOffset ;
45+ private int startOffset ;
4846
49- private Optional < Integer > stopOffset ;
47+ private int stopOffset ;
5048
5149 /**
5250 * If the error is a 'cannot find type' contains the list of suggested imports
@@ -62,8 +60,6 @@ public JavaProblem(String message, int type, int tabIndex, int lineNumber) {
6260 this .type = type ;
6361 this .tabIndex = tabIndex ;
6462 this .lineNumber = lineNumber ;
65- this .startOffset = Optional .empty ();
66- this .stopOffset = Optional .empty ();
6763 }
6864
6965
@@ -87,32 +83,22 @@ static public JavaProblem fromIProblem(IProblem iProblem, int tabIndex,
8783
8884
8985 public void setPDEOffsets (int startOffset , int stopOffset ){
90- this .startOffset = Optional . of ( startOffset ) ;
91- this .stopOffset = Optional . of ( stopOffset ) ;
86+ this .startOffset = startOffset ;
87+ this .stopOffset = stopOffset ;
9288 }
9389
9490
9591 @ Override
96- public Optional < Integer > getTabStartOffset () {
92+ public int getStartOffset () {
9793 return startOffset ;
9894 }
9995
10096
10197 @ Override
102- public Optional < Integer > getTabStopOffset () {
98+ public int getStopOffset () {
10399 return stopOffset ;
104100 }
105101
106- @ Override
107- public Optional <Integer > getLineStartOffset () {
108- return Optional .empty ();
109- }
110-
111- @ Override
112- public Optional <Integer > getLineStopOffset () {
113- return Optional .empty ();
114- }
115-
116102 @ Override
117103 public boolean isError () {
118104 return type == ERROR ;
@@ -163,36 +149,4 @@ public String toString() {
163149 + message ;
164150 }
165151
166- @ Override
167- public int computeTabStartOffset (LineToTabOffsetGetter strategy ) {
168- Optional <Integer > nativeTabStartOffset = getTabStartOffset ();
169- if (nativeTabStartOffset .isPresent ()) {
170- return nativeTabStartOffset .get ();
171- }
172-
173- Optional <Integer > lineStartOffset = getLineStartOffset ();
174- int lineOffset = strategy .get (getLineNumber ());
175- if (lineStartOffset .isPresent ()) {
176- return lineOffset + lineStartOffset .get ();
177- } else {
178- return lineOffset ;
179- }
180- }
181-
182- @ Override
183- public int computeTabStopOffset (LineToTabOffsetGetter strategy ) {
184- Optional <Integer > nativeTabStopOffset = getTabStopOffset ();
185- if (nativeTabStopOffset .isPresent ()) {
186- return nativeTabStopOffset .get ();
187- }
188-
189- Optional <Integer > lineStopOffset = getLineStopOffset ();
190- int lineOffset = strategy .get (getLineNumber ());
191- if (lineStopOffset .isPresent ()) {
192- return lineOffset + lineStopOffset .get ();
193- } else {
194- return lineOffset ;
195- }
196- }
197-
198152}
0 commit comments