Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix class check order to correctly recognize ignoring annotation (fixes
#25)
- Loading branch information
Showing
5 changed files
with
118 additions
and
3 deletions.
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
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
29 changes: 29 additions & 0 deletions
29
src/test/resources/ru/vyarus/gradle/plugin/animalsniffer/java/ann4inner/Sample.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,29 @@ | ||
package ann; | ||
|
||
import org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement; | ||
|
||
import java.nio.file.Paths; | ||
import java.util.concurrent.Callable; | ||
|
||
@IgnoreJRERequirement | ||
public class Sample { | ||
|
||
public static void main(String[] args) { | ||
// method added in 1.7 | ||
Boolean.compare(true, true); | ||
} | ||
|
||
public String someth() throws Exception { | ||
// this will compile as separate class file and animalsniffer check order would be important | ||
// (enclosed class must be checked first to apply annotataion) | ||
// https://github.com/xvik/gradle-animalsniffer-plugin/issues/25 | ||
return new Callable<String>() { | ||
@Override | ||
public String call() throws Exception { | ||
// class added in 1.7 | ||
Paths.get("/tmp"); | ||
return "ok"; | ||
} | ||
}.call(); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
src/test/resources/ru/vyarus/gradle/plugin/animalsniffer/java/ann4inner/Sample2.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,20 @@ | ||
package ann; | ||
|
||
import org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement; | ||
|
||
import java.nio.file.Paths; | ||
|
||
@IgnoreJRERequirement | ||
public class Sample2 { | ||
|
||
public static void main(String[] args) { | ||
// method added in 1.7 | ||
Boolean.compare(true, true); | ||
} | ||
|
||
public class Inner { | ||
public void someth() { | ||
// class added in 1.7 | ||
} | ||
} | ||
} |