From b3824c9dc1861c0ce6acdf48049e6552d808e448 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Mon, 15 Jul 2019 22:15:15 +0200 Subject: [fixes #2169] Eclipse 2019-06 + JDK12 + `@Singular` caused a cavalcade of error popups --- .../handlers/singulars/EclipseJavaUtilListSingularizer.java | 7 +++---- .../eclipse/handlers/singulars/EclipseJavaUtilSingularizer.java | 8 ++++---- 2 files changed, 7 insertions(+), 8 deletions(-) (limited to 'src/core/lombok/eclipse/handlers/singulars') diff --git a/src/core/lombok/eclipse/handlers/singulars/EclipseJavaUtilListSingularizer.java b/src/core/lombok/eclipse/handlers/singulars/EclipseJavaUtilListSingularizer.java index 7ea04821..bf50aef6 100755 --- a/src/core/lombok/eclipse/handlers/singulars/EclipseJavaUtilListSingularizer.java +++ b/src/core/lombok/eclipse/handlers/singulars/EclipseJavaUtilListSingularizer.java @@ -35,7 +35,6 @@ import lombok.eclipse.handlers.EclipseSingularsRecipes.SingularData; import org.eclipse.jdt.internal.compiler.ast.AllocationExpression; import org.eclipse.jdt.internal.compiler.ast.Assignment; import org.eclipse.jdt.internal.compiler.ast.BreakStatement; -import org.eclipse.jdt.internal.compiler.ast.CaseStatement; import org.eclipse.jdt.internal.compiler.ast.Expression; import org.eclipse.jdt.internal.compiler.ast.FieldReference; import org.eclipse.jdt.internal.compiler.ast.LocalDeclaration; @@ -74,7 +73,7 @@ public class EclipseJavaUtilListSingularizer extends EclipseJavaUtilListSetSingu List switchContents = new ArrayList(); /* case 0: (empty) break; */ { - switchContents.add(new CaseStatement(makeIntLiteral(new char[] {'0'}, null), 0, 0)); + switchContents.add(Eclipse.createCaseStatement(makeIntLiteral(new char[] {'0'}, null))); MessageSend invoke = new MessageSend(); invoke.receiver = new QualifiedNameReference(JAVA_UTIL_COLLECTIONS, NULL_POSS, 0, 0); invoke.selector = "emptyList".toCharArray(); @@ -83,7 +82,7 @@ public class EclipseJavaUtilListSingularizer extends EclipseJavaUtilListSetSingu } /* case 1: (singleton) break; */ { - switchContents.add(new CaseStatement(makeIntLiteral(new char[] {'1'}, null), 0, 0)); + switchContents.add(Eclipse.createCaseStatement(makeIntLiteral(new char[] {'1'}, null))); FieldReference thisDotField = new FieldReference(data.getPluralName(), 0L); thisDotField.receiver = getBuilderReference(builderVariable); MessageSend thisDotFieldGet0 = new MessageSend(); @@ -101,7 +100,7 @@ public class EclipseJavaUtilListSingularizer extends EclipseJavaUtilListSetSingu } /* default: Create by passing builder field to constructor. */ { - switchContents.add(new CaseStatement(null, 0, 0)); + switchContents.add(Eclipse.createCaseStatement(null)); Expression argToUnmodifiable; /* new j.u.ArrayList(this.pluralName); */ { diff --git a/src/core/lombok/eclipse/handlers/singulars/EclipseJavaUtilSingularizer.java b/src/core/lombok/eclipse/handlers/singulars/EclipseJavaUtilSingularizer.java index 8aeffc48..4a143a06 100755 --- a/src/core/lombok/eclipse/handlers/singulars/EclipseJavaUtilSingularizer.java +++ b/src/core/lombok/eclipse/handlers/singulars/EclipseJavaUtilSingularizer.java @@ -34,7 +34,6 @@ import org.eclipse.jdt.internal.compiler.ast.Assignment; import org.eclipse.jdt.internal.compiler.ast.BinaryExpression; import org.eclipse.jdt.internal.compiler.ast.Block; import org.eclipse.jdt.internal.compiler.ast.BreakStatement; -import org.eclipse.jdt.internal.compiler.ast.CaseStatement; import org.eclipse.jdt.internal.compiler.ast.ConditionalExpression; import org.eclipse.jdt.internal.compiler.ast.EqualExpression; import org.eclipse.jdt.internal.compiler.ast.Expression; @@ -58,6 +57,7 @@ import org.eclipse.jdt.internal.compiler.lookup.TypeConstants; import org.eclipse.jdt.internal.compiler.lookup.TypeIds; import lombok.ConfigurationKeys; +import lombok.eclipse.Eclipse; import lombok.eclipse.EclipseNode; import lombok.eclipse.handlers.EclipseSingularsRecipes.EclipseSingularizer; import lombok.eclipse.handlers.EclipseSingularsRecipes.SingularData; @@ -95,7 +95,7 @@ abstract class EclipseJavaUtilSingularizer extends EclipseSingularizer { char[] keyName = mapMode ? (new String(data.getPluralName()) + "$key").toCharArray() : data.getPluralName(); if (emptyCollectionMethod != null) { // case 0: (empty); break; - switchContents.add(new CaseStatement(makeIntLiteral(new char[] {'0'}, null), 0, 0)); + switchContents.add(Eclipse.createCaseStatement(makeIntLiteral(new char[] {'0'}, null))); /* pluralName = java.util.Collections.emptyCollectionMethod(); */ { MessageSend invoke = new MessageSend(); @@ -108,7 +108,7 @@ abstract class EclipseJavaUtilSingularizer extends EclipseSingularizer { } if (singletonCollectionMethod != null) { // case 1: (singleton); break; - switchContents.add(new CaseStatement(makeIntLiteral(new char[] {'1'}, null), 0, 0)); + switchContents.add(Eclipse.createCaseStatement(makeIntLiteral(new char[] {'1'}, null))); /* !mapMode: pluralName = java.util.Collections.singletonCollectionMethod(this.pluralName.get(0)); mapMode: pluralName = java.util.Collections.singletonCollectionMethod(this.pluralName$key.get(0), this.pluralName$value.get(0)); */ { FieldReference thisDotKey = new FieldReference(keyName, 0L); @@ -142,7 +142,7 @@ abstract class EclipseJavaUtilSingularizer extends EclipseSingularizer { } { // default: - switchContents.add(new CaseStatement(null, 0, 0)); + switchContents.add(Eclipse.createCaseStatement(null)); switchContents.addAll(createJavaUtilSimpleCreationAndFillStatements(data, builderType, mapMode, false, true, emptyCollectionMethod == null, targetType, builderVariable)); } -- cgit