@@ -266,23 +266,23 @@ public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOExcept
266266 return unit ;
267267 }
268268
269- /** Construct replacements to fix unused imports. */
270- private static RangeMap <Integer , String > buildReplacements (
271- String contents ,
272- JCCompilationUnit unit ,
273- Set <String > usedNames ,
274- Multimap <String , Range <Integer >> usedInJavadoc ) {
275- RangeMap <Integer , String > replacements = TreeRangeMap .create ();
276- for (JCTree importTree : unit .getImports ()) {
277- String simpleName = getSimpleName (importTree );
278- if (!isUnused (unit , usedNames , usedInJavadoc , importTree , simpleName )) {
279- continue ;
280- }
281- // delete the import
282- int endPosition = importTree .getEndPosition (unit .endPositions );
283- endPosition = max (CharMatcher .isNot (' ' ).indexIn (contents , endPosition ), endPosition );
284- String sep = Newlines .guessLineSeparator (contents );
285- if (endPosition + sep .length () < contents .length ()
269+ /** Construct replacements to fix unused imports. */
270+ private static RangeMap <Integer , String > buildReplacements (
271+ String contents ,
272+ JCCompilationUnit unit ,
273+ Set <String > usedNames ,
274+ Multimap <String , Range <Integer >> usedInJavadoc ) {
275+ RangeMap <Integer , String > replacements = TreeRangeMap .create ();
276+ for (JCTree importTree : unit .getImports ()) {
277+ String simpleName = getSimpleName (importTree );
278+ if (!isUnused (unit , usedNames , usedInJavadoc , importTree , simpleName )) {
279+ continue ;
280+ }
281+ // delete the import
282+ int endPosition = importTree .getEndPosition (unit .endPositions );
283+ endPosition = max (CharMatcher .isNot (' ' ).indexIn (contents , endPosition ), endPosition );
284+ String sep = Newlines .guessLineSeparator (contents );
285+ if (endPosition + sep .length () < contents .length ()
286286 && contents .subSequence (endPosition , endPosition + sep .length ()).toString ().equals (sep )) {
287287 endPosition += sep .length ();
288288 }
0 commit comments