diff options
author | Alexander Kriegisch <Alexander@Kriegisch.name> | 2021-03-17 13:51:59 +0700 |
---|---|---|
committer | Alexander Kriegisch <Alexander@Kriegisch.name> | 2021-03-17 14:49:20 +0700 |
commit | 173855359653486178e7e0a7d7b8918615e6deee (patch) | |
tree | b8cd77d5b460ebb400effa15cbb9748803abec73 /tests/features196/java14/Jep305.java | |
parent | 798ee65035142594c43c8c154baaafd557d5d11e (diff) | |
download | aspectj-173855359653486178e7e0a7d7b8918615e6deee.tar.gz aspectj-173855359653486178e7e0a7d7b8918615e6deee.zip |
Restructure Java 14 / AJ 1.9.6 tests
- Java 14 feature sample classes moved from 'bugs' to 'features'
- One test case using a Java 14 preview feature was moved to the
Java 14-only tests
Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
Diffstat (limited to 'tests/features196/java14/Jep305.java')
-rw-r--r-- | tests/features196/java14/Jep305.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/features196/java14/Jep305.java b/tests/features196/java14/Jep305.java new file mode 100644 index 000000000..3c526aef3 --- /dev/null +++ b/tests/features196/java14/Jep305.java @@ -0,0 +1,22 @@ +class Orange { + public String name1 = "orange"; +} + +class Apple { + public String name2 = "apple"; +} + +public class Jep305 { + public static void main(String []argv) { + print(new Orange()); + print(new Apple()); + } + + public static void print(Object obj) { + if (obj instanceof Orange o) { + System.out.println(o.name1); + } else if (obj instanceof Apple a) { + System.out.println(a.name2); + } + } +} |