diff --git a/groovy-eclipse.setup b/groovy-eclipse.setup
index acd6db1a65..e2e81861da 100644
--- a/groovy-eclipse.setup
+++ b/groovy-eclipse.setup
@@ -293,7 +293,7 @@
+ url="https://download.eclipse.org/eclipse/updates/4.21-I-builds/I20210818-1800"/>
diff --git a/jdt-patch/e421/Feature-org.codehaus.groovy.jdt.patch/feature.xml b/jdt-patch/e421/Feature-org.codehaus.groovy.jdt.patch/feature.xml
index 2d52a92187..d15955eaa5 100644
--- a/jdt-patch/e421/Feature-org.codehaus.groovy.jdt.patch/feature.xml
+++ b/jdt-patch/e421/Feature-org.codehaus.groovy.jdt.patch/feature.xml
@@ -18,7 +18,7 @@
-
+
;\n" +
" }\n" +
"}\n",
// expectedCompletionIdentifier:
diff --git a/jdt-patch/e421/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/PatternMatching16Test.java b/jdt-patch/e421/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/PatternMatching16Test.java
index 2b27609544..f853c26f9b 100644
--- a/jdt-patch/e421/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/PatternMatching16Test.java
+++ b/jdt-patch/e421/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/PatternMatching16Test.java
@@ -12,8 +12,11 @@
*******************************************************************************/
package org.eclipse.jdt.core.tests.compiler.regression;
+import java.io.IOException;
import java.util.Map;
+import org.eclipse.jdt.core.util.ClassFileBytesDisassembler;
+import org.eclipse.jdt.core.util.ClassFormatException;
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
import junit.framework.Test;
@@ -3876,4 +3879,89 @@ public void testBug574906() {
"true",
options);
}
+ public void testBug575035() throws ClassFormatException, IOException {
+ Map options = getCompilerOptions(false);
+ String source =
+ "import java.lang.annotation.ElementType;\n" +
+ "import java.lang.annotation.Retention;\n" +
+ "import java.lang.annotation.RetentionPolicy;\n" +
+ "import java.lang.annotation.Target;\n" +
+ " \n" +
+ "public class Test {\n" +
+ " @Target({ ElementType.LOCAL_VARIABLE})\n" +
+ " @Retention(RetentionPolicy.RUNTIME)\n" +
+ " @interface Var {}\n" +
+ " @Target({ ElementType.TYPE_USE})\n" +
+ " @Retention(RetentionPolicy.RUNTIME)\n" +
+ " @interface Type {}\n" +
+ " public static void main(String[] args) {" +
+ " @Var @Type String y = \"OK: \";\n" +
+ " if (((Object)\"local\") instanceof @Var @Type String x) {\n" +
+ " System.out.println(y + x);\n" +
+ " }\n" +
+ " }\n" +
+ "}";
+ String expectedOutput = ""
+ + " // Method descriptor #15 ([Ljava/lang/String;)V\n"
+ + " // Stack: 4, Locals: 4\n"
+ + " public static void main(String[] args);\n"
+ + " 0 ldc [16]\n"
+ + " 2 astore_1 [y]\n"
+ + " 3 ldc [18]\n"
+ + " 5 astore_3 [ instanceOfPatternExpressionValue]\n"
+ + " 6 aload_3 [ instanceOfPatternExpressionValue]\n"
+ + " 7 instanceof String [20]\n"
+ + " 10 ifeq 50\n"
+ + " 13 aload_3 [ instanceOfPatternExpressionValue]\n"
+ + " 14 checkcast String [20]\n"
+ + " 17 dup\n"
+ + " 18 astore_2\n"
+ + " 19 aload_3\n"
+ + " 20 checkcast String [20]\n"
+ + " 23 if_acmpne 50\n"
+ + " 26 getstatic System.out : PrintStream [22]\n"
+ + " 29 new StringBuilder [28]\n"
+ + " 32 dup\n"
+ + " 33 aload_1 [y]\n"
+ + " 34 invokestatic String.valueOf(Object) : String [30]\n"
+ + " 37 invokespecial StringBuilder(String) [34]\n"
+ + " 40 aload_2 [x]\n"
+ + " 41 invokevirtual StringBuilder.append(String) : StringBuilder [37]\n"
+ + " 44 invokevirtual StringBuilder.toString() : String [41]\n"
+ + " 47 invokevirtual PrintStream.println(String) : void [45]\n"
+ + " 50 return\n"
+ + " Line numbers:\n"
+ + " [pc: 0, line: 13]\n"
+ + " [pc: 3, line: 14]\n"
+ + " [pc: 26, line: 15]\n"
+ + " [pc: 50, line: 17]\n"
+ + " Local variable table:\n"
+ + " [pc: 0, pc: 51] local: args index: 0 type: String[]\n"
+ + " [pc: 3, pc: 51] local: y index: 1 type: String\n"
+ + " [pc: 26, pc: 50] local: x index: 2 type: String\n"
+ + " [pc: 6, pc: 20] local: instanceOfPatternExpressionValue index: 3 type: Object\n"
+ + " Stack map table: number of frames 1\n"
+ + " [pc: 50, append: {String}]\n"
+ + " RuntimeVisibleTypeAnnotations: \n"
+ + " #59 @Type(\n"
+ + " target type = 0x40 LOCAL_VARIABLE\n"
+ + " local variable entries:\n"
+ + " [pc: 3, pc: 51] index: 1\n"
+ + " )\n"
+ + " #59 @Type(\n"
+ + " target type = 0x40 LOCAL_VARIABLE\n"
+ + " local variable entries:\n"
+ + " [pc: 26, pc: 50] index: 2\n"
+ + " )\n"
+ + "\n";
+ checkClassFile("Test", source, expectedOutput, ClassFileBytesDisassembler.DETAILED | ClassFileBytesDisassembler.COMPACT);
+ runConformTest(
+ new String[] {
+ "Test.java",
+ source,
+ },
+ "OK: local",
+ options);
+
+ }
}
diff --git a/jdt-patch/e421/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/AbstractCompilerTest.java b/jdt-patch/e421/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/AbstractCompilerTest.java
index a705a2befa..35b6bba070 100644
--- a/jdt-patch/e421/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/AbstractCompilerTest.java
+++ b/jdt-patch/e421/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/AbstractCompilerTest.java
@@ -321,7 +321,11 @@ public static int getPossibleComplianceLevels() {
isJRE10Plus = isJRE11Plus || CompilerOptions.VERSION_10.equals(specVersion);
isJRE9Plus = isJRE10Plus || CompilerOptions.VERSION_9.equals(specVersion);
initReflectionVersion();
- String compliances = System.getProperty("compliance");
+ String key = "compliance.jre." + specVersion;
+ String compliances = System.getProperty(key);
+ if (compliances == null) {
+ compliances = System.getProperty("compliance");
+ }
if (compliances != null) {
possibleComplianceLevels = 0;
for (String compliance : compliances.split(",")) {
diff --git a/jdt-patch/e421/org.eclipse.jdt.core.tests.compiler/test.xml b/jdt-patch/e421/org.eclipse.jdt.core.tests.compiler/test.xml
index afe7e7ccfb..53a33770d2 100644
--- a/jdt-patch/e421/org.eclipse.jdt.core.tests.compiler/test.xml
+++ b/jdt-patch/e421/org.eclipse.jdt.core.tests.compiler/test.xml
@@ -1,7 +1,7 @@