Skip to content

Commit daff237

Browse files
author
Vincent Potucek
committed
spotless-maven-plugin
1 parent 866102d commit daff237

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

core/src/main/java/com/google/googlejavaformat/java/RemoveUnusedImports.java

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)