-
-
Notifications
You must be signed in to change notification settings - Fork 357
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Fix sniper-printing of method imports (#3744)
- Loading branch information
Showing
5 changed files
with
107 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/test/resources/methodimport/ClassWithStaticMethod.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package methodimport; | ||
|
||
public class ClassWithStaticMethod { | ||
public static void main(String[] args) { | ||
} | ||
|
||
public static void staticMethod() { | ||
System.out.println(42); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/test/resources/methodimport/MethodImportAboveImportedMethod.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package methodimport; | ||
import static methodimport.ClassWithStaticMethod.staticMethod; | ||
|
||
/** | ||
* This compilation unit has a method import of the method staticMethod, and the import has a | ||
* lesser source position than the definition of staticMethod has in its respective file. | ||
*/ | ||
public class MethodImportAboveImportedMethod { | ||
public static void main(String[] args) { | ||
staticMethod(); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/test/resources/methodimport/MethodImportBelowImportedMethod.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package methodimport; | ||
|
||
import java.io.File; | ||
import java.util.ArrayList; | ||
import java.util.HashSet; | ||
import java.util.Collections; | ||
import java.util.Set; | ||
|
||
import static methodimport.ClassWithStaticMethod.staticMethod; | ||
|
||
/** | ||
* This compilation unit has a method import of the method staticMethod, and the import has a | ||
* greater source position than the definition of staticMethod has in its respective file. | ||
*/ | ||
public class MethodImportBelowImportedMethod { | ||
public static void main(String[] args) { | ||
staticMethod(); | ||
} | ||
} |