diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/lombok/eclipse/handlers/singulars/EclipseGuavaSingularizer.java | 18 | ||||
-rw-r--r-- | src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java | 24 |
2 files changed, 21 insertions, 21 deletions
diff --git a/src/core/lombok/eclipse/handlers/singulars/EclipseGuavaSingularizer.java b/src/core/lombok/eclipse/handlers/singulars/EclipseGuavaSingularizer.java index c3a4c314..5a85bfa5 100644 --- a/src/core/lombok/eclipse/handlers/singulars/EclipseGuavaSingularizer.java +++ b/src/core/lombok/eclipse/handlers/singulars/EclipseGuavaSingularizer.java @@ -28,6 +28,12 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; +import lombok.core.GuavaTypeMap; +import lombok.core.handlers.HandlerUtil; +import lombok.eclipse.EclipseNode; +import lombok.eclipse.handlers.EclipseSingularsRecipes.EclipseSingularizer; +import lombok.eclipse.handlers.EclipseSingularsRecipes.SingularData; + import org.eclipse.jdt.internal.compiler.ast.Argument; import org.eclipse.jdt.internal.compiler.ast.Assignment; import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration; @@ -53,12 +59,6 @@ import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.lookup.TypeConstants; import org.eclipse.jdt.internal.compiler.lookup.TypeIds; -import lombok.core.GuavaTypeMap; -import lombok.core.handlers.HandlerUtil; -import lombok.eclipse.EclipseNode; -import lombok.eclipse.handlers.EclipseSingularsRecipes.EclipseSingularizer; -import lombok.eclipse.handlers.EclipseSingularsRecipes.SingularData; - abstract class EclipseGuavaSingularizer extends EclipseSingularizer { protected static final char[][] JAVA_UTIL_MAP = { {'j', 'a', 'v', 'a'}, {'u', 't', 'i', 'l'}, {'M', 'a', 'p'} @@ -94,7 +94,7 @@ abstract class EclipseGuavaSingularizer extends EclipseSingularizer { String simpleTypeName = getSimpleTargetTypeName(data); char[][] tokenizedName = makeGuavaTypeName(simpleTypeName, true); TypeReference type = new QualifiedTypeReference(tokenizedName, NULL_POSS); - type = addTypeArgs(getTypeAgrumentsCount(isMap(), simpleTypeName), false, builderType, type, data.getTypeArgs()); + type = addTypeArgs(getTypeArgumentsCount(isMap(), simpleTypeName), false, builderType, type, data.getTypeArgs()); FieldDeclaration buildField = new FieldDeclaration(data.getPluralName(), 0, -1); buildField.bits |= ECLIPSE_DO_NOT_TOUCH_FLAG; @@ -220,7 +220,7 @@ abstract class EclipseGuavaSingularizer extends EclipseSingularizer { boolean mapMode = isMap(); TypeReference varType = new QualifiedTypeReference(fromQualifiedName(data.getTargetFqn()), NULL_POSS); String simpleTypeName = getSimpleTargetTypeName(data); - int agrumentsCount = getTypeAgrumentsCount(mapMode, simpleTypeName); + int agrumentsCount = getTypeArgumentsCount(mapMode, simpleTypeName); varType = addTypeArgs(agrumentsCount, false, builderType, varType, data.getTypeArgs()); MessageSend emptyInvoke; { @@ -268,7 +268,7 @@ abstract class EclipseGuavaSingularizer extends EclipseSingularizer { return new IfStatement(cond, new Assignment(thisDotField2, createBuilderInvoke, 0), 0, 0); } - private int getTypeAgrumentsCount(boolean isMap, String simpleTypeName) { + private int getTypeArgumentsCount(boolean isMap, String simpleTypeName) { return isMap ? 2 : getListSetTypeArgumentsCount(simpleTypeName); } diff --git a/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java b/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java index 399f2239..1bf47e6e 100644 --- a/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java +++ b/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java @@ -26,6 +26,14 @@ import static lombok.javac.handlers.JavacHandlerUtil.*; import java.util.Collections; +import lombok.core.GuavaTypeMap; +import lombok.core.handlers.HandlerUtil; +import lombok.javac.JavacNode; +import lombok.javac.JavacTreeMaker; +import lombok.javac.handlers.JavacHandlerUtil; +import lombok.javac.handlers.JavacSingularsRecipes.JavacSingularizer; +import lombok.javac.handlers.JavacSingularsRecipes.SingularData; + import com.sun.tools.javac.code.Flags; import com.sun.tools.javac.tree.JCTree; import com.sun.tools.javac.tree.JCTree.JCBlock; @@ -39,14 +47,6 @@ import com.sun.tools.javac.util.List; import com.sun.tools.javac.util.ListBuffer; import com.sun.tools.javac.util.Name; -import lombok.core.GuavaTypeMap; -import lombok.core.handlers.HandlerUtil; -import lombok.javac.JavacNode; -import lombok.javac.JavacTreeMaker; -import lombok.javac.handlers.JavacHandlerUtil; -import lombok.javac.handlers.JavacSingularsRecipes.JavacSingularizer; -import lombok.javac.handlers.JavacSingularsRecipes.SingularData; - abstract class JavacGuavaSingularizer extends JavacSingularizer { protected String getSimpleTargetTypeName(SingularData data) { return GuavaTypeMap.getGuavaTypeName(data.getTargetFqn()); @@ -64,7 +64,7 @@ abstract class JavacGuavaSingularizer extends JavacSingularizer { JavacTreeMaker maker = builderType.getTreeMaker(); String simpleTypeName = getSimpleTargetTypeName(data); JCExpression type = JavacHandlerUtil.chainDots(builderType, "com", "google", "common", "collect", simpleTypeName, "Builder"); - type = addTypeArgs(getTypeAgrumentsCount(isMap(), simpleTypeName), false, builderType, type, data.getTypeArgs(), source); + type = addTypeArgs(getTypeArgumentsCount(isMap(), simpleTypeName), false, builderType, type, data.getTypeArgs(), source); JCVariableDecl buildField = maker.VarDef(maker.Modifiers(Flags.PRIVATE), data.getPluralName(), type, null); return Collections.singletonList(injectFieldAndMarkGenerated(builderType, buildField)); @@ -155,7 +155,7 @@ abstract class JavacGuavaSingularizer extends JavacSingularizer { } } String simpleTypeName = getSimpleTargetTypeName(data); - paramType = addTypeArgs(getTypeAgrumentsCount(mapMode, simpleTypeName), true, builderType, paramType, data.getTypeArgs(), source); + paramType = addTypeArgs(getTypeArgumentsCount(mapMode, simpleTypeName), true, builderType, paramType, data.getTypeArgs(), source); JCVariableDecl param = maker.VarDef(maker.Modifiers(paramFlags), data.getPluralName(), paramType, null); JCMethodDecl method = maker.MethodDef(mods, methodName, returnType, typeParams, List.of(param), thrown, body, null); injectMethod(builderType, method); @@ -168,7 +168,7 @@ abstract class JavacGuavaSingularizer extends JavacSingularizer { String simpleTypeName = getSimpleTargetTypeName(data); JCExpression varType = chainDotsString(builderType, data.getTargetFqn()); - int agrumentsCount = getTypeAgrumentsCount(mapMode, simpleTypeName); + int agrumentsCount = getTypeArgumentsCount(mapMode, simpleTypeName); varType = addTypeArgs(agrumentsCount, false, builderType, varType, data.getTypeArgs(), source); JCExpression empty; { @@ -207,7 +207,7 @@ abstract class JavacGuavaSingularizer extends JavacSingularizer { return maker.If(cond, thenPart, null); } - private int getTypeAgrumentsCount(boolean isMap, String simpleTypeName) { + private int getTypeArgumentsCount(boolean isMap, String simpleTypeName) { return isMap ? 2 : getListSetTypeArgumentsCount(simpleTypeName); } |