From a0acb0ca41cfd804c9d24d2efa6bee08a82ddc68 Mon Sep 17 00:00:00 2001 From: Lorenzo Bettini Date: Wed, 27 Nov 2024 10:21:22 +0100 Subject: [PATCH] plugins ITs: Java records are also in standard test projects --- .../it/compile/simple/src/main/java/test/JavaRecord.java | 7 +++++++ .../it/compile/simple/src/main/java/test/XtendA.xtend | 9 ++++++--- .../org/eclipse/xtext/maven/plugin/XtextGeneratorIT.java | 1 + .../it/generate/java-lang-bi-ref/src/JavaRecord.java | 5 +++++ .../generate/java-lang-bi-ref/src/XbaseReferToJava.xbase | 2 ++ 5 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/simple/src/main/java/test/JavaRecord.java create mode 100644 org.eclipse.xtext.maven.plugin/src/test/resources/it/generate/java-lang-bi-ref/src/JavaRecord.java diff --git a/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/simple/src/main/java/test/JavaRecord.java b/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/simple/src/main/java/test/JavaRecord.java new file mode 100644 index 00000000000..1792c04fbf4 --- /dev/null +++ b/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/simple/src/main/java/test/JavaRecord.java @@ -0,0 +1,7 @@ +package test; + +public record JavaRecord(String name) { + public XtendA foo(XtendA test) { + return test; + } +} diff --git a/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/simple/src/main/java/test/XtendA.xtend b/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/simple/src/main/java/test/XtendA.xtend index 99a317b545f..e9e7af7244d 100644 --- a/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/simple/src/main/java/test/XtendA.xtend +++ b/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/simple/src/main/java/test/XtendA.xtend @@ -1,13 +1,16 @@ package test class XtendA extends JavaB { - + def JavaB test2(XtendC s) { return s.foo.newJavaB } - + def JavaB newJavaB() { return new JavaB() } - + + def JavaRecord newJavaRecord() { + return new JavaRecord("a test") + } } \ No newline at end of file diff --git a/org.eclipse.xtext.maven.plugin/src/test/java/org/eclipse/xtext/maven/plugin/XtextGeneratorIT.java b/org.eclipse.xtext.maven.plugin/src/test/java/org/eclipse/xtext/maven/plugin/XtextGeneratorIT.java index 17d7d9405b0..7276e0a7c4d 100644 --- a/org.eclipse.xtext.maven.plugin/src/test/java/org/eclipse/xtext/maven/plugin/XtextGeneratorIT.java +++ b/org.eclipse.xtext.maven.plugin/src/test/java/org/eclipse/xtext/maven/plugin/XtextGeneratorIT.java @@ -237,6 +237,7 @@ public void javaLangBiRef() throws Exception { verifier.verifyFilePresent(verifier.getBasedir() + "/src-gen/XbaseReferToJava.java"); verifier.verifyFilePresent(verifier.getBasedir() + "/target/xtext-temp/stub-classes/XbaseReferToJava.class"); verifier.verifyFilePresent(verifier.getBasedir() + "/target/xtext-temp/stub-classes/JavaClazz.class"); + verifier.verifyFilePresent(verifier.getBasedir() + "/target/xtext-temp/stub-classes/JavaRecord.class"); } @Test diff --git a/org.eclipse.xtext.maven.plugin/src/test/resources/it/generate/java-lang-bi-ref/src/JavaRecord.java b/org.eclipse.xtext.maven.plugin/src/test/resources/it/generate/java-lang-bi-ref/src/JavaRecord.java new file mode 100644 index 00000000000..044b51be9e9 --- /dev/null +++ b/org.eclipse.xtext.maven.plugin/src/test/resources/it/generate/java-lang-bi-ref/src/JavaRecord.java @@ -0,0 +1,5 @@ +public record JavaRecord(String name) { + public void useXbaseType(XbaseReferToJava xbaseType) throws Throwable { + xbaseType.myMethod(); + } +} diff --git a/org.eclipse.xtext.maven.plugin/src/test/resources/it/generate/java-lang-bi-ref/src/XbaseReferToJava.xbase b/org.eclipse.xtext.maven.plugin/src/test/resources/it/generate/java-lang-bi-ref/src/XbaseReferToJava.xbase index 23d98f7cfb6..b35c73b9212 100644 --- a/org.eclipse.xtext.maven.plugin/src/test/resources/it/generate/java-lang-bi-ref/src/XbaseReferToJava.xbase +++ b/org.eclipse.xtext.maven.plugin/src/test/resources/it/generate/java-lang-bi-ref/src/XbaseReferToJava.xbase @@ -1,2 +1,4 @@ val JavaClazz jc = null +val JavaRecord jr = new JavaRecord("test") +val name = jr.name() jc.useXbaseType(this)