pmd-java: external sample code of JDKVersionTest

This commit is contained in:
Andreas Dangel
2016-12-02 10:21:50 +01:00
parent 0ebcac0705
commit c2349d4cfb
38 changed files with 291 additions and 197 deletions

View File

@ -0,0 +1,5 @@
public class Foo {
void bar() {
@SuppressWarnings("foo") int y = 5;
}
}

View File

@ -0,0 +1,3 @@
public class Foo {
void bar(@SuppressWarnings("foo") int x) {}
}

View File

@ -0,0 +1,3 @@
@Target(ElementType.METHOD)
public @interface Foo {
}

View File

@ -0,0 +1,5 @@
public class Foo {
void bar() {
assert x == 2;
}
}

View File

@ -0,0 +1,5 @@
public class Foo {
void bar() {
assert (x == 2);
}
}

View File

@ -0,0 +1,5 @@
public class Foo {
void bar() {
assert (x==2) : "hi!";
}
}

View File

@ -0,0 +1,5 @@
public class Foo {
void bar() {
assert (x==2) : "hi!";
}
}

View File

@ -0,0 +1,3 @@
public class Foo {
int assert = 2;
}

View File

@ -0,0 +1,3 @@
public class Foo {
void bar() { assert(); }
}

View File

@ -0,0 +1,5 @@
public class Foo {
void foo() {
assert (x == 2) : "hi!";
}
}

View File

@ -0,0 +1,3 @@
public class Foo {
void assert() {}
}

View File

@ -0,0 +1,3 @@
public @interface Foo {
String CONST = "foo";
}

View File

@ -0,0 +1,3 @@
public class Test {
private Foo bar;
}

View File

@ -0,0 +1,3 @@
public class Foo {
public <T extends E> Foo() {}
}

View File

@ -0,0 +1,5 @@
public class Foo {
public <A extends Annotation> A foo(Class<A> c) {
return null;
}
}

View File

@ -0,0 +1,3 @@
public class Foo {
Class<Double> foo = (Class<Double>)clazz;
}

View File

@ -0,0 +1,5 @@
public class Test {
List<String> test() {
return Collections.<String>emptyList();
}
}

View File

@ -0,0 +1,5 @@
public class Test {
public static <String> String test(String x) {
return x;
}
}

View File

@ -0,0 +1,3 @@
public class Test {
int y = x > 32;
}

View File

@ -0,0 +1,6 @@
public class Test {
void bar() {
final class Inner {};
Inner i = new Inner();
}
}

View File

@ -0,0 +1,6 @@
public class Test {
void bar() {
class Inner {};
Inner i = new Inner();
}
}

View File

@ -0,0 +1,3 @@
public class Test {
int enum;
}

View File

@ -0,0 +1,3 @@
public class Test {
enum Season { winter, spring, summer, fall };
}

View File

@ -0,0 +1,5 @@
public class Test {
void foo(List list) {
for (Integer i : list) {}
}
}

View File

@ -0,0 +1,5 @@
public class Test {
void foo(List list) {
for (final Integer i : list) {}
}
}

View File

@ -0,0 +1,3 @@
public class Test {
ArrayList<Integer> list = new ArrayList<Integer>();
}

View File

@ -0,0 +1,3 @@
public class Test {
void bar(Object ... args) {}
}

View File

@ -0,0 +1,3 @@
public class InputJava7Diamond {
HashMap<String> map = new HashMap<>();
}

View File

@ -0,0 +1,6 @@
public class InputJava7Multicatch {
public static void main() {
try { }
catch (FileNotFoundException | CustomException e) { }
}
}

Some files were not shown because too many files have changed in this diff Show More