Skip to content

Commit

Permalink
Eclipse 4.18 (RC1) JDT Patch for Groovy-Eclipse: JDT commit 92d33b4
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-milles committed Nov 28, 2020
1 parent 745d01f commit 7578e8a
Show file tree
Hide file tree
Showing 8 changed files with 90 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</license>

<requires>
<import feature="org.eclipse.jdt" version="3.18.600.v20201119-0730" patch="true"/>
<import feature="org.eclipse.jdt" version="3.18.600.v20201125-1800" patch="true"/>
</requires>

<plugin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -794,6 +794,31 @@ public void testBug361039() {
"f cannot be resolved or is not a field\n" +
"----------\n");
}
public void testBug568959_001() {
if (this.complianceLevel < ClassFileConstants.JDK1_8) return; // lambda
runNegativeTest(
new String[] {
"X.java",
"public class X {\n"+
" public void foo(Object o) {\n"+
" I i = () -> {\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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 :
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions jdt-patch/e418/org.eclipse.jdt.core/readme.txt
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 7578e8a

Please sign in to comment.