diff options
author | Roel Spilker <r.spilker@gmail.com> | 2013-09-25 21:38:37 +0200 |
---|---|---|
committer | Roel Spilker <r.spilker@gmail.com> | 2013-09-25 21:38:37 +0200 |
commit | 7fc6e70b36c978ef230e3df41db151f3c0da3da1 (patch) | |
tree | 43f5546d16565d4d03f1e0ef9f156aa998cce939 /src/core/lombok/javac/handlers | |
parent | f0cdc27a3f86c0ca728ad598893dd2b95ba38e20 (diff) | |
download | lombok-7fc6e70b36c978ef230e3df41db151f3c0da3da1.tar.gz lombok-7fc6e70b36c978ef230e3df41db151f3c0da3da1.tar.bz2 lombok-7fc6e70b36c978ef230e3df41db151f3c0da3da1.zip |
Pre-emptive fix for the anticipated removal of ListBuffer.lb() in javac8
Diffstat (limited to 'src/core/lombok/javac/handlers')
9 files changed, 42 insertions, 42 deletions
diff --git a/src/core/lombok/javac/handlers/HandleBuilder.java b/src/core/lombok/javac/handlers/HandleBuilder.java index d7ea2806..8a826087 100644 --- a/src/core/lombok/javac/handlers/HandleBuilder.java +++ b/src/core/lombok/javac/handlers/HandleBuilder.java @@ -98,7 +98,7 @@ public class HandleBuilder extends JavacAnnotationHandler<Builder> { if (parent.get() instanceof JCClassDecl) { tdParent = parent; JCClassDecl td = (JCClassDecl) tdParent.get(); - ListBuffer<JavacNode> allFields = ListBuffer.lb(); + ListBuffer<JavacNode> allFields = new ListBuffer<JavacNode>(); @SuppressWarnings("deprecation") boolean valuePresent = (hasAnnotation(lombok.Value.class, parent) || hasAnnotation(lombok.experimental.Value.class, parent)); for (JavacNode fieldNode : HandleConstructor.findAllFields(tdParent)) { @@ -224,7 +224,7 @@ public class HandleBuilder extends JavacAnnotationHandler<Builder> { JCExpression call; JCStatement statement; - ListBuffer<JCExpression> args = ListBuffer.lb(); + ListBuffer<JCExpression> args = new ListBuffer<JCExpression>(); for (Name n : fieldNames) { args.append(maker.Ident(n)); } @@ -233,7 +233,7 @@ public class HandleBuilder extends JavacAnnotationHandler<Builder> { call = maker.NewClass(null, List.<JCExpression>nil(), returnType, args.toList(), null); statement = maker.Return(call); } else { - ListBuffer<JCExpression> typeParams = ListBuffer.lb(); + ListBuffer<JCExpression> typeParams = new ListBuffer<JCExpression>(); for (JCTypeParameter tp : ((JCClassDecl) type.get()).typarams) { typeParams.append(maker.Ident(tp.name)); } @@ -255,7 +255,7 @@ public class HandleBuilder extends JavacAnnotationHandler<Builder> { private JCMethodDecl generateBuilderMethod(String builderMethodName, String builderClassName, JavacNode type, List<JCTypeParameter> typeParams) { JavacTreeMaker maker = type.getTreeMaker(); - ListBuffer<JCExpression> typeArgs = ListBuffer.lb(); + ListBuffer<JCExpression> typeArgs = new ListBuffer<JCExpression>(); for (JCTypeParameter typeParam : typeParams) { typeArgs.append(maker.Ident(typeParam.name)); } diff --git a/src/core/lombok/javac/handlers/HandleCleanup.java b/src/core/lombok/javac/handlers/HandleCleanup.java index 417d2815..e7786ffe 100644 --- a/src/core/lombok/javac/handlers/HandleCleanup.java +++ b/src/core/lombok/javac/handlers/HandleCleanup.java @@ -96,8 +96,8 @@ public class HandleCleanup extends JavacAnnotationHandler<Cleanup> { } boolean seenDeclaration = false; - ListBuffer<JCStatement> newStatements = ListBuffer.lb(); - ListBuffer<JCStatement> tryBlock = ListBuffer.lb(); + ListBuffer<JCStatement> newStatements = new ListBuffer<JCStatement>(); + ListBuffer<JCStatement> tryBlock = new ListBuffer<JCStatement>(); for (JCStatement statement : statements) { if (!seenDeclaration) { if (statement == decl) seenDeclaration = true; diff --git a/src/core/lombok/javac/handlers/HandleConstructor.java b/src/core/lombok/javac/handlers/HandleConstructor.java index 5156d709..b77a5367 100644 --- a/src/core/lombok/javac/handlers/HandleConstructor.java +++ b/src/core/lombok/javac/handlers/HandleConstructor.java @@ -91,7 +91,7 @@ public class HandleConstructor { } private static List<JavacNode> findRequiredFields(JavacNode typeNode) { - ListBuffer<JavacNode> fields = ListBuffer.lb(); + ListBuffer<JavacNode> fields = new ListBuffer<JavacNode>(); for (JavacNode child : typeNode.down()) { if (child.getKind() != Kind.FIELD) continue; JCVariableDecl fieldDecl = (JCVariableDecl) child.get(); @@ -126,7 +126,7 @@ public class HandleConstructor { } static List<JavacNode> findAllFields(JavacNode typeNode) { - ListBuffer<JavacNode> fields = ListBuffer.lb(); + ListBuffer<JavacNode> fields = new ListBuffer<JavacNode>(); for (JavacNode child : typeNode.down()) { if (child.getKind() != Kind.FIELD) continue; JCVariableDecl fieldDecl = (JCVariableDecl) child.get(); @@ -209,7 +209,7 @@ public class HandleConstructor { if (fields.isEmpty()) return; JavacTreeMaker maker = node.getTreeMaker(); JCExpression constructorPropertiesType = chainDots(node, "java", "beans", "ConstructorProperties"); - ListBuffer<JCExpression> fieldNames = ListBuffer.lb(); + ListBuffer<JCExpression> fieldNames = new ListBuffer<JCExpression>(); for (JavacNode field : fields) { Name fieldName = removePrefixFromField(field); fieldNames.append(maker.Literal(fieldName.toString())); @@ -225,9 +225,9 @@ public class HandleConstructor { boolean isEnum = (((JCClassDecl) typeNode.get()).mods.flags & Flags.ENUM) != 0; if (isEnum) level = AccessLevel.PRIVATE; - ListBuffer<JCStatement> nullChecks = ListBuffer.lb(); - ListBuffer<JCStatement> assigns = ListBuffer.lb(); - ListBuffer<JCVariableDecl> params = ListBuffer.lb(); + ListBuffer<JCStatement> nullChecks = new ListBuffer<JCStatement>(); + ListBuffer<JCStatement> assigns = new ListBuffer<JCStatement>(); + ListBuffer<JCVariableDecl> params = new ListBuffer<JCVariableDecl>(); for (JavacNode fieldNode : fields) { JCVariableDecl field = (JCVariableDecl) fieldNode.get(); @@ -272,11 +272,11 @@ public class HandleConstructor { JCExpression returnType, constructorType; - ListBuffer<JCTypeParameter> typeParams = ListBuffer.lb(); - ListBuffer<JCVariableDecl> params = ListBuffer.lb(); - ListBuffer<JCExpression> typeArgs1 = ListBuffer.lb(); - ListBuffer<JCExpression> typeArgs2 = ListBuffer.lb(); - ListBuffer<JCExpression> args = ListBuffer.lb(); + ListBuffer<JCTypeParameter> typeParams = new ListBuffer<JCTypeParameter>(); + ListBuffer<JCVariableDecl> params = new ListBuffer<JCVariableDecl>(); + ListBuffer<JCExpression> typeArgs1 = new ListBuffer<JCExpression>(); + ListBuffer<JCExpression> typeArgs2 = new ListBuffer<JCExpression>(); + ListBuffer<JCExpression> args = new ListBuffer<JCExpression>(); if (!type.typarams.isEmpty()) { for (JCTypeParameter param : type.typarams) { diff --git a/src/core/lombok/javac/handlers/HandleEqualsAndHashCode.java b/src/core/lombok/javac/handlers/HandleEqualsAndHashCode.java index ad3b571a..0f8161e1 100644 --- a/src/core/lombok/javac/handlers/HandleEqualsAndHashCode.java +++ b/src/core/lombok/javac/handlers/HandleEqualsAndHashCode.java @@ -154,7 +154,7 @@ public class HandleEqualsAndHashCode extends JavacAnnotationHandler<EqualsAndHas source.addWarning("Generating equals/hashCode implementation but without a call to superclass, even though this class does not extend java.lang.Object. If this is intentional, add '@EqualsAndHashCode(callSuper=false)' to your type."); } - ListBuffer<JavacNode> nodesForEquality = ListBuffer.lb(); + ListBuffer<JavacNode> nodesForEquality = new ListBuffer<JavacNode>(); if (includes != null) { for (JavacNode child : typeNode.down()) { if (child.getKind() != Kind.FIELD) continue; @@ -224,7 +224,7 @@ public class HandleEqualsAndHashCode extends JavacAnnotationHandler<EqualsAndHas JCAnnotation overrideAnnotation = maker.Annotation(chainDots(typeNode, "java", "lang", "Override"), List.<JCExpression>nil()); JCModifiers mods = maker.Modifiers(Flags.PUBLIC, List.of(overrideAnnotation)); JCExpression returnType = maker.TypeIdent(CTC_INT); - ListBuffer<JCStatement> statements = ListBuffer.lb(); + ListBuffer<JCStatement> statements = new ListBuffer<JCStatement>(); Name primeName = typeNode.toName(PRIME_NAME); Name resultName = typeNode.toName(RESULT_NAME); @@ -370,7 +370,7 @@ public class HandleEqualsAndHashCode extends JavacAnnotationHandler<EqualsAndHas JCExpression objectType = chainDots(typeNode, "java", "lang", "Object"); JCExpression returnType = maker.TypeIdent(CTC_BOOLEAN); - ListBuffer<JCStatement> statements = ListBuffer.lb(); + ListBuffer<JCStatement> statements = new ListBuffer<JCStatement>(); final List<JCVariableDecl> params = List.of(maker.VarDef(maker.Modifiers(Flags.FINAL | Flags.PARAMETER), oName, objectType, null)); /* if (o == this) return true; */ { @@ -387,8 +387,8 @@ public class HandleEqualsAndHashCode extends JavacAnnotationHandler<EqualsAndHas /* MyType<?> other = (MyType<?>) o; */ { if (!fields.isEmpty() || needsCanEqual) { final JCExpression selfType1, selfType2; - ListBuffer<JCExpression> wildcards1 = ListBuffer.lb(); - ListBuffer<JCExpression> wildcards2 = ListBuffer.lb(); + ListBuffer<JCExpression> wildcards1 = new ListBuffer<JCExpression>(); + ListBuffer<JCExpression> wildcards2 = new ListBuffer<JCExpression>(); for (int i = 0 ; i < type.typarams.length() ; i++) { wildcards1.append(maker.Wildcard(maker.TypeBoundKind(BoundKind.UNBOUND), null)); wildcards2.append(maker.Wildcard(maker.TypeBoundKind(BoundKind.UNBOUND), null)); diff --git a/src/core/lombok/javac/handlers/HandleGetter.java b/src/core/lombok/javac/handlers/HandleGetter.java index f6c14add..4ef23170 100644 --- a/src/core/lombok/javac/handlers/HandleGetter.java +++ b/src/core/lombok/javac/handlers/HandleGetter.java @@ -270,7 +270,7 @@ public class HandleGetter extends JavacAnnotationHandler<Getter> { } if (!delegates.isEmpty()) { - ListBuffer<JCAnnotation> withoutDelegates = ListBuffer.lb(); + ListBuffer<JCAnnotation> withoutDelegates = new ListBuffer<JCAnnotation>(); for (JCAnnotation annotation : fieldNode.mods.annotations) { if (!delegates.contains(annotation)) { withoutDelegates.append(annotation); @@ -328,7 +328,7 @@ public class HandleGetter extends JavacAnnotationHandler<Getter> { [END IF] */ - ListBuffer<JCStatement> statements = ListBuffer.lb(); + ListBuffer<JCStatement> statements = new ListBuffer<JCStatement>(); JCVariableDecl field = (JCVariableDecl) fieldNode.get(); JCExpression copyOfRawFieldType = copyType(maker, field); @@ -356,14 +356,14 @@ public class HandleGetter extends JavacAnnotationHandler<Getter> { /* if (value == null) { */ { JCSynchronized synchronizedStatement; /* synchronized (this.fieldName) { */ { - ListBuffer<JCStatement> synchronizedStatements = ListBuffer.lb(); + ListBuffer<JCStatement> synchronizedStatements = new ListBuffer<JCStatement>(); /* value = this.fieldName.get(); */ { JCExpressionStatement newAssign = maker.Exec(maker.Assign(maker.Ident(valueName), callGet(fieldNode, createFieldAccessor(maker, fieldNode, FieldAccess.ALWAYS_FIELD)))); synchronizedStatements.append(newAssign); } /* if (value == null) { */ { - ListBuffer<JCStatement> innerIfStatements = ListBuffer.lb(); + ListBuffer<JCStatement> innerIfStatements = new ListBuffer<JCStatement>(); /* final RawValueType actualValue = INITIALIZER_EXPRESSION; */ { innerIfStatements.append(maker.VarDef(maker.Modifiers(Flags.FINAL), actualValueName, copyOfRawFieldType, field.init)); } diff --git a/src/core/lombok/javac/handlers/HandleSetter.java b/src/core/lombok/javac/handlers/HandleSetter.java index 6f345418..c4977b2b 100644 --- a/src/core/lombok/javac/handlers/HandleSetter.java +++ b/src/core/lombok/javac/handlers/HandleSetter.java @@ -204,7 +204,7 @@ public class HandleSetter extends JavacAnnotationHandler<Setter> { JCExpression fieldRef = createFieldAccessor(treeMaker, field, FieldAccess.ALWAYS_FIELD); JCAssign assign = treeMaker.Assign(fieldRef, treeMaker.Ident(fieldDecl.name)); - ListBuffer<JCStatement> statements = ListBuffer.lb(); + ListBuffer<JCStatement> statements = new ListBuffer<JCStatement>(); List<JCAnnotation> nonNulls = findAnnotations(field, TransformationsUtil.NON_NULL_PATTERN); List<JCAnnotation> nullables = findAnnotations(field, TransformationsUtil.NULLABLE_PATTERN); diff --git a/src/core/lombok/javac/handlers/HandleToString.java b/src/core/lombok/javac/handlers/HandleToString.java index ea526009..9bd5b920 100644 --- a/src/core/lombok/javac/handlers/HandleToString.java +++ b/src/core/lombok/javac/handlers/HandleToString.java @@ -129,7 +129,7 @@ public class HandleToString extends JavacAnnotationHandler<ToString> { return; } - ListBuffer<JavacNode> nodesForToString = ListBuffer.lb(); + ListBuffer<JavacNode> nodesForToString = new ListBuffer<JavacNode>(); if (includes != null) { for (JavacNode child : typeNode.down()) { if (child.getKind() != Kind.FIELD) continue; diff --git a/src/core/lombok/javac/handlers/HandleWither.java b/src/core/lombok/javac/handlers/HandleWither.java index 4bda5464..9cfa4531 100644 --- a/src/core/lombok/javac/handlers/HandleWither.java +++ b/src/core/lombok/javac/handlers/HandleWither.java @@ -207,7 +207,7 @@ public class HandleWither extends JavacAnnotationHandler<Wither> { JCVariableDecl fieldDecl = (JCVariableDecl) field.get(); - ListBuffer<JCStatement> statements = ListBuffer.lb(); + ListBuffer<JCStatement> statements = new ListBuffer<JCStatement>(); List<JCAnnotation> nonNulls = findAnnotations(field, TransformationsUtil.NON_NULL_PATTERN); List<JCAnnotation> nullables = findAnnotations(field, TransformationsUtil.NULLABLE_PATTERN); @@ -219,7 +219,7 @@ public class HandleWither extends JavacAnnotationHandler<Wither> { JCExpression selfType = cloneSelfType(field); if (selfType == null) return null; - ListBuffer<JCExpression> args = ListBuffer.lb(); + ListBuffer<JCExpression> args = new ListBuffer<JCExpression>(); for (JavacNode child : field.up().down()) { if (child.getKind() != Kind.FIELD) continue; JCVariableDecl childDecl = (JCVariableDecl) child.get(); diff --git a/src/core/lombok/javac/handlers/JavacHandlerUtil.java b/src/core/lombok/javac/handlers/JavacHandlerUtil.java index f25a11c1..f90bb60d 100644 --- a/src/core/lombok/javac/handlers/JavacHandlerUtil.java +++ b/src/core/lombok/javac/handlers/JavacHandlerUtil.java @@ -338,7 +338,7 @@ public class JavacHandlerUtil { public static void deleteImportFromCompilationUnit(JavacNode node, String name) { if (inNetbeansEditor(node)) return; if (!node.shouldDeleteLombokAnnotations()) return; - ListBuffer<JCTree> newDefs = ListBuffer.lb(); + ListBuffer<JCTree> newDefs = new ListBuffer<JCTree>(); JCCompilationUnit unit = (JCCompilationUnit) node.top().get(); @@ -354,7 +354,7 @@ public class JavacHandlerUtil { } private static List<JCAnnotation> filterList(List<JCAnnotation> annotations, JCTree jcTree) { - ListBuffer<JCAnnotation> newAnnotations = ListBuffer.lb(); + ListBuffer<JCAnnotation> newAnnotations = new ListBuffer<JCAnnotation>(); for (JCAnnotation ann : annotations) { if (jcTree != ann) newAnnotations.append(ann); } @@ -437,7 +437,7 @@ public class JavacHandlerUtil { while (typeNode != null && typeNode.getKind() != Kind.TYPE) typeNode = typeNode.up(); if (typeNode != null && typeNode.get() instanceof JCClassDecl) { JCClassDecl type = (JCClassDecl) typeNode.get(); - ListBuffer<JCExpression> typeArgs = ListBuffer.lb(); + ListBuffer<JCExpression> typeArgs = new ListBuffer<JCExpression>(); if (!type.typarams.isEmpty()) { for (JCTypeParameter tp : type.typarams) { typeArgs.append(maker.Ident(tp.name)); @@ -885,7 +885,7 @@ public class JavacHandlerUtil { } private static List<JCTree> addAllButOne(List<JCTree> defs, int idx) { - ListBuffer<JCTree> out = ListBuffer.lb(); + ListBuffer<JCTree> out = new ListBuffer<JCTree>(); int i = 0; for (JCTree def : defs) { if (i++ != idx) out.append(def); @@ -956,7 +956,7 @@ public class JavacHandlerUtil { * Only the simple name is checked - the package and any containing class are ignored. */ public static List<JCAnnotation> findAnnotations(JavacNode fieldNode, Pattern namePattern) { - ListBuffer<JCAnnotation> result = ListBuffer.lb(); + ListBuffer<JCAnnotation> result = new ListBuffer<JCAnnotation>(); for (JavacNode child : fieldNode.down()) { if (child.getKind() == Kind.ANNOTATION) { JCAnnotation annotation = (JCAnnotation) child.get(); @@ -1006,7 +1006,7 @@ public class JavacHandlerUtil { if (idx > -1) matched[idx] = true; } - ListBuffer<Integer> problematic = ListBuffer.lb(); + ListBuffer<Integer> problematic = new ListBuffer<Integer>(); for (int i = 0 ; i < list.size() ; i++) { if (!matched[i]) problematic.append(i); } @@ -1015,8 +1015,8 @@ public class JavacHandlerUtil { } static List<JCAnnotation> unboxAndRemoveAnnotationParameter(JCAnnotation ast, String parameterName, String errorName, JavacNode errorNode) { - ListBuffer<JCExpression> params = ListBuffer.lb(); - ListBuffer<JCAnnotation> result = ListBuffer.lb(); + ListBuffer<JCExpression> params = new ListBuffer<JCExpression>(); + ListBuffer<JCAnnotation> result = new ListBuffer<JCAnnotation>(); errorNode.removeDeferredErrors(); @@ -1086,13 +1086,13 @@ public class JavacHandlerUtil { public static List<JCTypeParameter> copyTypeParams(JavacTreeMaker maker, List<JCTypeParameter> params) { if (params == null || params.isEmpty()) return params; - ListBuffer<JCTypeParameter> out = ListBuffer.lb(); + ListBuffer<JCTypeParameter> out = new ListBuffer<JCTypeParameter>(); for (JCTypeParameter tp : params) out.append(maker.TypeParameter(tp.name, tp.bounds)); return out.toList(); } public static JCExpression namePlusTypeParamsToTypeReference(JavacTreeMaker maker, Name typeName, List<JCTypeParameter> params) { - ListBuffer<JCExpression> typeArgs = ListBuffer.lb(); + ListBuffer<JCExpression> typeArgs = new ListBuffer<JCExpression>(); if (!params.isEmpty()) { for (JCTypeParameter param : params) { @@ -1128,7 +1128,7 @@ public class JavacHandlerUtil { } static List<JCAnnotation> copyAnnotations(List<? extends JCExpression> in) { - ListBuffer<JCAnnotation> out = ListBuffer.lb(); + ListBuffer<JCAnnotation> out = new ListBuffer<JCAnnotation>(); for (JCExpression expr : in) { if (!(expr instanceof JCAnnotation)) continue; out.append((JCAnnotation) expr.clone()); @@ -1197,7 +1197,7 @@ public class JavacHandlerUtil { if (in instanceof JCTypeApply) { JCTypeApply ta = (JCTypeApply) in; - ListBuffer<JCExpression> lb = ListBuffer.lb(); + ListBuffer<JCExpression> lb = new ListBuffer<JCExpression>(); for (JCExpression typeArg : ta.arguments) { lb.append(cloneType0(maker, typeArg)); } |