diff --git a/jdt-patch/e418/Feature-org.codehaus.groovy.jdt.patch/feature.xml b/jdt-patch/e418/Feature-org.codehaus.groovy.jdt.patch/feature.xml
index b91cd630ff..92afc3ba4d 100644
--- a/jdt-patch/e418/Feature-org.codehaus.groovy.jdt.patch/feature.xml
+++ b/jdt-patch/e418/Feature-org.codehaus.groovy.jdt.patch/feature.xml
@@ -18,7 +18,7 @@
-
+
{\n"+
+ " while (o.eq) {\n"+
+ " // nothing\n"+
+ " }\n"+
+ " };\n"+
+ " }\n"+
+ "}\n"+
+ "interface I { \n"+
+ " public abstract void run();\n"+
+ "}"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 4)\n" +
+ " while (o.eq) {\n" +
+ " ^^\n" +
+ "eq cannot be resolved or is not a field\n" +
+ "----------\n");
+}
public static Class testClass() {
return FieldAccessTest.class;
}
diff --git a/jdt-patch/e418/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/RecordsRestrictedClassTest.java b/jdt-patch/e418/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/RecordsRestrictedClassTest.java
index ee7a55fb30..48567d298a 100644
--- a/jdt-patch/e418/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/RecordsRestrictedClassTest.java
+++ b/jdt-patch/e418/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/RecordsRestrictedClassTest.java
@@ -8014,4 +8014,50 @@ public void testBug561199_001() {
new String[] {"--enable-preview"},
options);
}
+public void testBug568922_001() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X {\n"+
+ " public static void main(String[] args) {\n"+
+ " @SuppressWarnings(\"preview\")\n"+
+ " record R() {\n"+
+ " R {\n"+
+ " super();\n"+
+ " System.out.println(\"helo\");\n"+
+ " }\n"+
+ " }\n"+
+ " new R();\n"+
+ " }\n"+
+ "}"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 6)\n" +
+ " super();\n" +
+ " ^^^^^^^^\n" +
+ "The body of a compact constructor must not contain an explicit constructor call\n" +
+ "----------\n",
+ null,
+ true,
+ new String[] {"--enable-preview"},
+ getCompilerOptions());
+}
+public void testBug568922_002() {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n"+
+ " public static void main(String[] args) {\n"+
+ " @SuppressWarnings(\"preview\")\n"+
+ " record R() {\n"+
+ " R {\n"+
+ " System.out.println(\"helo\");\n"+
+ " }\n"+
+ " }\n"+
+ " new R();\n"+
+ " }\n"+
+ "}"
+ },
+ "helo");
+}
}
\ No newline at end of file
diff --git a/jdt-patch/e418/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java b/jdt-patch/e418/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java
index de4fc80b4d..d5687d032d 100644
--- a/jdt-patch/e418/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java
+++ b/jdt-patch/e418/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java
@@ -120,7 +120,7 @@ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, Fl
if ((this.bits & ASTNode.Unchecked) != 0 && this.genericTypeArguments == null) {
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=277643, align with javac on JLS 15.12.2.6
thrownExceptions = currentScope.environment().convertToRawTypes(this.binding.thrownExceptions, true, true);
- }
+ }
// check exceptions
flowContext.checkExceptionHandlers(
thrownExceptions,
@@ -310,7 +310,8 @@ public void resolve(BlockScope scope) {
if (methodDeclaration == null
|| !methodDeclaration.isConstructor()
|| ((ConstructorDeclaration) methodDeclaration).constructorCall != this) {
- scope.problemReporter().invalidExplicitConstructorCall(this);
+ if (!(methodDeclaration instanceof CompactConstructorDeclaration)) // already flagged for CCD
+ scope.problemReporter().invalidExplicitConstructorCall(this);
// fault-tolerance
if (this.qualification != null) {
this.qualification.resolveType(scope);
@@ -486,7 +487,7 @@ public void setDepth(int depth) {
public void setFieldIndex(int depth) {
// ignore for here
}
-
+
@Override
public void traverse(ASTVisitor visitor, BlockScope scope) {
if (visitor.visit(this, scope)) {
@@ -516,17 +517,17 @@ public MethodBinding binding() {
public void registerInferenceContext(ParameterizedGenericMethodBinding method, InferenceContext18 infCtx18) {
// Nothing to do.
}
-
+
@Override
public void registerResult(TypeBinding targetType, MethodBinding method) {
// Nothing to do.
}
-
+
@Override
public InferenceContext18 getInferenceContext(ParameterizedMethodBinding method) {
return null;
}
-
+
@Override
public void cleanUpInferenceContexts() {
// Nothing to do.
diff --git a/jdt-patch/e418/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java b/jdt-patch/e418/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java
index bf9d86975e..b1bf2cdf22 100644
--- a/jdt-patch/e418/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java
+++ b/jdt-patch/e418/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java
@@ -928,7 +928,7 @@ public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FieldBindi
@Override
public Constant optimizedBooleanConstant() {
- if (this.binding.isValidBinding()) {
+ if (this.binding.isValidBinding() && this.resolvedType != null) {
switch (this.resolvedType.id) {
case T_boolean :
case T_JavaLangBoolean :
diff --git a/jdt-patch/e418/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java b/jdt-patch/e418/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java
index 01445ce714..7cd996e6ec 100644
--- a/jdt-patch/e418/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java
+++ b/jdt-patch/e418/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java
@@ -83,6 +83,7 @@
import org.eclipse.jdt.internal.compiler.ast.RecordComponent;
import org.eclipse.jdt.internal.compiler.ast.ReferenceExpression;
import org.eclipse.jdt.internal.compiler.ast.ReturnStatement;
+import org.eclipse.jdt.internal.compiler.ast.SuperReference;
import org.eclipse.jdt.internal.compiler.ast.SwitchStatement;
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
import org.eclipse.jdt.internal.compiler.ast.TypeParameter;
@@ -2513,6 +2514,12 @@ public boolean visit(ReturnStatement returnStatement, BlockScope skope) {
return true;
}
};
+ if ( methodDecl instanceof CompactConstructorDeclaration) {
+ CompactConstructorDeclaration ccd = (CompactConstructorDeclaration) methodDecl;
+ if (ccd.constructorCall == null) { // local traverse - super not set yet.
+ ccd.constructorCall = SuperReference.implicitSuperConstructorCall();
+ }
+ }
methodDecl.traverse(visitor, this.scope);
}
diff --git a/jdt-patch/e418/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/NaiveASTFlattener.java b/jdt-patch/e418/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/NaiveASTFlattener.java
index 06575f5a47..adfd67b652 100644
--- a/jdt-patch/e418/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/NaiveASTFlattener.java
+++ b/jdt-patch/e418/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/NaiveASTFlattener.java
@@ -874,10 +874,10 @@ public boolean visit(Initializer node) {
public boolean visit(InstanceofExpression node) {
node.getLeftOperand().accept(this);
this.buffer.append(" instanceof ");//$NON-NLS-1$
+ node.getRightOperand().accept(this);
if (DOMASTUtil.isInstanceofExpressionPatternSupported(node.getAST()) && node.getPatternVariable()!= null) {
+ this.buffer.append(" "); //$NON-NLS-1$
node.getPatternVariable().accept(this);
- } else {
- node.getRightOperand().accept(this);
}
return false;
}
diff --git a/jdt-patch/e418/org.eclipse.jdt.core/readme.txt b/jdt-patch/e418/org.eclipse.jdt.core/readme.txt
index af66504ff6..68b0f3fa44 100644
--- a/jdt-patch/e418/org.eclipse.jdt.core/readme.txt
+++ b/jdt-patch/e418/org.eclipse.jdt.core/readme.txt
@@ -1,3 +1,4 @@
2020-10-09: 15d476e (2020-12 M1)
2020-11-06: f65f34e (2020-12 M2)
2020-11-20: d11a339 (2020-12 M3)
+2020-11-28: 92d33b4 (2020-12 RC1)