+++ /dev/null
-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);
- }
- }
-}
+++ /dev/null
-public record Person(String firstName, String lastName, int age) {}
-
+++ /dev/null
-public aspect TraceRecordComponents {
- before(): execution(public * *()) {
- System.out.println(thisJoinPointStaticPart);
- }
-}
+++ /dev/null
-public class UsingPersonRecord {
- public static void main(String[] argv) {
- Person p = new Person("A","B",99);
- System.out.println(p);
- System.out.println(p.firstName());
- }
-}
+++ /dev/null
-public record Person(String firstName, String lastName, int age) {}
-
--- /dev/null
+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);
+ }
+ }
+}
--- /dev/null
+public record Person(String firstName, String lastName, int age) {}
+
--- /dev/null
+public aspect TraceRecordComponents {
+ before(): execution(public * *()) {
+ System.out.println(thisJoinPointStaticPart);
+ }
+}
--- /dev/null
+public class UsingPersonRecord {
+ public static void main(String[] argv) {
+ Person p = new Person("A","B",99);
+ System.out.println(p);
+ System.out.println(p.firstName());
+ }
+}
--- /dev/null
+public record Person(String firstName, String lastName, int age) {}
+
*******************************************************************************/
package org.aspectj.systemtest.ajc196;
+import org.aspectj.apache.bcel.Constants;
import org.aspectj.testing.XMLBasedAjcTestCase;
import org.aspectj.testing.XMLBasedAjcTestCaseForJava14Only;
*/
public class Ajc196PreviewFeaturesTests extends XMLBasedAjcTestCaseForJava14Only {
+ public void testRecords() {
+ runTest("simple record");
+ checkVersion("Person", Constants.MAJOR_14, Constants.PREVIEW_MINOR_VERSION);
+ }
+
public void testRecords2() {
runTest("using a record");
}
runTest("early resolution of supporting interfaces");
}
- public void testRecords() {
- runTest("simple record");
- checkVersion("Person", Constants.MAJOR_14, Constants.PREVIEW_MINOR_VERSION);
- }
-
public void testSwitch1() {
runTest("switch 1");
checkVersion("Switch1", Constants.MAJOR_14, 0);
</run>
</ajc-test>
- <ajc-test dir="bugs196/java14" vm="14" title="simple record">
+ <ajc-test dir="features196/java14" vm="14" title="simple record">
<compile files="Person.java" options="--enable-preview -14" />
</ajc-test>
- <ajc-test dir="bugs196/java14" vm="14" title="using a record">
+ <ajc-test dir="features196/java14" vm="14" title="using a record">
<compile files="Person.java UsingPersonRecord.java"
options="--enable-preview -14" />
<run class="UsingPersonRecord" vmargs="--enable-preview">
</run>
</ajc-test>
- <ajc-test dir="bugs196/java14" vm="14"
+ <ajc-test dir="features196/java14" vm="14"
title="instanceof patterns">
<compile files="Jep305.java" options="--enable-preview -14" />
<run class="Jep305" vmargs="--enable-preview">
</ajc-test>
- <ajc-test dir="bugs196/java14" vm="14"
+ <ajc-test dir="features196/java14" vm="14"
title="advising records">
<compile
files="TraceRecordComponents.aj Person.java UsingPersonRecord.java"