diff options
Diffstat (limited to 'test/pretty/resource')
-rw-r--r-- | test/pretty/resource/after/MethodReference.java | 36 | ||||
-rw-r--r-- | test/pretty/resource/before/MethodReference.java | 48 |
2 files changed, 84 insertions, 0 deletions
diff --git a/test/pretty/resource/after/MethodReference.java b/test/pretty/resource/after/MethodReference.java new file mode 100644 index 00000000..115b7014 --- /dev/null +++ b/test/pretty/resource/after/MethodReference.java @@ -0,0 +1,36 @@ +class MethodReference { + public MethodReference() { + } + public <T> MethodReference(T in) { + } + public void simpleInstanceReference() { + Runnable r = this::foo; + } + public void simpleConstructorReference() { + Runnable r = MethodReference::new; + } + public void simpleStaticReference() { + Runnable r = MethodReference::staticFoo; + } + public void generifiedStaticReference() { + StringConverter sc = MethodReference::<String>generifiedStaticFoo; + } + public void generifiedConstructorReference() { + FooConverter<MethodReference> fc = MethodReference::<String>new; + } + public void foo() { + } + private static void staticFoo() { + } + public static <T> T generifiedStaticFoo(T foo) { + return foo; + } + @FunctionalInterface + public interface StringConverter { + String hello(String x); + } + @FunctionalInterface + public interface FooConverter<K> { + K hello(String x); + } +}
\ No newline at end of file diff --git a/test/pretty/resource/before/MethodReference.java b/test/pretty/resource/before/MethodReference.java new file mode 100644 index 00000000..c7af9bf3 --- /dev/null +++ b/test/pretty/resource/before/MethodReference.java @@ -0,0 +1,48 @@ +// version 8: +class MethodReference { + public MethodReference() { + } + + public <T> MethodReference(T in) { + } + + public void simpleInstanceReference() { + Runnable r = this::foo; + } + + public void simpleConstructorReference() { + Runnable r = MethodReference::new; + } + + public void simpleStaticReference() { + Runnable r = MethodReference::staticFoo; + } + + public void generifiedStaticReference() { + StringConverter sc = MethodReference::<String>generifiedStaticFoo; + } + + public void generifiedConstructorReference() { + FooConverter<MethodReference> fc = MethodReference::<String>new; + } + + public void foo() { + } + + private static void staticFoo() { + } + + public static <T> T generifiedStaticFoo(T foo) { + return foo; + } + + @FunctionalInterface + public interface StringConverter { + public String hello(String x); + } + + @FunctionalInterface + public interface FooConverter<K> { + public K hello(String x); + } +} |