diff options
Diffstat (limited to 'test/pretty/resource/before')
-rw-r--r-- | test/pretty/resource/before/Cast.java | 2 | ||||
-rw-r--r-- | test/pretty/resource/before/ExoticJava.java | 46 | ||||
-rw-r--r-- | test/pretty/resource/before/ForLoop.java | 7 | ||||
-rw-r--r-- | test/pretty/resource/before/Lambda.java | 18 | ||||
-rw-r--r-- | test/pretty/resource/before/TypeAnnotations.java | 23 |
5 files changed, 94 insertions, 2 deletions
diff --git a/test/pretty/resource/before/Cast.java b/test/pretty/resource/before/Cast.java index 95237b0f..e32150c3 100644 --- a/test/pretty/resource/before/Cast.java +++ b/test/pretty/resource/before/Cast.java @@ -1,6 +1,6 @@ import java.util.*; public class Cast { public void test(List<?> list) { - RandomAccess r = (/*before*/ RandomAccess /*after*/)list; + RandomAccess r = (/*before*/ RandomAccess /*after*/) list; } }
\ No newline at end of file diff --git a/test/pretty/resource/before/ExoticJava.java b/test/pretty/resource/before/ExoticJava.java new file mode 100644 index 00000000..a0e27c79 --- /dev/null +++ b/test/pretty/resource/before/ExoticJava.java @@ -0,0 +1,46 @@ +//VERSION 7: +import static java.lang.String.*; + +import java.io.*; + +class ExoticJava<V> { + public <T> ExoticJava(T genericsInConstructor, V genericsInType) { + System.out.println(new <String>ExoticJava<Integer>("Hello", 5)); + } + ;;;; + public void test() { + int x = 5, y[] = {10}; + ; + class MethodLocal implements Serializable, java.util.RandomAccess { + @SuppressWarnings({"unchecked", "rawtypes"}) + strictfp public final int foo() { + int x = super.hashCode(); + x <<= 5; + do { + x <<= 5; + } while (Boolean.FALSE); + return x; + } + } + + for (int i = 10, j[] = {20}; i < 5; i++, j[0]++) { + String z = ""; + try (PrintWriter pw = new PrintWriter(System.out); PrintWriter p2 = new PrintWriter(System.out)) { + pw.println(); + } finally { + synchronized (z) { + System.out.println(z); + } + } + + if ((y == null)) {} + if (((y == null))) ; + {;} + java.util.List<String> list = new java.util.ArrayList<>(); + assert Boolean.TRUE : "That's weird"; + double d = -1.8e12; + long loooong = 0x1234ABCD; + int octal = 0127; + } + } +}
\ No newline at end of file diff --git a/test/pretty/resource/before/ForLoop.java b/test/pretty/resource/before/ForLoop.java index 2bed7f9b..8a58cbf2 100644 --- a/test/pretty/resource/before/ForLoop.java +++ b/test/pretty/resource/before/ForLoop.java @@ -9,4 +9,11 @@ public class ForLoop { } // after loop } + + { + int i; + for (i = 0; i < 10; i++) { + System.out.println(i); + } + } } diff --git a/test/pretty/resource/before/Lambda.java b/test/pretty/resource/before/Lambda.java index e7784df5..b9f8c719 100644 --- a/test/pretty/resource/before/Lambda.java +++ b/test/pretty/resource/before/Lambda.java @@ -5,4 +5,20 @@ public class Lambda { java.util.Comparator<Integer> c2 = (Integer a, Integer b) -> { return a - b; }; -}
\ No newline at end of file + java.util.function.Function<String, String> fnc = (String c) -> c; + + void testLambdaInArgsList(String name, java.util.function.Function<String, String> f) { + + } + + void testLambdaInArgsList2(java.util.function.Function<String, String> f, String name) { + + } + + void test() { + testLambdaInArgsList("hello", (String c) -> c); + testLambdaInArgsList("hello", c -> c); + testLambdaInArgsList2((String c) -> c, "hello"); + testLambdaInArgsList2(c -> c, "hello"); + } +} diff --git a/test/pretty/resource/before/TypeAnnotations.java b/test/pretty/resource/before/TypeAnnotations.java new file mode 100644 index 00000000..a39337da --- /dev/null +++ b/test/pretty/resource/before/TypeAnnotations.java @@ -0,0 +1,23 @@ +// version 8: +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; +import java.util.List; +import java.util.Map; + +public class TypeAnnotations { + @Target({ElementType.TYPE_USE, ElementType.LOCAL_VARIABLE}) + @interface Foo {} + + @Target(ElementType.TYPE_USE) + @interface Bar {} + + public List<@Foo String> test(@Foo String param) { + @Bar String local = "bar"; + @Foo java.io.@Foo File[] array = {}; + return new java.util.@Foo ArrayList<java.lang.@Foo String>(); + } + + public <@Foo T extends java.lang.@Foo Number> T test2(@Bar String... varargs) { + return null; + } +} |