forked from checkstyle/checkstyle
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue checkstyle#3238: Java 8 Grammar: annotations on arrays and varargs
- Loading branch information
1 parent
4dab260
commit 3b749ba
Showing
9 changed files
with
514 additions
and
8 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
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
38 changes: 38 additions & 0 deletions
38
src/test/resources/com/puppycrawl/tools/checkstyle/grammar/InputRegressionJava8Class2.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,38 @@ | ||
//start line index in expected file is 2 | ||
package com.puppycrawl.tools.checkstyle.grammar; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
import java.util.ArrayList; | ||
import java.util.Collections; | ||
import java.util.Comparator; | ||
import java.util.Map; | ||
import java.util.List; | ||
import java.util.function.IntBinaryOperator; | ||
import java.util.function.Predicate; | ||
import java.util.function.Supplier; | ||
|
||
public class InputRegressionJava8Class2 { | ||
static class Inner1 { static class Inner2<V> { public void m() {} } } | ||
static class Inner3<T> { public void m() {} } | ||
|
||
public void m1(@MyAnnotation String @MyAnnotation ... vararg) {} | ||
public String m2() @MyAnnotation [] @MyAnnotation [] { return null; } | ||
|
||
public void instructions() { | ||
// annotations | ||
Map.@MyAnnotation Entry e; | ||
String str = (@MyAnnotation String) ""; | ||
(new Inner3()).<@MyAnnotation String>m(); | ||
Object arr = new @MyAnnotation String @MyAnnotation [3]; | ||
for (String a @MyAnnotation [] : m2()) {} | ||
Object arr2 = new @MyAnnotation int[3]; | ||
} | ||
} | ||
|
||
@Retention(RetentionPolicy.CLASS) | ||
@Target({ ElementType.TYPE_USE }) | ||
@interface MyAnnotation { | ||
} |
Oops, something went wrong.