File tree Expand file tree Collapse file tree
check_api/src/main/java/com/google/errorprone/fixes Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1616
1717package com .google .errorprone .fixes ;
1818
19- import com .sun .tools .javac .tree .EndPosTable ;
2019import com .sun .tools .javac .tree .JCTree ;
2120
2221/** Describes a tree position with adjustments to the start and end indices. */
@@ -39,11 +38,6 @@ public int getPreferredPosition() {
3938 return position .getPreferredPosition ();
4039 }
4140
42- @ Override
43- public int getEndPosition (EndPosTable endPositions ) {
44- return position .getEndPosition (endPositions ) + endPositionAdjustment ;
45- }
46-
4741 @ Override
4842 public int getEndPosition (ErrorProneEndPosTable endPositions ) {
4943 return endPositions .getEndPosition (position ) + endPositionAdjustment ;
Original file line number Diff line number Diff line change 1818
1919import com .sun .source .tree .CompilationUnitTree ;
2020import com .sun .source .tree .Tree ;
21- import com .sun .tools .javac .tree .EndPosTable ;
2221import com .sun .tools .javac .tree .JCTree ;
2322import com .sun .tools .javac .util .JCDiagnostic ;
2423
25- /** A compatibility wrapper around {@link EndPosTable}. */
24+ /** A compatibility wrapper around {@code EndPosTable}. */
2625public interface ErrorProneEndPosTable {
2726
2827 static ErrorProneEndPosTable create (CompilationUnitTree unit ) {
29- EndPosTable endPosTable = ((JCTree .JCCompilationUnit ) unit ).endPositions ;
30- return pos -> pos .getEndPosition (endPosTable );
31- }
32-
33- static ErrorProneEndPosTable create (EndPosTable endPosTable ) {
28+ com .sun .tools .javac .tree .EndPosTable endPosTable =
29+ ((JCTree .JCCompilationUnit ) unit ).endPositions ;
3430 return pos -> pos .getEndPosition (endPosTable );
3531 }
3632
Original file line number Diff line number Diff line change 2121import com .sun .tools .javac .util .JCDiagnostic .DiagnosticPosition ;
2222
2323/** A compatibility wrapper around {@link DiagnosticPosition}. */
24- public interface ErrorPronePosition extends DiagnosticPosition {
24+ public interface ErrorPronePosition {
2525 static ErrorPronePosition from (Tree node ) {
2626 return from ((DiagnosticPosition ) node );
2727 }
@@ -34,13 +34,10 @@ static ErrorPronePosition from(DiagnosticPosition pos) {
3434 return new WrappedDiagnosticPosition (pos );
3535 }
3636
37- @ Override
3837 int getStartPosition ();
3938
40- @ Override
4139 int getPreferredPosition ();
4240
43- @ Override
4441 JCTree getTree ();
4542
4643 int getEndPosition (ErrorProneEndPosTable endPosTable );
Original file line number Diff line number Diff line change 1717package com .google .errorprone .fixes ;
1818
1919import com .google .common .collect .ImmutableSet ;
20- import com .sun .tools .javac .tree .EndPosTable ;
2120import com .sun .tools .javac .tree .JCTree .JCCompilationUnit ;
2221
2322/**
@@ -41,14 +40,6 @@ public interface Fix {
4140
4241 ImmutableSet <Replacement > getReplacements (ErrorProneEndPosTable endPositions );
4342
44- /**
45- * @deprecated use {@link #getReplacements(ErrorProneEndPosTable) instead}
46- */
47- @ Deprecated
48- default ImmutableSet <Replacement > getReplacements (EndPosTable endPositions ) {
49- return getReplacements (ErrorProneEndPosTable .create (endPositions ));
50- }
51-
5243 ImmutableSet <String > getImportsToAdd ();
5344
5445 ImmutableSet <String > getImportsToRemove ();
Original file line number Diff line number Diff line change 1717package com .google .errorprone .fixes ;
1818
1919import com .sun .source .tree .Tree ;
20- import com .sun .tools .javac .tree .EndPosTable ;
2120import com .sun .tools .javac .tree .JCTree ;
2221import com .sun .tools .javac .util .JCDiagnostic .DiagnosticPosition ;
2322
@@ -52,9 +51,4 @@ public int getPreferredPosition() {
5251 public int getEndPosition (ErrorProneEndPosTable endPosTable ) {
5352 return endPosition ;
5453 }
55-
56- @ Override
57- public int getEndPosition (EndPosTable endPosTable ) {
58- return endPosition ;
59- }
6054}
Original file line number Diff line number Diff line change 1818
1919import static com .google .common .base .Preconditions .checkArgument ;
2020
21- import com .sun .tools .javac .tree .EndPosTable ;
2221import com .sun .tools .javac .tree .JCTree ;
2322
2423/** Describes a position that only has a start and end index. */
@@ -48,9 +47,4 @@ public int getPreferredPosition() {
4847 public int getEndPosition (ErrorProneEndPosTable endPosTable ) {
4948 return endPos ;
5049 }
51-
52- @ Override
53- public int getEndPosition (EndPosTable endPosTable ) {
54- return endPos ;
55- }
5650}
Original file line number Diff line number Diff line change 1616
1717package com .google .errorprone .fixes ;
1818
19- import com .sun .tools .javac .tree .EndPosTable ;
2019import com .sun .tools .javac .tree .JCTree ;
2120import com .sun .tools .javac .util .JCDiagnostic .DiagnosticPosition ;
2221
@@ -37,11 +36,6 @@ public JCTree getTree() {
3736 return pos .getTree ();
3837 }
3938
40- @ Override
41- public int getEndPosition (EndPosTable endPosTable ) {
42- return pos .getEndPosition (endPosTable );
43- }
44-
4539 @ Override
4640 public int getEndPosition (ErrorProneEndPosTable endPosTable ) {
4741 return endPosTable .getEndPosition (pos );
You can’t perform that action at this time.
0 commit comments