diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2021-09-16 02:07:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-16 02:07:26 +0200 |
commit | d09d995a8ecbd15428eac92150b1d7b55a525d2c (patch) | |
tree | 3b61fab8d931e610ce271735cdbac234cdf94726 /test/pretty/resource/after | |
parent | 14aaf25ede37228f186a7029aa9567353eb539ca (diff) | |
parent | f516dd8ab3186121c4a880444302e2f980f393f8 (diff) | |
download | lombok-d09d995a8ecbd15428eac92150b1d7b55a525d2c.tar.gz lombok-d09d995a8ecbd15428eac92150b1d7b55a525d2c.tar.bz2 lombok-d09d995a8ecbd15428eac92150b1d7b55a525d2c.zip |
Merge pull request #2936 from Rawi01/jdk-17
Add support for JDK17
Diffstat (limited to 'test/pretty/resource/after')
-rw-r--r-- | test/pretty/resource/after/Sealed.java | 16 | ||||
-rw-r--r-- | test/pretty/resource/after/Switch17.java | 31 | ||||
-rw-r--r-- | test/pretty/resource/after/ThisParameter.java | 6 |
3 files changed, 50 insertions, 3 deletions
diff --git a/test/pretty/resource/after/Sealed.java b/test/pretty/resource/after/Sealed.java new file mode 100644 index 00000000..15096034 --- /dev/null +++ b/test/pretty/resource/after/Sealed.java @@ -0,0 +1,16 @@ +public class Sealed { + public abstract sealed class Parent permits Child1, Child2 { + } + + public final class Child1 extends Parent { + } + + public abstract non-sealed class Child2 extends Parent { + } + + public sealed interface SealedInterface permits ChildInterface1 { + } + + public non-sealed interface ChildInterface1 extends SealedInterface { + } +}
\ No newline at end of file diff --git a/test/pretty/resource/after/Switch17.java b/test/pretty/resource/after/Switch17.java new file mode 100644 index 00000000..038f2cd9 --- /dev/null +++ b/test/pretty/resource/after/Switch17.java @@ -0,0 +1,31 @@ +public class Switch17 { + String switchPatternMatching(Object o) { + return switch (o) { + case Integer i -> String.format("int %d", i); + case Long l -> String.format("long %d", l); + case Double d -> String.format("double %f", d); + case String s -> String.format("String %s", s); + default -> o.toString(); + }; + } + + String switchNull(Object o) { + return switch (o) { + case null, default -> "?"; + }; + } + + String switchGuardPattern(Object o) { + return switch (o) { + case String s && s.length() > 1 -> s; + default -> o.toString(); + }; + } + + String switchParenthesizedPattern(Object o) { + return switch (o) { + case (String s) -> s; + default -> o.toString(); + }; + } +}
\ No newline at end of file diff --git a/test/pretty/resource/after/ThisParameter.java b/test/pretty/resource/after/ThisParameter.java index 49452a59..c57916be 100644 --- a/test/pretty/resource/after/ThisParameter.java +++ b/test/pretty/resource/after/ThisParameter.java @@ -16,17 +16,17 @@ class ThisParameter { void runtimeTagged(@RuntimeTagged("runtime") ThisParameter this) { // no content } - @Target(ElementType.PARAMETER) + @Target(ElementType.TYPE_USE) @Retention(RetentionPolicy.SOURCE) @interface SourceTagged { String value(); } - @Target(ElementType.PARAMETER) + @Target(ElementType.TYPE_USE) @Retention(RetentionPolicy.CLASS) @interface ClassTagged { String value(); } - @Target(ElementType.PARAMETER) + @Target(ElementType.TYPE_USE) @Retention(RetentionPolicy.RUNTIME) @interface RuntimeTagged { String value(); |