diff --git a/lib/src/main/java/com/diffplug/spotless/java/ImportSorterImpl.java b/lib/src/main/java/com/diffplug/spotless/java/ImportSorterImpl.java index a3fe621e13..4d343d41d8 100644 --- a/lib/src/main/java/com/diffplug/spotless/java/ImportSorterImpl.java +++ b/lib/src/main/java/com/diffplug/spotless/java/ImportSorterImpl.java @@ -347,18 +347,13 @@ private int compareFullyQualifiedClassName(String fqcn1, String fqcn2) { private String[] splitFqcnAndMember(String importString) { String s = importString.substring(STATIC_KEYWORD.length()).trim(); - String fqcn; - String member; - + /* + * Static imports always contain a member or wildcard and it's always the last + * segment. + */ int dot = s.lastIndexOf("."); - if (!Character.isUpperCase(s.charAt(dot + 1))) { - fqcn = s.substring(0, dot); - member = s.substring(dot + 1); - } else { - fqcn = s; - member = null; - } - + String fqcn = s.substring(0, dot); + String member = s.substring(dot + 1); return new String[]{fqcn, member}; } diff --git a/testlib/src/main/resources/java/importsorter/JavaCodeSortedLexicographic.test b/testlib/src/main/resources/java/importsorter/JavaCodeSortedLexicographic.test index 731cbb5878..2b59d52e58 100644 --- a/testlib/src/main/resources/java/importsorter/JavaCodeSortedLexicographic.test +++ b/testlib/src/main/resources/java/importsorter/JavaCodeSortedLexicographic.test @@ -1,3 +1,7 @@ +import static org.mockito.Mockito.RETURNS_DEEP_STUBS; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + import static com.example.Test.*; import static com.example.Test.A_CONST; import static com.example.Test.Nested.B_CONST; diff --git a/testlib/src/main/resources/java/importsorter/JavaCodeSortedSemanticSort.test b/testlib/src/main/resources/java/importsorter/JavaCodeSortedSemanticSort.test index aaab4c1b86..3ab813b227 100644 --- a/testlib/src/main/resources/java/importsorter/JavaCodeSortedSemanticSort.test +++ b/testlib/src/main/resources/java/importsorter/JavaCodeSortedSemanticSort.test @@ -1,7 +1,11 @@ +import static org.mockito.Mockito.RETURNS_DEEP_STUBS; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + import static com.example.Test.*; import static com.example.Test.A_CONST; -import static com.example.Test.Nested.B_CONST; import static com.example.Test.Z_CONST; +import static com.example.Test.Nested.B_CONST; import com.example.Test; import com.example.Test.*; diff --git a/testlib/src/main/resources/java/importsorter/JavaCodeUnsortedSemanticSort.test b/testlib/src/main/resources/java/importsorter/JavaCodeUnsortedSemanticSort.test index 766322936d..7bfcfc6f7a 100644 --- a/testlib/src/main/resources/java/importsorter/JavaCodeUnsortedSemanticSort.test +++ b/testlib/src/main/resources/java/importsorter/JavaCodeUnsortedSemanticSort.test @@ -13,3 +13,7 @@ import com.sun.jna.platform.win32.Guid.CLSID; import com.example.a.A; import com.example.b; import com.example.c.C; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.RETURNS_DEEP_STUBS; +import static org.mockito.Mockito.when;