From e204d072e77cbef5a46ff2bc8c9acfe7bee67371 Mon Sep 17 00:00:00 2001 From: Pavel Vojtechovsky Date: Fri, 13 Oct 2017 11:35:27 +0200 Subject: [PATCH] feat: the cloning behavior can be subclassed (#1580) --- .../generating/CloneVisitorGenerator.java | 4 +- .../clone/CloneVisitorTemplate.java | 6 + .../spoon/support/DefaultCoreFactory.java | 2 +- .../support/compiler/jdt/JDTTreeBuilder.java | 1 - .../reflect/declaration/CtElementImpl.java | 2 +- .../support/visitor/clone/CloneVisitor.java | 649 +++++++++--------- .../support/visitor/equals/CloneHelper.java | 40 +- .../java/spoon/reflect/ast/CloneTest.java | 53 +- 8 files changed, 413 insertions(+), 344 deletions(-) diff --git a/src/main/java/spoon/generating/CloneVisitorGenerator.java b/src/main/java/spoon/generating/CloneVisitorGenerator.java index 152fa542175..109fff93bcb 100644 --- a/src/main/java/spoon/generating/CloneVisitorGenerator.java +++ b/src/main/java/spoon/generating/CloneVisitorGenerator.java @@ -77,6 +77,7 @@ public void process() { final CtTypeReference cloneBuilder = factory.Type().createReference("spoon.support.visitor.clone.CloneBuilder"); final CtTypeAccess cloneBuilderType = factory.Code().createTypeAccess(cloneBuilder); final CtVariableAccess builderFieldAccess = factory.Code().createVariableRead(factory.Field().createReference(target.getReference(), cloneBuilder, "builder"), false); + final CtVariableAccess cloneHelperFieldAccess = factory.Code().createVariableRead(factory.Field().createReference(target.getReference(), cloneBuilder, "cloneHelper"), false); final CtFieldReference other = factory.Field().createReference((CtField) target.getField("other")); final CtVariableAccess otherRead = factory.Code().createVariableRead(other, true); @@ -138,7 +139,7 @@ private CtInvocation createSetter(CtInvocation scanInvocation, CtVariableAcce final CtExecutableReference setterRef = factory.Executable().createReference("void CtElement#set" + getterName.substring(3, getterName.length()) + "()"); final CtExecutableReference cloneRef = factory.Executable().createReference("CtElement spoon.support.visitor.equals.CloneHelper#clone()"); final CtInvocation cloneInv = factory.Code().createInvocation(null, cloneRef, getter); - cloneInv.setTarget(factory.Code().createTypeAccess(factory.Type().createReference("spoon.support.visitor.equals.CloneHelper"))); + cloneInv.setTarget(cloneHelperFieldAccess); return factory.Code().createInvocation(elementVarRead, setterRef, cloneInv); } @@ -515,6 +516,7 @@ public boolean matches(CtTypeReference reference) { reference.setSimpleName(TARGET_CLONE_TYPE); reference.setPackage(aPackage.getReference()); } + target.getConstructors().forEach(c -> c.addModifier(ModifierKind.PUBLIC)); return target; } diff --git a/src/main/java/spoon/generating/clone/CloneVisitorTemplate.java b/src/main/java/spoon/generating/clone/CloneVisitorTemplate.java index 90fe844c499..afd8dba8a63 100644 --- a/src/main/java/spoon/generating/clone/CloneVisitorTemplate.java +++ b/src/main/java/spoon/generating/clone/CloneVisitorTemplate.java @@ -19,6 +19,7 @@ import spoon.reflect.declaration.CtElement; import spoon.reflect.visitor.CtScanner; import spoon.support.visitor.clone.CloneBuilder; +import spoon.support.visitor.equals.CloneHelper; /** * Used to clone a given element. @@ -26,9 +27,14 @@ * This class is generated automatically by the processor {@link spoon.generating.CloneVisitorGenerator}. */ class CloneVisitorTemplate extends CtScanner { + private final CloneHelper cloneHelper; private final CloneBuilder builder = new CloneBuilder(); private CtElement other; + CloneVisitorTemplate(CloneHelper cloneHelper) { + this.cloneHelper = cloneHelper; + } + public T getClone() { return (T) other; } diff --git a/src/main/java/spoon/support/DefaultCoreFactory.java b/src/main/java/spoon/support/DefaultCoreFactory.java index 63c922b3578..031ae23bac1 100644 --- a/src/main/java/spoon/support/DefaultCoreFactory.java +++ b/src/main/java/spoon/support/DefaultCoreFactory.java @@ -196,7 +196,7 @@ public DefaultCoreFactory() { } public T clone(T object) { - return CloneHelper.clone(object); + return CloneHelper.INSTANCE.clone(object); } public CtAnnotation createAnnotation() { diff --git a/src/main/java/spoon/support/compiler/jdt/JDTTreeBuilder.java b/src/main/java/spoon/support/compiler/jdt/JDTTreeBuilder.java index f1e819ecbb8..64885b43d83 100644 --- a/src/main/java/spoon/support/compiler/jdt/JDTTreeBuilder.java +++ b/src/main/java/spoon/support/compiler/jdt/JDTTreeBuilder.java @@ -1026,7 +1026,6 @@ public boolean visit(ExplicitConstructorCall explicitConstructor, BlockScope sco inv.setExecutable(references.getExecutableReference(explicitConstructor.binding)); CtTypeReference declaringType = inv.getExecutable().getDeclaringType(); inv.getExecutable().setType(declaringType == null ? null : (CtTypeReference) declaringType.clone()); - context.enter(inv, explicitConstructor); return true; } diff --git a/src/main/java/spoon/support/reflect/declaration/CtElementImpl.java b/src/main/java/spoon/support/reflect/declaration/CtElementImpl.java index e687ebb673b..a9276cda314 100644 --- a/src/main/java/spoon/support/reflect/declaration/CtElementImpl.java +++ b/src/main/java/spoon/support/reflect/declaration/CtElementImpl.java @@ -476,6 +476,6 @@ public E setComments(List comments) { @Override public CtElement clone() { - return CloneHelper.clone(this); + return CloneHelper.INSTANCE.clone(this); } } diff --git a/src/main/java/spoon/support/visitor/clone/CloneVisitor.java b/src/main/java/spoon/support/visitor/clone/CloneVisitor.java index 3b536319540..a483e0ef9af 100644 --- a/src/main/java/spoon/support/visitor/clone/CloneVisitor.java +++ b/src/main/java/spoon/support/visitor/clone/CloneVisitor.java @@ -14,7 +14,6 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ - package spoon.support.visitor.clone; @@ -24,10 +23,16 @@ * This class is generated automatically by the processor {@link spoon.generating.CloneVisitorGenerator}. */ public class CloneVisitor extends spoon.reflect.visitor.CtScanner { + private final spoon.support.visitor.equals.CloneHelper cloneHelper; + private final spoon.support.visitor.clone.CloneBuilder builder = new spoon.support.visitor.clone.CloneBuilder(); private spoon.reflect.declaration.CtElement other; + public CloneVisitor(spoon.support.visitor.equals.CloneHelper cloneHelper) { + this.cloneHelper = cloneHelper; + } + public T getClone() { return ((T) (other)); } @@ -35,29 +40,29 @@ public T getClone() { // auto-generated, see spoon.generating.CloneVisitorGenerator public void visitCtAnnotation(final spoon.reflect.declaration.CtAnnotation annotation) { spoon.reflect.declaration.CtAnnotation aCtAnnotation = spoon.support.visitor.clone.CloneBuilder.build(this.builder, annotation, annotation.getFactory().Core().createAnnotation()); - aCtAnnotation.setType(spoon.support.visitor.equals.CloneHelper.clone(annotation.getType())); - aCtAnnotation.setComments(spoon.support.visitor.equals.CloneHelper.clone(annotation.getComments())); - aCtAnnotation.setAnnotationType(spoon.support.visitor.equals.CloneHelper.clone(annotation.getAnnotationType())); - aCtAnnotation.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(annotation.getAnnotations())); - aCtAnnotation.setValues(spoon.support.visitor.equals.CloneHelper.clone(annotation.getValues())); + aCtAnnotation.setType(this.cloneHelper.clone(annotation.getType())); + aCtAnnotation.setComments(this.cloneHelper.clone(annotation.getComments())); + aCtAnnotation.setAnnotationType(this.cloneHelper.clone(annotation.getAnnotationType())); + aCtAnnotation.setAnnotations(this.cloneHelper.clone(annotation.getAnnotations())); + aCtAnnotation.setValues(this.cloneHelper.clone(annotation.getValues())); this.other = aCtAnnotation; } // auto-generated, see spoon.generating.CloneVisitorGenerator public void visitCtAnnotationType(final spoon.reflect.declaration.CtAnnotationType annotationType) { spoon.reflect.declaration.CtAnnotationType aCtAnnotationType = spoon.support.visitor.clone.CloneBuilder.build(this.builder, annotationType, annotationType.getFactory().Core().createAnnotationType()); - aCtAnnotationType.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(annotationType.getAnnotations())); - aCtAnnotationType.setTypeMembers(spoon.support.visitor.equals.CloneHelper.clone(annotationType.getTypeMembers())); - aCtAnnotationType.setComments(spoon.support.visitor.equals.CloneHelper.clone(annotationType.getComments())); + aCtAnnotationType.setAnnotations(this.cloneHelper.clone(annotationType.getAnnotations())); + aCtAnnotationType.setTypeMembers(this.cloneHelper.clone(annotationType.getTypeMembers())); + aCtAnnotationType.setComments(this.cloneHelper.clone(annotationType.getComments())); this.other = aCtAnnotationType; } // auto-generated, see spoon.generating.CloneVisitorGenerator public void visitCtAnonymousExecutable(final spoon.reflect.declaration.CtAnonymousExecutable anonymousExec) { spoon.reflect.declaration.CtAnonymousExecutable aCtAnonymousExecutable = spoon.support.visitor.clone.CloneBuilder.build(this.builder, anonymousExec, anonymousExec.getFactory().Core().createAnonymousExecutable()); - aCtAnonymousExecutable.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(anonymousExec.getAnnotations())); - aCtAnonymousExecutable.setBody(spoon.support.visitor.equals.CloneHelper.clone(anonymousExec.getBody())); - aCtAnonymousExecutable.setComments(spoon.support.visitor.equals.CloneHelper.clone(anonymousExec.getComments())); + aCtAnonymousExecutable.setAnnotations(this.cloneHelper.clone(anonymousExec.getAnnotations())); + aCtAnonymousExecutable.setBody(this.cloneHelper.clone(anonymousExec.getBody())); + aCtAnonymousExecutable.setComments(this.cloneHelper.clone(anonymousExec.getComments())); this.other = aCtAnonymousExecutable; } @@ -65,12 +70,12 @@ public void visitCtAnonymousExecutable(final spoon.reflect.declaration.CtAnonymo @java.lang.Override public void visitCtArrayRead(final spoon.reflect.code.CtArrayRead arrayRead) { spoon.reflect.code.CtArrayRead aCtArrayRead = spoon.support.visitor.clone.CloneBuilder.build(this.builder, arrayRead, arrayRead.getFactory().Core().createArrayRead()); - aCtArrayRead.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(arrayRead.getAnnotations())); - aCtArrayRead.setType(spoon.support.visitor.equals.CloneHelper.clone(arrayRead.getType())); - aCtArrayRead.setTypeCasts(spoon.support.visitor.equals.CloneHelper.clone(arrayRead.getTypeCasts())); - aCtArrayRead.setTarget(spoon.support.visitor.equals.CloneHelper.clone(arrayRead.getTarget())); - aCtArrayRead.setIndexExpression(spoon.support.visitor.equals.CloneHelper.clone(arrayRead.getIndexExpression())); - aCtArrayRead.setComments(spoon.support.visitor.equals.CloneHelper.clone(arrayRead.getComments())); + aCtArrayRead.setAnnotations(this.cloneHelper.clone(arrayRead.getAnnotations())); + aCtArrayRead.setType(this.cloneHelper.clone(arrayRead.getType())); + aCtArrayRead.setTypeCasts(this.cloneHelper.clone(arrayRead.getTypeCasts())); + aCtArrayRead.setTarget(this.cloneHelper.clone(arrayRead.getTarget())); + aCtArrayRead.setIndexExpression(this.cloneHelper.clone(arrayRead.getIndexExpression())); + aCtArrayRead.setComments(this.cloneHelper.clone(arrayRead.getComments())); this.other = aCtArrayRead; } @@ -78,107 +83,107 @@ public void visitCtArrayRead(final spoon.reflect.code.CtArrayRead arrayRe @java.lang.Override public void visitCtArrayWrite(final spoon.reflect.code.CtArrayWrite arrayWrite) { spoon.reflect.code.CtArrayWrite aCtArrayWrite = spoon.support.visitor.clone.CloneBuilder.build(this.builder, arrayWrite, arrayWrite.getFactory().Core().createArrayWrite()); - aCtArrayWrite.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(arrayWrite.getAnnotations())); - aCtArrayWrite.setType(spoon.support.visitor.equals.CloneHelper.clone(arrayWrite.getType())); - aCtArrayWrite.setTypeCasts(spoon.support.visitor.equals.CloneHelper.clone(arrayWrite.getTypeCasts())); - aCtArrayWrite.setTarget(spoon.support.visitor.equals.CloneHelper.clone(arrayWrite.getTarget())); - aCtArrayWrite.setIndexExpression(spoon.support.visitor.equals.CloneHelper.clone(arrayWrite.getIndexExpression())); - aCtArrayWrite.setComments(spoon.support.visitor.equals.CloneHelper.clone(arrayWrite.getComments())); + aCtArrayWrite.setAnnotations(this.cloneHelper.clone(arrayWrite.getAnnotations())); + aCtArrayWrite.setType(this.cloneHelper.clone(arrayWrite.getType())); + aCtArrayWrite.setTypeCasts(this.cloneHelper.clone(arrayWrite.getTypeCasts())); + aCtArrayWrite.setTarget(this.cloneHelper.clone(arrayWrite.getTarget())); + aCtArrayWrite.setIndexExpression(this.cloneHelper.clone(arrayWrite.getIndexExpression())); + aCtArrayWrite.setComments(this.cloneHelper.clone(arrayWrite.getComments())); this.other = aCtArrayWrite; } // auto-generated, see spoon.generating.CloneVisitorGenerator public void visitCtArrayTypeReference(final spoon.reflect.reference.CtArrayTypeReference reference) { spoon.reflect.reference.CtArrayTypeReference aCtArrayTypeReference = spoon.support.visitor.clone.CloneBuilder.build(this.builder, reference, reference.getFactory().Core().createArrayTypeReference()); - aCtArrayTypeReference.setComments(spoon.support.visitor.equals.CloneHelper.clone(reference.getComments())); - aCtArrayTypeReference.setPackage(spoon.support.visitor.equals.CloneHelper.clone(reference.getPackage())); - aCtArrayTypeReference.setDeclaringType(spoon.support.visitor.equals.CloneHelper.clone(reference.getDeclaringType())); - aCtArrayTypeReference.setComponentType(spoon.support.visitor.equals.CloneHelper.clone(reference.getComponentType())); - aCtArrayTypeReference.setActualTypeArguments(spoon.support.visitor.equals.CloneHelper.clone(reference.getActualTypeArguments())); - aCtArrayTypeReference.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(reference.getAnnotations())); + aCtArrayTypeReference.setComments(this.cloneHelper.clone(reference.getComments())); + aCtArrayTypeReference.setPackage(this.cloneHelper.clone(reference.getPackage())); + aCtArrayTypeReference.setDeclaringType(this.cloneHelper.clone(reference.getDeclaringType())); + aCtArrayTypeReference.setComponentType(this.cloneHelper.clone(reference.getComponentType())); + aCtArrayTypeReference.setActualTypeArguments(this.cloneHelper.clone(reference.getActualTypeArguments())); + aCtArrayTypeReference.setAnnotations(this.cloneHelper.clone(reference.getAnnotations())); this.other = aCtArrayTypeReference; } // auto-generated, see spoon.generating.CloneVisitorGenerator public void visitCtAssert(final spoon.reflect.code.CtAssert asserted) { spoon.reflect.code.CtAssert aCtAssert = spoon.support.visitor.clone.CloneBuilder.build(this.builder, asserted, asserted.getFactory().Core().createAssert()); - aCtAssert.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(asserted.getAnnotations())); - aCtAssert.setAssertExpression(spoon.support.visitor.equals.CloneHelper.clone(asserted.getAssertExpression())); - aCtAssert.setExpression(spoon.support.visitor.equals.CloneHelper.clone(asserted.getExpression())); - aCtAssert.setComments(spoon.support.visitor.equals.CloneHelper.clone(asserted.getComments())); + aCtAssert.setAnnotations(this.cloneHelper.clone(asserted.getAnnotations())); + aCtAssert.setAssertExpression(this.cloneHelper.clone(asserted.getAssertExpression())); + aCtAssert.setExpression(this.cloneHelper.clone(asserted.getExpression())); + aCtAssert.setComments(this.cloneHelper.clone(asserted.getComments())); this.other = aCtAssert; } // auto-generated, see spoon.generating.CloneVisitorGenerator public void visitCtAssignment(final spoon.reflect.code.CtAssignment assignement) { spoon.reflect.code.CtAssignment aCtAssignment = spoon.support.visitor.clone.CloneBuilder.build(this.builder, assignement, assignement.getFactory().Core().createAssignment()); - aCtAssignment.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(assignement.getAnnotations())); - aCtAssignment.setType(spoon.support.visitor.equals.CloneHelper.clone(assignement.getType())); - aCtAssignment.setTypeCasts(spoon.support.visitor.equals.CloneHelper.clone(assignement.getTypeCasts())); - aCtAssignment.setAssigned(spoon.support.visitor.equals.CloneHelper.clone(assignement.getAssigned())); - aCtAssignment.setAssignment(spoon.support.visitor.equals.CloneHelper.clone(assignement.getAssignment())); - aCtAssignment.setComments(spoon.support.visitor.equals.CloneHelper.clone(assignement.getComments())); + aCtAssignment.setAnnotations(this.cloneHelper.clone(assignement.getAnnotations())); + aCtAssignment.setType(this.cloneHelper.clone(assignement.getType())); + aCtAssignment.setTypeCasts(this.cloneHelper.clone(assignement.getTypeCasts())); + aCtAssignment.setAssigned(this.cloneHelper.clone(assignement.getAssigned())); + aCtAssignment.setAssignment(this.cloneHelper.clone(assignement.getAssignment())); + aCtAssignment.setComments(this.cloneHelper.clone(assignement.getComments())); this.other = aCtAssignment; } // auto-generated, see spoon.generating.CloneVisitorGenerator public void visitCtBinaryOperator(final spoon.reflect.code.CtBinaryOperator operator) { spoon.reflect.code.CtBinaryOperator aCtBinaryOperator = spoon.support.visitor.clone.CloneBuilder.build(this.builder, operator, operator.getFactory().Core().createBinaryOperator()); - aCtBinaryOperator.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(operator.getAnnotations())); - aCtBinaryOperator.setType(spoon.support.visitor.equals.CloneHelper.clone(operator.getType())); - aCtBinaryOperator.setTypeCasts(spoon.support.visitor.equals.CloneHelper.clone(operator.getTypeCasts())); - aCtBinaryOperator.setLeftHandOperand(spoon.support.visitor.equals.CloneHelper.clone(operator.getLeftHandOperand())); - aCtBinaryOperator.setRightHandOperand(spoon.support.visitor.equals.CloneHelper.clone(operator.getRightHandOperand())); - aCtBinaryOperator.setComments(spoon.support.visitor.equals.CloneHelper.clone(operator.getComments())); + aCtBinaryOperator.setAnnotations(this.cloneHelper.clone(operator.getAnnotations())); + aCtBinaryOperator.setType(this.cloneHelper.clone(operator.getType())); + aCtBinaryOperator.setTypeCasts(this.cloneHelper.clone(operator.getTypeCasts())); + aCtBinaryOperator.setLeftHandOperand(this.cloneHelper.clone(operator.getLeftHandOperand())); + aCtBinaryOperator.setRightHandOperand(this.cloneHelper.clone(operator.getRightHandOperand())); + aCtBinaryOperator.setComments(this.cloneHelper.clone(operator.getComments())); this.other = aCtBinaryOperator; } // auto-generated, see spoon.generating.CloneVisitorGenerator public void visitCtBlock(final spoon.reflect.code.CtBlock block) { spoon.reflect.code.CtBlock aCtBlock = spoon.support.visitor.clone.CloneBuilder.build(this.builder, block, block.getFactory().Core().createBlock()); - aCtBlock.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(block.getAnnotations())); - aCtBlock.setStatements(spoon.support.visitor.equals.CloneHelper.clone(block.getStatements())); - aCtBlock.setComments(spoon.support.visitor.equals.CloneHelper.clone(block.getComments())); + aCtBlock.setAnnotations(this.cloneHelper.clone(block.getAnnotations())); + aCtBlock.setStatements(this.cloneHelper.clone(block.getStatements())); + aCtBlock.setComments(this.cloneHelper.clone(block.getComments())); this.other = aCtBlock; } // auto-generated, see spoon.generating.CloneVisitorGenerator public void visitCtBreak(final spoon.reflect.code.CtBreak breakStatement) { spoon.reflect.code.CtBreak aCtBreak = spoon.support.visitor.clone.CloneBuilder.build(this.builder, breakStatement, breakStatement.getFactory().Core().createBreak()); - aCtBreak.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(breakStatement.getAnnotations())); - aCtBreak.setComments(spoon.support.visitor.equals.CloneHelper.clone(breakStatement.getComments())); + aCtBreak.setAnnotations(this.cloneHelper.clone(breakStatement.getAnnotations())); + aCtBreak.setComments(this.cloneHelper.clone(breakStatement.getComments())); this.other = aCtBreak; } // auto-generated, see spoon.generating.CloneVisitorGenerator public void visitCtCase(final spoon.reflect.code.CtCase caseStatement) { spoon.reflect.code.CtCase aCtCase = spoon.support.visitor.clone.CloneBuilder.build(this.builder, caseStatement, caseStatement.getFactory().Core().createCase()); - aCtCase.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(caseStatement.getAnnotations())); - aCtCase.setCaseExpression(spoon.support.visitor.equals.CloneHelper.clone(caseStatement.getCaseExpression())); - aCtCase.setStatements(spoon.support.visitor.equals.CloneHelper.clone(caseStatement.getStatements())); - aCtCase.setComments(spoon.support.visitor.equals.CloneHelper.clone(caseStatement.getComments())); + aCtCase.setAnnotations(this.cloneHelper.clone(caseStatement.getAnnotations())); + aCtCase.setCaseExpression(this.cloneHelper.clone(caseStatement.getCaseExpression())); + aCtCase.setStatements(this.cloneHelper.clone(caseStatement.getStatements())); + aCtCase.setComments(this.cloneHelper.clone(caseStatement.getComments())); this.other = aCtCase; } // auto-generated, see spoon.generating.CloneVisitorGenerator public void visitCtCatch(final spoon.reflect.code.CtCatch catchBlock) { spoon.reflect.code.CtCatch aCtCatch = spoon.support.visitor.clone.CloneBuilder.build(this.builder, catchBlock, catchBlock.getFactory().Core().createCatch()); - aCtCatch.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(catchBlock.getAnnotations())); - aCtCatch.setParameter(spoon.support.visitor.equals.CloneHelper.clone(catchBlock.getParameter())); - aCtCatch.setBody(spoon.support.visitor.equals.CloneHelper.clone(catchBlock.getBody())); - aCtCatch.setComments(spoon.support.visitor.equals.CloneHelper.clone(catchBlock.getComments())); + aCtCatch.setAnnotations(this.cloneHelper.clone(catchBlock.getAnnotations())); + aCtCatch.setParameter(this.cloneHelper.clone(catchBlock.getParameter())); + aCtCatch.setBody(this.cloneHelper.clone(catchBlock.getBody())); + aCtCatch.setComments(this.cloneHelper.clone(catchBlock.getComments())); this.other = aCtCatch; } // auto-generated, see spoon.generating.CloneVisitorGenerator public void visitCtClass(final spoon.reflect.declaration.CtClass ctClass) { spoon.reflect.declaration.CtClass aCtClass = spoon.support.visitor.clone.CloneBuilder.build(this.builder, ctClass, ctClass.getFactory().Core().createClass()); - aCtClass.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(ctClass.getAnnotations())); - aCtClass.setSuperclass(spoon.support.visitor.equals.CloneHelper.clone(ctClass.getSuperclass())); - aCtClass.setSuperInterfaces(spoon.support.visitor.equals.CloneHelper.clone(ctClass.getSuperInterfaces())); - aCtClass.setFormalCtTypeParameters(spoon.support.visitor.equals.CloneHelper.clone(ctClass.getFormalCtTypeParameters())); - aCtClass.setTypeMembers(spoon.support.visitor.equals.CloneHelper.clone(ctClass.getTypeMembers())); - aCtClass.setComments(spoon.support.visitor.equals.CloneHelper.clone(ctClass.getComments())); + aCtClass.setAnnotations(this.cloneHelper.clone(ctClass.getAnnotations())); + aCtClass.setSuperclass(this.cloneHelper.clone(ctClass.getSuperclass())); + aCtClass.setSuperInterfaces(this.cloneHelper.clone(ctClass.getSuperInterfaces())); + aCtClass.setFormalCtTypeParameters(this.cloneHelper.clone(ctClass.getFormalCtTypeParameters())); + aCtClass.setTypeMembers(this.cloneHelper.clone(ctClass.getTypeMembers())); + aCtClass.setComments(this.cloneHelper.clone(ctClass.getComments())); this.other = aCtClass; } @@ -186,85 +191,85 @@ public void visitCtClass(final spoon.reflect.declaration.CtClass ctClass) @java.lang.Override public void visitCtTypeParameter(spoon.reflect.declaration.CtTypeParameter typeParameter) { spoon.reflect.declaration.CtTypeParameter aCtTypeParameter = spoon.support.visitor.clone.CloneBuilder.build(this.builder, typeParameter, typeParameter.getFactory().Core().createTypeParameter()); - aCtTypeParameter.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(typeParameter.getAnnotations())); - aCtTypeParameter.setSuperclass(spoon.support.visitor.equals.CloneHelper.clone(typeParameter.getSuperclass())); - aCtTypeParameter.setComments(spoon.support.visitor.equals.CloneHelper.clone(typeParameter.getComments())); + aCtTypeParameter.setAnnotations(this.cloneHelper.clone(typeParameter.getAnnotations())); + aCtTypeParameter.setSuperclass(this.cloneHelper.clone(typeParameter.getSuperclass())); + aCtTypeParameter.setComments(this.cloneHelper.clone(typeParameter.getComments())); this.other = aCtTypeParameter; } // auto-generated, see spoon.generating.CloneVisitorGenerator public void visitCtConditional(final spoon.reflect.code.CtConditional conditional) { spoon.reflect.code.CtConditional aCtConditional = spoon.support.visitor.clone.CloneBuilder.build(this.builder, conditional, conditional.getFactory().Core().createConditional()); - aCtConditional.setType(spoon.support.visitor.equals.CloneHelper.clone(conditional.getType())); - aCtConditional.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(conditional.getAnnotations())); - aCtConditional.setCondition(spoon.support.visitor.equals.CloneHelper.clone(conditional.getCondition())); - aCtConditional.setThenExpression(spoon.support.visitor.equals.CloneHelper.clone(conditional.getThenExpression())); - aCtConditional.setElseExpression(spoon.support.visitor.equals.CloneHelper.clone(conditional.getElseExpression())); - aCtConditional.setComments(spoon.support.visitor.equals.CloneHelper.clone(conditional.getComments())); - aCtConditional.setTypeCasts(spoon.support.visitor.equals.CloneHelper.clone(conditional.getTypeCasts())); + aCtConditional.setType(this.cloneHelper.clone(conditional.getType())); + aCtConditional.setAnnotations(this.cloneHelper.clone(conditional.getAnnotations())); + aCtConditional.setCondition(this.cloneHelper.clone(conditional.getCondition())); + aCtConditional.setThenExpression(this.cloneHelper.clone(conditional.getThenExpression())); + aCtConditional.setElseExpression(this.cloneHelper.clone(conditional.getElseExpression())); + aCtConditional.setComments(this.cloneHelper.clone(conditional.getComments())); + aCtConditional.setTypeCasts(this.cloneHelper.clone(conditional.getTypeCasts())); this.other = aCtConditional; } // auto-generated, see spoon.generating.CloneVisitorGenerator public void visitCtConstructor(final spoon.reflect.declaration.CtConstructor c) { spoon.reflect.declaration.CtConstructor aCtConstructor = spoon.support.visitor.clone.CloneBuilder.build(this.builder, c, c.getFactory().Core().createConstructor()); - aCtConstructor.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(c.getAnnotations())); - aCtConstructor.setParameters(spoon.support.visitor.equals.CloneHelper.clone(c.getParameters())); - aCtConstructor.setThrownTypes(spoon.support.visitor.equals.CloneHelper.clone(c.getThrownTypes())); - aCtConstructor.setFormalCtTypeParameters(spoon.support.visitor.equals.CloneHelper.clone(c.getFormalCtTypeParameters())); - aCtConstructor.setBody(spoon.support.visitor.equals.CloneHelper.clone(c.getBody())); - aCtConstructor.setComments(spoon.support.visitor.equals.CloneHelper.clone(c.getComments())); + aCtConstructor.setAnnotations(this.cloneHelper.clone(c.getAnnotations())); + aCtConstructor.setParameters(this.cloneHelper.clone(c.getParameters())); + aCtConstructor.setThrownTypes(this.cloneHelper.clone(c.getThrownTypes())); + aCtConstructor.setFormalCtTypeParameters(this.cloneHelper.clone(c.getFormalCtTypeParameters())); + aCtConstructor.setBody(this.cloneHelper.clone(c.getBody())); + aCtConstructor.setComments(this.cloneHelper.clone(c.getComments())); this.other = aCtConstructor; } // auto-generated, see spoon.generating.CloneVisitorGenerator public void visitCtContinue(final spoon.reflect.code.CtContinue continueStatement) { spoon.reflect.code.CtContinue aCtContinue = spoon.support.visitor.clone.CloneBuilder.build(this.builder, continueStatement, continueStatement.getFactory().Core().createContinue()); - aCtContinue.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(continueStatement.getAnnotations())); - aCtContinue.setComments(spoon.support.visitor.equals.CloneHelper.clone(continueStatement.getComments())); + aCtContinue.setAnnotations(this.cloneHelper.clone(continueStatement.getAnnotations())); + aCtContinue.setComments(this.cloneHelper.clone(continueStatement.getComments())); this.other = aCtContinue; } // auto-generated, see spoon.generating.CloneVisitorGenerator public void visitCtDo(final spoon.reflect.code.CtDo doLoop) { spoon.reflect.code.CtDo aCtDo = spoon.support.visitor.clone.CloneBuilder.build(this.builder, doLoop, doLoop.getFactory().Core().createDo()); - aCtDo.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(doLoop.getAnnotations())); - aCtDo.setLoopingExpression(spoon.support.visitor.equals.CloneHelper.clone(doLoop.getLoopingExpression())); - aCtDo.setBody(spoon.support.visitor.equals.CloneHelper.clone(doLoop.getBody())); - aCtDo.setComments(spoon.support.visitor.equals.CloneHelper.clone(doLoop.getComments())); + aCtDo.setAnnotations(this.cloneHelper.clone(doLoop.getAnnotations())); + aCtDo.setLoopingExpression(this.cloneHelper.clone(doLoop.getLoopingExpression())); + aCtDo.setBody(this.cloneHelper.clone(doLoop.getBody())); + aCtDo.setComments(this.cloneHelper.clone(doLoop.getComments())); this.other = aCtDo; } // auto-generated, see spoon.generating.CloneVisitorGenerator public > void visitCtEnum(final spoon.reflect.declaration.CtEnum ctEnum) { spoon.reflect.declaration.CtEnum aCtEnum = spoon.support.visitor.clone.CloneBuilder.build(this.builder, ctEnum, ctEnum.getFactory().Core().createEnum()); - aCtEnum.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(ctEnum.getAnnotations())); - aCtEnum.setSuperInterfaces(spoon.support.visitor.equals.CloneHelper.clone(ctEnum.getSuperInterfaces())); - aCtEnum.setTypeMembers(spoon.support.visitor.equals.CloneHelper.clone(ctEnum.getTypeMembers())); - aCtEnum.setEnumValues(spoon.support.visitor.equals.CloneHelper.clone(ctEnum.getEnumValues())); - aCtEnum.setComments(spoon.support.visitor.equals.CloneHelper.clone(ctEnum.getComments())); + aCtEnum.setAnnotations(this.cloneHelper.clone(ctEnum.getAnnotations())); + aCtEnum.setSuperInterfaces(this.cloneHelper.clone(ctEnum.getSuperInterfaces())); + aCtEnum.setTypeMembers(this.cloneHelper.clone(ctEnum.getTypeMembers())); + aCtEnum.setEnumValues(this.cloneHelper.clone(ctEnum.getEnumValues())); + aCtEnum.setComments(this.cloneHelper.clone(ctEnum.getComments())); this.other = aCtEnum; } // auto-generated, see spoon.generating.CloneVisitorGenerator public void visitCtExecutableReference(final spoon.reflect.reference.CtExecutableReference reference) { spoon.reflect.reference.CtExecutableReference aCtExecutableReference = spoon.support.visitor.clone.CloneBuilder.build(this.builder, reference, reference.getFactory().Core().createExecutableReference()); - aCtExecutableReference.setDeclaringType(spoon.support.visitor.equals.CloneHelper.clone(reference.getDeclaringType())); - aCtExecutableReference.setType(spoon.support.visitor.equals.CloneHelper.clone(reference.getType())); - aCtExecutableReference.setParameters(spoon.support.visitor.equals.CloneHelper.clone(reference.getParameters())); - aCtExecutableReference.setActualTypeArguments(spoon.support.visitor.equals.CloneHelper.clone(reference.getActualTypeArguments())); - aCtExecutableReference.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(reference.getAnnotations())); - aCtExecutableReference.setComments(spoon.support.visitor.equals.CloneHelper.clone(reference.getComments())); + aCtExecutableReference.setDeclaringType(this.cloneHelper.clone(reference.getDeclaringType())); + aCtExecutableReference.setType(this.cloneHelper.clone(reference.getType())); + aCtExecutableReference.setParameters(this.cloneHelper.clone(reference.getParameters())); + aCtExecutableReference.setActualTypeArguments(this.cloneHelper.clone(reference.getActualTypeArguments())); + aCtExecutableReference.setAnnotations(this.cloneHelper.clone(reference.getAnnotations())); + aCtExecutableReference.setComments(this.cloneHelper.clone(reference.getComments())); this.other = aCtExecutableReference; } // auto-generated, see spoon.generating.CloneVisitorGenerator public void visitCtField(final spoon.reflect.declaration.CtField f) { spoon.reflect.declaration.CtField aCtField = spoon.support.visitor.clone.CloneBuilder.build(this.builder, f, f.getFactory().Core().createField()); - aCtField.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(f.getAnnotations())); - aCtField.setType(spoon.support.visitor.equals.CloneHelper.clone(f.getType())); - aCtField.setDefaultExpression(spoon.support.visitor.equals.CloneHelper.clone(f.getDefaultExpression())); - aCtField.setComments(spoon.support.visitor.equals.CloneHelper.clone(f.getComments())); + aCtField.setAnnotations(this.cloneHelper.clone(f.getAnnotations())); + aCtField.setType(this.cloneHelper.clone(f.getType())); + aCtField.setDefaultExpression(this.cloneHelper.clone(f.getDefaultExpression())); + aCtField.setComments(this.cloneHelper.clone(f.getComments())); this.other = aCtField; } @@ -272,10 +277,10 @@ public void visitCtField(final spoon.reflect.declaration.CtField f) { @java.lang.Override public void visitCtEnumValue(final spoon.reflect.declaration.CtEnumValue enumValue) { spoon.reflect.declaration.CtEnumValue aCtEnumValue = spoon.support.visitor.clone.CloneBuilder.build(this.builder, enumValue, enumValue.getFactory().Core().createEnumValue()); - aCtEnumValue.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(enumValue.getAnnotations())); - aCtEnumValue.setType(spoon.support.visitor.equals.CloneHelper.clone(enumValue.getType())); - aCtEnumValue.setDefaultExpression(spoon.support.visitor.equals.CloneHelper.clone(enumValue.getDefaultExpression())); - aCtEnumValue.setComments(spoon.support.visitor.equals.CloneHelper.clone(enumValue.getComments())); + aCtEnumValue.setAnnotations(this.cloneHelper.clone(enumValue.getAnnotations())); + aCtEnumValue.setType(this.cloneHelper.clone(enumValue.getType())); + aCtEnumValue.setDefaultExpression(this.cloneHelper.clone(enumValue.getDefaultExpression())); + aCtEnumValue.setComments(this.cloneHelper.clone(enumValue.getComments())); this.other = aCtEnumValue; } @@ -283,150 +288,150 @@ public void visitCtEnumValue(final spoon.reflect.declaration.CtEnumValue @java.lang.Override public void visitCtThisAccess(final spoon.reflect.code.CtThisAccess thisAccess) { spoon.reflect.code.CtThisAccess aCtThisAccess = spoon.support.visitor.clone.CloneBuilder.build(this.builder, thisAccess, thisAccess.getFactory().Core().createThisAccess()); - aCtThisAccess.setComments(spoon.support.visitor.equals.CloneHelper.clone(thisAccess.getComments())); - aCtThisAccess.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(thisAccess.getAnnotations())); - aCtThisAccess.setType(spoon.support.visitor.equals.CloneHelper.clone(thisAccess.getType())); - aCtThisAccess.setTypeCasts(spoon.support.visitor.equals.CloneHelper.clone(thisAccess.getTypeCasts())); - aCtThisAccess.setTarget(spoon.support.visitor.equals.CloneHelper.clone(thisAccess.getTarget())); + aCtThisAccess.setComments(this.cloneHelper.clone(thisAccess.getComments())); + aCtThisAccess.setAnnotations(this.cloneHelper.clone(thisAccess.getAnnotations())); + aCtThisAccess.setType(this.cloneHelper.clone(thisAccess.getType())); + aCtThisAccess.setTypeCasts(this.cloneHelper.clone(thisAccess.getTypeCasts())); + aCtThisAccess.setTarget(this.cloneHelper.clone(thisAccess.getTarget())); this.other = aCtThisAccess; } // auto-generated, see spoon.generating.CloneVisitorGenerator public void visitCtAnnotationFieldAccess(final spoon.reflect.code.CtAnnotationFieldAccess annotationFieldAccess) { spoon.reflect.code.CtAnnotationFieldAccess aCtAnnotationFieldAccess = spoon.support.visitor.clone.CloneBuilder.build(this.builder, annotationFieldAccess, annotationFieldAccess.getFactory().Core().createAnnotationFieldAccess()); - aCtAnnotationFieldAccess.setComments(spoon.support.visitor.equals.CloneHelper.clone(annotationFieldAccess.getComments())); - aCtAnnotationFieldAccess.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(annotationFieldAccess.getAnnotations())); - aCtAnnotationFieldAccess.setTypeCasts(spoon.support.visitor.equals.CloneHelper.clone(annotationFieldAccess.getTypeCasts())); - aCtAnnotationFieldAccess.setTarget(spoon.support.visitor.equals.CloneHelper.clone(annotationFieldAccess.getTarget())); - aCtAnnotationFieldAccess.setType(spoon.support.visitor.equals.CloneHelper.clone(annotationFieldAccess.getType())); - aCtAnnotationFieldAccess.setVariable(spoon.support.visitor.equals.CloneHelper.clone(annotationFieldAccess.getVariable())); + aCtAnnotationFieldAccess.setComments(this.cloneHelper.clone(annotationFieldAccess.getComments())); + aCtAnnotationFieldAccess.setAnnotations(this.cloneHelper.clone(annotationFieldAccess.getAnnotations())); + aCtAnnotationFieldAccess.setTypeCasts(this.cloneHelper.clone(annotationFieldAccess.getTypeCasts())); + aCtAnnotationFieldAccess.setTarget(this.cloneHelper.clone(annotationFieldAccess.getTarget())); + aCtAnnotationFieldAccess.setType(this.cloneHelper.clone(annotationFieldAccess.getType())); + aCtAnnotationFieldAccess.setVariable(this.cloneHelper.clone(annotationFieldAccess.getVariable())); this.other = aCtAnnotationFieldAccess; } // auto-generated, see spoon.generating.CloneVisitorGenerator public void visitCtFieldReference(final spoon.reflect.reference.CtFieldReference reference) { spoon.reflect.reference.CtFieldReference aCtFieldReference = spoon.support.visitor.clone.CloneBuilder.build(this.builder, reference, reference.getFactory().Core().createFieldReference()); - aCtFieldReference.setDeclaringType(spoon.support.visitor.equals.CloneHelper.clone(reference.getDeclaringType())); - aCtFieldReference.setType(spoon.support.visitor.equals.CloneHelper.clone(reference.getType())); - aCtFieldReference.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(reference.getAnnotations())); + aCtFieldReference.setDeclaringType(this.cloneHelper.clone(reference.getDeclaringType())); + aCtFieldReference.setType(this.cloneHelper.clone(reference.getType())); + aCtFieldReference.setAnnotations(this.cloneHelper.clone(reference.getAnnotations())); this.other = aCtFieldReference; } // auto-generated, see spoon.generating.CloneVisitorGenerator public void visitCtFor(final spoon.reflect.code.CtFor forLoop) { spoon.reflect.code.CtFor aCtFor = spoon.support.visitor.clone.CloneBuilder.build(this.builder, forLoop, forLoop.getFactory().Core().createFor()); - aCtFor.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(forLoop.getAnnotations())); - aCtFor.setForInit(spoon.support.visitor.equals.CloneHelper.clone(forLoop.getForInit())); - aCtFor.setExpression(spoon.support.visitor.equals.CloneHelper.clone(forLoop.getExpression())); - aCtFor.setForUpdate(spoon.support.visitor.equals.CloneHelper.clone(forLoop.getForUpdate())); - aCtFor.setBody(spoon.support.visitor.equals.CloneHelper.clone(forLoop.getBody())); - aCtFor.setComments(spoon.support.visitor.equals.CloneHelper.clone(forLoop.getComments())); + aCtFor.setAnnotations(this.cloneHelper.clone(forLoop.getAnnotations())); + aCtFor.setForInit(this.cloneHelper.clone(forLoop.getForInit())); + aCtFor.setExpression(this.cloneHelper.clone(forLoop.getExpression())); + aCtFor.setForUpdate(this.cloneHelper.clone(forLoop.getForUpdate())); + aCtFor.setBody(this.cloneHelper.clone(forLoop.getBody())); + aCtFor.setComments(this.cloneHelper.clone(forLoop.getComments())); this.other = aCtFor; } // auto-generated, see spoon.generating.CloneVisitorGenerator public void visitCtForEach(final spoon.reflect.code.CtForEach foreach) { spoon.reflect.code.CtForEach aCtForEach = spoon.support.visitor.clone.CloneBuilder.build(this.builder, foreach, foreach.getFactory().Core().createForEach()); - aCtForEach.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(foreach.getAnnotations())); - aCtForEach.setVariable(spoon.support.visitor.equals.CloneHelper.clone(foreach.getVariable())); - aCtForEach.setExpression(spoon.support.visitor.equals.CloneHelper.clone(foreach.getExpression())); - aCtForEach.setBody(spoon.support.visitor.equals.CloneHelper.clone(foreach.getBody())); - aCtForEach.setComments(spoon.support.visitor.equals.CloneHelper.clone(foreach.getComments())); + aCtForEach.setAnnotations(this.cloneHelper.clone(foreach.getAnnotations())); + aCtForEach.setVariable(this.cloneHelper.clone(foreach.getVariable())); + aCtForEach.setExpression(this.cloneHelper.clone(foreach.getExpression())); + aCtForEach.setBody(this.cloneHelper.clone(foreach.getBody())); + aCtForEach.setComments(this.cloneHelper.clone(foreach.getComments())); this.other = aCtForEach; } // auto-generated, see spoon.generating.CloneVisitorGenerator public void visitCtIf(final spoon.reflect.code.CtIf ifElement) { spoon.reflect.code.CtIf aCtIf = spoon.support.visitor.clone.CloneBuilder.build(this.builder, ifElement, ifElement.getFactory().Core().createIf()); - aCtIf.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(ifElement.getAnnotations())); - aCtIf.setCondition(spoon.support.visitor.equals.CloneHelper.clone(ifElement.getCondition())); - aCtIf.setThenStatement(spoon.support.visitor.equals.CloneHelper.clone(((spoon.reflect.code.CtStatement) (ifElement.getThenStatement())))); - aCtIf.setElseStatement(spoon.support.visitor.equals.CloneHelper.clone(((spoon.reflect.code.CtStatement) (ifElement.getElseStatement())))); - aCtIf.setComments(spoon.support.visitor.equals.CloneHelper.clone(ifElement.getComments())); + aCtIf.setAnnotations(this.cloneHelper.clone(ifElement.getAnnotations())); + aCtIf.setCondition(this.cloneHelper.clone(ifElement.getCondition())); + aCtIf.setThenStatement(this.cloneHelper.clone(((spoon.reflect.code.CtStatement) (ifElement.getThenStatement())))); + aCtIf.setElseStatement(this.cloneHelper.clone(((spoon.reflect.code.CtStatement) (ifElement.getElseStatement())))); + aCtIf.setComments(this.cloneHelper.clone(ifElement.getComments())); this.other = aCtIf; } // auto-generated, see spoon.generating.CloneVisitorGenerator public void visitCtInterface(final spoon.reflect.declaration.CtInterface intrface) { spoon.reflect.declaration.CtInterface aCtInterface = spoon.support.visitor.clone.CloneBuilder.build(this.builder, intrface, intrface.getFactory().Core().createInterface()); - aCtInterface.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(intrface.getAnnotations())); - aCtInterface.setSuperInterfaces(spoon.support.visitor.equals.CloneHelper.clone(intrface.getSuperInterfaces())); - aCtInterface.setFormalCtTypeParameters(spoon.support.visitor.equals.CloneHelper.clone(intrface.getFormalCtTypeParameters())); - aCtInterface.setTypeMembers(spoon.support.visitor.equals.CloneHelper.clone(intrface.getTypeMembers())); - aCtInterface.setComments(spoon.support.visitor.equals.CloneHelper.clone(intrface.getComments())); + aCtInterface.setAnnotations(this.cloneHelper.clone(intrface.getAnnotations())); + aCtInterface.setSuperInterfaces(this.cloneHelper.clone(intrface.getSuperInterfaces())); + aCtInterface.setFormalCtTypeParameters(this.cloneHelper.clone(intrface.getFormalCtTypeParameters())); + aCtInterface.setTypeMembers(this.cloneHelper.clone(intrface.getTypeMembers())); + aCtInterface.setComments(this.cloneHelper.clone(intrface.getComments())); this.other = aCtInterface; } // auto-generated, see spoon.generating.CloneVisitorGenerator public void visitCtInvocation(final spoon.reflect.code.CtInvocation invocation) { spoon.reflect.code.CtInvocation aCtInvocation = spoon.support.visitor.clone.CloneBuilder.build(this.builder, invocation, invocation.getFactory().Core().createInvocation()); - aCtInvocation.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(invocation.getAnnotations())); - aCtInvocation.setTypeCasts(spoon.support.visitor.equals.CloneHelper.clone(invocation.getTypeCasts())); - aCtInvocation.setTarget(spoon.support.visitor.equals.CloneHelper.clone(invocation.getTarget())); - aCtInvocation.setExecutable(spoon.support.visitor.equals.CloneHelper.clone(invocation.getExecutable())); - aCtInvocation.setArguments(spoon.support.visitor.equals.CloneHelper.clone(invocation.getArguments())); - aCtInvocation.setComments(spoon.support.visitor.equals.CloneHelper.clone(invocation.getComments())); + aCtInvocation.setAnnotations(this.cloneHelper.clone(invocation.getAnnotations())); + aCtInvocation.setTypeCasts(this.cloneHelper.clone(invocation.getTypeCasts())); + aCtInvocation.setTarget(this.cloneHelper.clone(invocation.getTarget())); + aCtInvocation.setExecutable(this.cloneHelper.clone(invocation.getExecutable())); + aCtInvocation.setArguments(this.cloneHelper.clone(invocation.getArguments())); + aCtInvocation.setComments(this.cloneHelper.clone(invocation.getComments())); this.other = aCtInvocation; } // auto-generated, see spoon.generating.CloneVisitorGenerator public void visitCtLiteral(final spoon.reflect.code.CtLiteral literal) { spoon.reflect.code.CtLiteral aCtLiteral = spoon.support.visitor.clone.CloneBuilder.build(this.builder, literal, literal.getFactory().Core().createLiteral()); - aCtLiteral.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(literal.getAnnotations())); - aCtLiteral.setType(spoon.support.visitor.equals.CloneHelper.clone(literal.getType())); - aCtLiteral.setTypeCasts(spoon.support.visitor.equals.CloneHelper.clone(literal.getTypeCasts())); - aCtLiteral.setComments(spoon.support.visitor.equals.CloneHelper.clone(literal.getComments())); + aCtLiteral.setAnnotations(this.cloneHelper.clone(literal.getAnnotations())); + aCtLiteral.setType(this.cloneHelper.clone(literal.getType())); + aCtLiteral.setTypeCasts(this.cloneHelper.clone(literal.getTypeCasts())); + aCtLiteral.setComments(this.cloneHelper.clone(literal.getComments())); this.other = aCtLiteral; } // auto-generated, see spoon.generating.CloneVisitorGenerator public void visitCtLocalVariable(final spoon.reflect.code.CtLocalVariable localVariable) { spoon.reflect.code.CtLocalVariable aCtLocalVariable = spoon.support.visitor.clone.CloneBuilder.build(this.builder, localVariable, localVariable.getFactory().Core().createLocalVariable()); - aCtLocalVariable.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(localVariable.getAnnotations())); - aCtLocalVariable.setType(spoon.support.visitor.equals.CloneHelper.clone(localVariable.getType())); - aCtLocalVariable.setDefaultExpression(spoon.support.visitor.equals.CloneHelper.clone(localVariable.getDefaultExpression())); - aCtLocalVariable.setComments(spoon.support.visitor.equals.CloneHelper.clone(localVariable.getComments())); + aCtLocalVariable.setAnnotations(this.cloneHelper.clone(localVariable.getAnnotations())); + aCtLocalVariable.setType(this.cloneHelper.clone(localVariable.getType())); + aCtLocalVariable.setDefaultExpression(this.cloneHelper.clone(localVariable.getDefaultExpression())); + aCtLocalVariable.setComments(this.cloneHelper.clone(localVariable.getComments())); this.other = aCtLocalVariable; } // auto-generated, see spoon.generating.CloneVisitorGenerator public void visitCtLocalVariableReference(final spoon.reflect.reference.CtLocalVariableReference reference) { spoon.reflect.reference.CtLocalVariableReference aCtLocalVariableReference = spoon.support.visitor.clone.CloneBuilder.build(this.builder, reference, reference.getFactory().Core().createLocalVariableReference()); - aCtLocalVariableReference.setType(spoon.support.visitor.equals.CloneHelper.clone(reference.getType())); - aCtLocalVariableReference.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(reference.getAnnotations())); + aCtLocalVariableReference.setType(this.cloneHelper.clone(reference.getType())); + aCtLocalVariableReference.setAnnotations(this.cloneHelper.clone(reference.getAnnotations())); this.other = aCtLocalVariableReference; } // auto-generated, see spoon.generating.CloneVisitorGenerator public void visitCtCatchVariable(final spoon.reflect.code.CtCatchVariable catchVariable) { spoon.reflect.code.CtCatchVariable aCtCatchVariable = spoon.support.visitor.clone.CloneBuilder.build(this.builder, catchVariable, catchVariable.getFactory().Core().createCatchVariable()); - aCtCatchVariable.setComments(spoon.support.visitor.equals.CloneHelper.clone(catchVariable.getComments())); - aCtCatchVariable.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(catchVariable.getAnnotations())); - aCtCatchVariable.setDefaultExpression(spoon.support.visitor.equals.CloneHelper.clone(catchVariable.getDefaultExpression())); - aCtCatchVariable.setType(spoon.support.visitor.equals.CloneHelper.clone(catchVariable.getType())); - aCtCatchVariable.setMultiTypes(spoon.support.visitor.equals.CloneHelper.clone(catchVariable.getMultiTypes())); + aCtCatchVariable.setComments(this.cloneHelper.clone(catchVariable.getComments())); + aCtCatchVariable.setAnnotations(this.cloneHelper.clone(catchVariable.getAnnotations())); + aCtCatchVariable.setDefaultExpression(this.cloneHelper.clone(catchVariable.getDefaultExpression())); + aCtCatchVariable.setType(this.cloneHelper.clone(catchVariable.getType())); + aCtCatchVariable.setMultiTypes(this.cloneHelper.clone(catchVariable.getMultiTypes())); this.other = aCtCatchVariable; } // auto-generated, see spoon.generating.CloneVisitorGenerator public void visitCtCatchVariableReference(final spoon.reflect.reference.CtCatchVariableReference reference) { spoon.reflect.reference.CtCatchVariableReference aCtCatchVariableReference = spoon.support.visitor.clone.CloneBuilder.build(this.builder, reference, reference.getFactory().Core().createCatchVariableReference()); - aCtCatchVariableReference.setComments(spoon.support.visitor.equals.CloneHelper.clone(reference.getComments())); - aCtCatchVariableReference.setType(spoon.support.visitor.equals.CloneHelper.clone(reference.getType())); - aCtCatchVariableReference.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(reference.getAnnotations())); + aCtCatchVariableReference.setComments(this.cloneHelper.clone(reference.getComments())); + aCtCatchVariableReference.setType(this.cloneHelper.clone(reference.getType())); + aCtCatchVariableReference.setAnnotations(this.cloneHelper.clone(reference.getAnnotations())); this.other = aCtCatchVariableReference; } // auto-generated, see spoon.generating.CloneVisitorGenerator public void visitCtMethod(final spoon.reflect.declaration.CtMethod m) { spoon.reflect.declaration.CtMethod aCtMethod = spoon.support.visitor.clone.CloneBuilder.build(this.builder, m, m.getFactory().Core().createMethod()); - aCtMethod.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(m.getAnnotations())); - aCtMethod.setFormalCtTypeParameters(spoon.support.visitor.equals.CloneHelper.clone(m.getFormalCtTypeParameters())); - aCtMethod.setType(spoon.support.visitor.equals.CloneHelper.clone(m.getType())); - aCtMethod.setParameters(spoon.support.visitor.equals.CloneHelper.clone(m.getParameters())); - aCtMethod.setThrownTypes(spoon.support.visitor.equals.CloneHelper.clone(m.getThrownTypes())); - aCtMethod.setBody(spoon.support.visitor.equals.CloneHelper.clone(m.getBody())); - aCtMethod.setComments(spoon.support.visitor.equals.CloneHelper.clone(m.getComments())); + aCtMethod.setAnnotations(this.cloneHelper.clone(m.getAnnotations())); + aCtMethod.setFormalCtTypeParameters(this.cloneHelper.clone(m.getFormalCtTypeParameters())); + aCtMethod.setType(this.cloneHelper.clone(m.getType())); + aCtMethod.setParameters(this.cloneHelper.clone(m.getParameters())); + aCtMethod.setThrownTypes(this.cloneHelper.clone(m.getThrownTypes())); + aCtMethod.setBody(this.cloneHelper.clone(m.getBody())); + aCtMethod.setComments(this.cloneHelper.clone(m.getComments())); this.other = aCtMethod; } @@ -434,22 +439,22 @@ public void visitCtMethod(final spoon.reflect.declaration.CtMethod m) { @java.lang.Override public void visitCtAnnotationMethod(spoon.reflect.declaration.CtAnnotationMethod annotationMethod) { spoon.reflect.declaration.CtAnnotationMethod aCtAnnotationMethod = spoon.support.visitor.clone.CloneBuilder.build(this.builder, annotationMethod, annotationMethod.getFactory().Core().createAnnotationMethod()); - aCtAnnotationMethod.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(annotationMethod.getAnnotations())); - aCtAnnotationMethod.setType(spoon.support.visitor.equals.CloneHelper.clone(annotationMethod.getType())); - aCtAnnotationMethod.setDefaultExpression(spoon.support.visitor.equals.CloneHelper.clone(annotationMethod.getDefaultExpression())); - aCtAnnotationMethod.setComments(spoon.support.visitor.equals.CloneHelper.clone(annotationMethod.getComments())); + aCtAnnotationMethod.setAnnotations(this.cloneHelper.clone(annotationMethod.getAnnotations())); + aCtAnnotationMethod.setType(this.cloneHelper.clone(annotationMethod.getType())); + aCtAnnotationMethod.setDefaultExpression(this.cloneHelper.clone(annotationMethod.getDefaultExpression())); + aCtAnnotationMethod.setComments(this.cloneHelper.clone(annotationMethod.getComments())); this.other = aCtAnnotationMethod; } // auto-generated, see spoon.generating.CloneVisitorGenerator public void visitCtNewArray(final spoon.reflect.code.CtNewArray newArray) { spoon.reflect.code.CtNewArray aCtNewArray = spoon.support.visitor.clone.CloneBuilder.build(this.builder, newArray, newArray.getFactory().Core().createNewArray()); - aCtNewArray.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(newArray.getAnnotations())); - aCtNewArray.setType(spoon.support.visitor.equals.CloneHelper.clone(newArray.getType())); - aCtNewArray.setTypeCasts(spoon.support.visitor.equals.CloneHelper.clone(newArray.getTypeCasts())); - aCtNewArray.setElements(spoon.support.visitor.equals.CloneHelper.clone(newArray.getElements())); - aCtNewArray.setDimensionExpressions(spoon.support.visitor.equals.CloneHelper.clone(newArray.getDimensionExpressions())); - aCtNewArray.setComments(spoon.support.visitor.equals.CloneHelper.clone(newArray.getComments())); + aCtNewArray.setAnnotations(this.cloneHelper.clone(newArray.getAnnotations())); + aCtNewArray.setType(this.cloneHelper.clone(newArray.getType())); + aCtNewArray.setTypeCasts(this.cloneHelper.clone(newArray.getTypeCasts())); + aCtNewArray.setElements(this.cloneHelper.clone(newArray.getElements())); + aCtNewArray.setDimensionExpressions(this.cloneHelper.clone(newArray.getDimensionExpressions())); + aCtNewArray.setComments(this.cloneHelper.clone(newArray.getComments())); this.other = aCtNewArray; } @@ -457,25 +462,25 @@ public void visitCtNewArray(final spoon.reflect.code.CtNewArray newArray) @java.lang.Override public void visitCtConstructorCall(final spoon.reflect.code.CtConstructorCall ctConstructorCall) { spoon.reflect.code.CtConstructorCall aCtConstructorCall = spoon.support.visitor.clone.CloneBuilder.build(this.builder, ctConstructorCall, ctConstructorCall.getFactory().Core().createConstructorCall()); - aCtConstructorCall.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(ctConstructorCall.getAnnotations())); - aCtConstructorCall.setTypeCasts(spoon.support.visitor.equals.CloneHelper.clone(ctConstructorCall.getTypeCasts())); - aCtConstructorCall.setExecutable(spoon.support.visitor.equals.CloneHelper.clone(ctConstructorCall.getExecutable())); - aCtConstructorCall.setTarget(spoon.support.visitor.equals.CloneHelper.clone(ctConstructorCall.getTarget())); - aCtConstructorCall.setArguments(spoon.support.visitor.equals.CloneHelper.clone(ctConstructorCall.getArguments())); - aCtConstructorCall.setComments(spoon.support.visitor.equals.CloneHelper.clone(ctConstructorCall.getComments())); + aCtConstructorCall.setAnnotations(this.cloneHelper.clone(ctConstructorCall.getAnnotations())); + aCtConstructorCall.setTypeCasts(this.cloneHelper.clone(ctConstructorCall.getTypeCasts())); + aCtConstructorCall.setExecutable(this.cloneHelper.clone(ctConstructorCall.getExecutable())); + aCtConstructorCall.setTarget(this.cloneHelper.clone(ctConstructorCall.getTarget())); + aCtConstructorCall.setArguments(this.cloneHelper.clone(ctConstructorCall.getArguments())); + aCtConstructorCall.setComments(this.cloneHelper.clone(ctConstructorCall.getComments())); this.other = aCtConstructorCall; } // auto-generated, see spoon.generating.CloneVisitorGenerator public void visitCtNewClass(final spoon.reflect.code.CtNewClass newClass) { spoon.reflect.code.CtNewClass aCtNewClass = spoon.support.visitor.clone.CloneBuilder.build(this.builder, newClass, newClass.getFactory().Core().createNewClass()); - aCtNewClass.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(newClass.getAnnotations())); - aCtNewClass.setTypeCasts(spoon.support.visitor.equals.CloneHelper.clone(newClass.getTypeCasts())); - aCtNewClass.setExecutable(spoon.support.visitor.equals.CloneHelper.clone(newClass.getExecutable())); - aCtNewClass.setTarget(spoon.support.visitor.equals.CloneHelper.clone(newClass.getTarget())); - aCtNewClass.setArguments(spoon.support.visitor.equals.CloneHelper.clone(newClass.getArguments())); - aCtNewClass.setAnonymousClass(spoon.support.visitor.equals.CloneHelper.clone(newClass.getAnonymousClass())); - aCtNewClass.setComments(spoon.support.visitor.equals.CloneHelper.clone(newClass.getComments())); + aCtNewClass.setAnnotations(this.cloneHelper.clone(newClass.getAnnotations())); + aCtNewClass.setTypeCasts(this.cloneHelper.clone(newClass.getTypeCasts())); + aCtNewClass.setExecutable(this.cloneHelper.clone(newClass.getExecutable())); + aCtNewClass.setTarget(this.cloneHelper.clone(newClass.getTarget())); + aCtNewClass.setArguments(this.cloneHelper.clone(newClass.getArguments())); + aCtNewClass.setAnonymousClass(this.cloneHelper.clone(newClass.getAnonymousClass())); + aCtNewClass.setComments(this.cloneHelper.clone(newClass.getComments())); this.other = aCtNewClass; } @@ -483,14 +488,14 @@ public void visitCtNewClass(final spoon.reflect.code.CtNewClass newClass) @java.lang.Override public void visitCtLambda(final spoon.reflect.code.CtLambda lambda) { spoon.reflect.code.CtLambda aCtLambda = spoon.support.visitor.clone.CloneBuilder.build(this.builder, lambda, lambda.getFactory().Core().createLambda()); - aCtLambda.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(lambda.getAnnotations())); - aCtLambda.setType(spoon.support.visitor.equals.CloneHelper.clone(lambda.getType())); - aCtLambda.setTypeCasts(spoon.support.visitor.equals.CloneHelper.clone(lambda.getTypeCasts())); - aCtLambda.setParameters(spoon.support.visitor.equals.CloneHelper.clone(lambda.getParameters())); - aCtLambda.setThrownTypes(spoon.support.visitor.equals.CloneHelper.clone(lambda.getThrownTypes())); - aCtLambda.setBody(spoon.support.visitor.equals.CloneHelper.clone(lambda.getBody())); - aCtLambda.setExpression(spoon.support.visitor.equals.CloneHelper.clone(lambda.getExpression())); - aCtLambda.setComments(spoon.support.visitor.equals.CloneHelper.clone(lambda.getComments())); + aCtLambda.setAnnotations(this.cloneHelper.clone(lambda.getAnnotations())); + aCtLambda.setType(this.cloneHelper.clone(lambda.getType())); + aCtLambda.setTypeCasts(this.cloneHelper.clone(lambda.getTypeCasts())); + aCtLambda.setParameters(this.cloneHelper.clone(lambda.getParameters())); + aCtLambda.setThrownTypes(this.cloneHelper.clone(lambda.getThrownTypes())); + aCtLambda.setBody(this.cloneHelper.clone(lambda.getBody())); + aCtLambda.setExpression(this.cloneHelper.clone(lambda.getExpression())); + aCtLambda.setComments(this.cloneHelper.clone(lambda.getComments())); this.other = aCtLambda; } @@ -498,117 +503,117 @@ public void visitCtLambda(final spoon.reflect.code.CtLambda lambda) { @java.lang.Override public > void visitCtExecutableReferenceExpression(final spoon.reflect.code.CtExecutableReferenceExpression expression) { spoon.reflect.code.CtExecutableReferenceExpression aCtExecutableReferenceExpression = spoon.support.visitor.clone.CloneBuilder.build(this.builder, expression, expression.getFactory().Core().createExecutableReferenceExpression()); - aCtExecutableReferenceExpression.setComments(spoon.support.visitor.equals.CloneHelper.clone(expression.getComments())); - aCtExecutableReferenceExpression.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(expression.getAnnotations())); - aCtExecutableReferenceExpression.setType(spoon.support.visitor.equals.CloneHelper.clone(expression.getType())); - aCtExecutableReferenceExpression.setTypeCasts(spoon.support.visitor.equals.CloneHelper.clone(expression.getTypeCasts())); - aCtExecutableReferenceExpression.setExecutable(spoon.support.visitor.equals.CloneHelper.clone(expression.getExecutable())); - aCtExecutableReferenceExpression.setTarget(spoon.support.visitor.equals.CloneHelper.clone(expression.getTarget())); + aCtExecutableReferenceExpression.setComments(this.cloneHelper.clone(expression.getComments())); + aCtExecutableReferenceExpression.setAnnotations(this.cloneHelper.clone(expression.getAnnotations())); + aCtExecutableReferenceExpression.setType(this.cloneHelper.clone(expression.getType())); + aCtExecutableReferenceExpression.setTypeCasts(this.cloneHelper.clone(expression.getTypeCasts())); + aCtExecutableReferenceExpression.setExecutable(this.cloneHelper.clone(expression.getExecutable())); + aCtExecutableReferenceExpression.setTarget(this.cloneHelper.clone(expression.getTarget())); this.other = aCtExecutableReferenceExpression; } // auto-generated, see spoon.generating.CloneVisitorGenerator public void visitCtOperatorAssignment(final spoon.reflect.code.CtOperatorAssignment assignment) { spoon.reflect.code.CtOperatorAssignment aCtOperatorAssignment = spoon.support.visitor.clone.CloneBuilder.build(this.builder, assignment, assignment.getFactory().Core().createOperatorAssignment()); - aCtOperatorAssignment.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(assignment.getAnnotations())); - aCtOperatorAssignment.setType(spoon.support.visitor.equals.CloneHelper.clone(assignment.getType())); - aCtOperatorAssignment.setTypeCasts(spoon.support.visitor.equals.CloneHelper.clone(assignment.getTypeCasts())); - aCtOperatorAssignment.setAssigned(spoon.support.visitor.equals.CloneHelper.clone(assignment.getAssigned())); - aCtOperatorAssignment.setAssignment(spoon.support.visitor.equals.CloneHelper.clone(assignment.getAssignment())); - aCtOperatorAssignment.setComments(spoon.support.visitor.equals.CloneHelper.clone(assignment.getComments())); + aCtOperatorAssignment.setAnnotations(this.cloneHelper.clone(assignment.getAnnotations())); + aCtOperatorAssignment.setType(this.cloneHelper.clone(assignment.getType())); + aCtOperatorAssignment.setTypeCasts(this.cloneHelper.clone(assignment.getTypeCasts())); + aCtOperatorAssignment.setAssigned(this.cloneHelper.clone(assignment.getAssigned())); + aCtOperatorAssignment.setAssignment(this.cloneHelper.clone(assignment.getAssignment())); + aCtOperatorAssignment.setComments(this.cloneHelper.clone(assignment.getComments())); this.other = aCtOperatorAssignment; } // auto-generated, see spoon.generating.CloneVisitorGenerator public void visitCtPackage(final spoon.reflect.declaration.CtPackage ctPackage) { spoon.reflect.declaration.CtPackage aCtPackage = spoon.support.visitor.clone.CloneBuilder.build(this.builder, ctPackage, ctPackage.getFactory().Core().createPackage()); - aCtPackage.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(ctPackage.getAnnotations())); - aCtPackage.setPackages(spoon.support.visitor.equals.CloneHelper.clone(ctPackage.getPackages())); - aCtPackage.setTypes(spoon.support.visitor.equals.CloneHelper.clone(ctPackage.getTypes())); - aCtPackage.setComments(spoon.support.visitor.equals.CloneHelper.clone(ctPackage.getComments())); + aCtPackage.setAnnotations(this.cloneHelper.clone(ctPackage.getAnnotations())); + aCtPackage.setPackages(this.cloneHelper.clone(ctPackage.getPackages())); + aCtPackage.setTypes(this.cloneHelper.clone(ctPackage.getTypes())); + aCtPackage.setComments(this.cloneHelper.clone(ctPackage.getComments())); this.other = aCtPackage; } // auto-generated, see spoon.generating.CloneVisitorGenerator public void visitCtPackageReference(final spoon.reflect.reference.CtPackageReference reference) { spoon.reflect.reference.CtPackageReference aCtPackageReference = spoon.support.visitor.clone.CloneBuilder.build(this.builder, reference, reference.getFactory().Core().createPackageReference()); - aCtPackageReference.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(reference.getAnnotations())); + aCtPackageReference.setAnnotations(this.cloneHelper.clone(reference.getAnnotations())); this.other = aCtPackageReference; } // auto-generated, see spoon.generating.CloneVisitorGenerator public void visitCtParameter(final spoon.reflect.declaration.CtParameter parameter) { spoon.reflect.declaration.CtParameter aCtParameter = spoon.support.visitor.clone.CloneBuilder.build(this.builder, parameter, parameter.getFactory().Core().createParameter()); - aCtParameter.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(parameter.getAnnotations())); - aCtParameter.setType(spoon.support.visitor.equals.CloneHelper.clone(parameter.getType())); - aCtParameter.setComments(spoon.support.visitor.equals.CloneHelper.clone(parameter.getComments())); + aCtParameter.setAnnotations(this.cloneHelper.clone(parameter.getAnnotations())); + aCtParameter.setType(this.cloneHelper.clone(parameter.getType())); + aCtParameter.setComments(this.cloneHelper.clone(parameter.getComments())); this.other = aCtParameter; } // auto-generated, see spoon.generating.CloneVisitorGenerator public void visitCtParameterReference(final spoon.reflect.reference.CtParameterReference reference) { spoon.reflect.reference.CtParameterReference aCtParameterReference = spoon.support.visitor.clone.CloneBuilder.build(this.builder, reference, reference.getFactory().Core().createParameterReference()); - aCtParameterReference.setType(spoon.support.visitor.equals.CloneHelper.clone(reference.getType())); - aCtParameterReference.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(reference.getAnnotations())); - aCtParameterReference.setDeclaringExecutable(spoon.support.visitor.equals.CloneHelper.clone(reference.getDeclaringExecutable())); + aCtParameterReference.setType(this.cloneHelper.clone(reference.getType())); + aCtParameterReference.setAnnotations(this.cloneHelper.clone(reference.getAnnotations())); + aCtParameterReference.setDeclaringExecutable(this.cloneHelper.clone(reference.getDeclaringExecutable())); this.other = aCtParameterReference; } // auto-generated, see spoon.generating.CloneVisitorGenerator public void visitCtReturn(final spoon.reflect.code.CtReturn returnStatement) { spoon.reflect.code.CtReturn aCtReturn = spoon.support.visitor.clone.CloneBuilder.build(this.builder, returnStatement, returnStatement.getFactory().Core().createReturn()); - aCtReturn.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(returnStatement.getAnnotations())); - aCtReturn.setReturnedExpression(spoon.support.visitor.equals.CloneHelper.clone(returnStatement.getReturnedExpression())); - aCtReturn.setComments(spoon.support.visitor.equals.CloneHelper.clone(returnStatement.getComments())); + aCtReturn.setAnnotations(this.cloneHelper.clone(returnStatement.getAnnotations())); + aCtReturn.setReturnedExpression(this.cloneHelper.clone(returnStatement.getReturnedExpression())); + aCtReturn.setComments(this.cloneHelper.clone(returnStatement.getComments())); this.other = aCtReturn; } // auto-generated, see spoon.generating.CloneVisitorGenerator public void visitCtStatementList(final spoon.reflect.code.CtStatementList statements) { spoon.reflect.code.CtStatementList aCtStatementList = spoon.support.visitor.clone.CloneBuilder.build(this.builder, statements, statements.getFactory().Core().createStatementList()); - aCtStatementList.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(statements.getAnnotations())); - aCtStatementList.setStatements(spoon.support.visitor.equals.CloneHelper.clone(statements.getStatements())); - aCtStatementList.setComments(spoon.support.visitor.equals.CloneHelper.clone(statements.getComments())); + aCtStatementList.setAnnotations(this.cloneHelper.clone(statements.getAnnotations())); + aCtStatementList.setStatements(this.cloneHelper.clone(statements.getStatements())); + aCtStatementList.setComments(this.cloneHelper.clone(statements.getComments())); this.other = aCtStatementList; } // auto-generated, see spoon.generating.CloneVisitorGenerator public void visitCtSwitch(final spoon.reflect.code.CtSwitch switchStatement) { spoon.reflect.code.CtSwitch aCtSwitch = spoon.support.visitor.clone.CloneBuilder.build(this.builder, switchStatement, switchStatement.getFactory().Core().createSwitch()); - aCtSwitch.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(switchStatement.getAnnotations())); - aCtSwitch.setSelector(spoon.support.visitor.equals.CloneHelper.clone(switchStatement.getSelector())); - aCtSwitch.setCases(spoon.support.visitor.equals.CloneHelper.clone(switchStatement.getCases())); - aCtSwitch.setComments(spoon.support.visitor.equals.CloneHelper.clone(switchStatement.getComments())); + aCtSwitch.setAnnotations(this.cloneHelper.clone(switchStatement.getAnnotations())); + aCtSwitch.setSelector(this.cloneHelper.clone(switchStatement.getSelector())); + aCtSwitch.setCases(this.cloneHelper.clone(switchStatement.getCases())); + aCtSwitch.setComments(this.cloneHelper.clone(switchStatement.getComments())); this.other = aCtSwitch; } // auto-generated, see spoon.generating.CloneVisitorGenerator public void visitCtSynchronized(final spoon.reflect.code.CtSynchronized synchro) { spoon.reflect.code.CtSynchronized aCtSynchronized = spoon.support.visitor.clone.CloneBuilder.build(this.builder, synchro, synchro.getFactory().Core().createSynchronized()); - aCtSynchronized.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(synchro.getAnnotations())); - aCtSynchronized.setExpression(spoon.support.visitor.equals.CloneHelper.clone(synchro.getExpression())); - aCtSynchronized.setBlock(spoon.support.visitor.equals.CloneHelper.clone(synchro.getBlock())); - aCtSynchronized.setComments(spoon.support.visitor.equals.CloneHelper.clone(synchro.getComments())); + aCtSynchronized.setAnnotations(this.cloneHelper.clone(synchro.getAnnotations())); + aCtSynchronized.setExpression(this.cloneHelper.clone(synchro.getExpression())); + aCtSynchronized.setBlock(this.cloneHelper.clone(synchro.getBlock())); + aCtSynchronized.setComments(this.cloneHelper.clone(synchro.getComments())); this.other = aCtSynchronized; } // auto-generated, see spoon.generating.CloneVisitorGenerator public void visitCtThrow(final spoon.reflect.code.CtThrow throwStatement) { spoon.reflect.code.CtThrow aCtThrow = spoon.support.visitor.clone.CloneBuilder.build(this.builder, throwStatement, throwStatement.getFactory().Core().createThrow()); - aCtThrow.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(throwStatement.getAnnotations())); - aCtThrow.setThrownExpression(spoon.support.visitor.equals.CloneHelper.clone(throwStatement.getThrownExpression())); - aCtThrow.setComments(spoon.support.visitor.equals.CloneHelper.clone(throwStatement.getComments())); + aCtThrow.setAnnotations(this.cloneHelper.clone(throwStatement.getAnnotations())); + aCtThrow.setThrownExpression(this.cloneHelper.clone(throwStatement.getThrownExpression())); + aCtThrow.setComments(this.cloneHelper.clone(throwStatement.getComments())); this.other = aCtThrow; } // auto-generated, see spoon.generating.CloneVisitorGenerator public void visitCtTry(final spoon.reflect.code.CtTry tryBlock) { spoon.reflect.code.CtTry aCtTry = spoon.support.visitor.clone.CloneBuilder.build(this.builder, tryBlock, tryBlock.getFactory().Core().createTry()); - aCtTry.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(tryBlock.getAnnotations())); - aCtTry.setBody(spoon.support.visitor.equals.CloneHelper.clone(tryBlock.getBody())); - aCtTry.setCatchers(spoon.support.visitor.equals.CloneHelper.clone(tryBlock.getCatchers())); - aCtTry.setFinalizer(spoon.support.visitor.equals.CloneHelper.clone(tryBlock.getFinalizer())); - aCtTry.setComments(spoon.support.visitor.equals.CloneHelper.clone(tryBlock.getComments())); + aCtTry.setAnnotations(this.cloneHelper.clone(tryBlock.getAnnotations())); + aCtTry.setBody(this.cloneHelper.clone(tryBlock.getBody())); + aCtTry.setCatchers(this.cloneHelper.clone(tryBlock.getCatchers())); + aCtTry.setFinalizer(this.cloneHelper.clone(tryBlock.getFinalizer())); + aCtTry.setComments(this.cloneHelper.clone(tryBlock.getComments())); this.other = aCtTry; } @@ -616,22 +621,22 @@ public void visitCtTry(final spoon.reflect.code.CtTry tryBlock) { @java.lang.Override public void visitCtTryWithResource(final spoon.reflect.code.CtTryWithResource tryWithResource) { spoon.reflect.code.CtTryWithResource aCtTryWithResource = spoon.support.visitor.clone.CloneBuilder.build(this.builder, tryWithResource, tryWithResource.getFactory().Core().createTryWithResource()); - aCtTryWithResource.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(tryWithResource.getAnnotations())); - aCtTryWithResource.setResources(spoon.support.visitor.equals.CloneHelper.clone(tryWithResource.getResources())); - aCtTryWithResource.setBody(spoon.support.visitor.equals.CloneHelper.clone(tryWithResource.getBody())); - aCtTryWithResource.setCatchers(spoon.support.visitor.equals.CloneHelper.clone(tryWithResource.getCatchers())); - aCtTryWithResource.setFinalizer(spoon.support.visitor.equals.CloneHelper.clone(tryWithResource.getFinalizer())); - aCtTryWithResource.setComments(spoon.support.visitor.equals.CloneHelper.clone(tryWithResource.getComments())); + aCtTryWithResource.setAnnotations(this.cloneHelper.clone(tryWithResource.getAnnotations())); + aCtTryWithResource.setResources(this.cloneHelper.clone(tryWithResource.getResources())); + aCtTryWithResource.setBody(this.cloneHelper.clone(tryWithResource.getBody())); + aCtTryWithResource.setCatchers(this.cloneHelper.clone(tryWithResource.getCatchers())); + aCtTryWithResource.setFinalizer(this.cloneHelper.clone(tryWithResource.getFinalizer())); + aCtTryWithResource.setComments(this.cloneHelper.clone(tryWithResource.getComments())); this.other = aCtTryWithResource; } // auto-generated, see spoon.generating.CloneVisitorGenerator public void visitCtTypeParameterReference(final spoon.reflect.reference.CtTypeParameterReference ref) { spoon.reflect.reference.CtTypeParameterReference aCtTypeParameterReference = spoon.support.visitor.clone.CloneBuilder.build(this.builder, ref, ref.getFactory().Core().createTypeParameterReference()); - aCtTypeParameterReference.setPackage(spoon.support.visitor.equals.CloneHelper.clone(ref.getPackage())); - aCtTypeParameterReference.setDeclaringType(spoon.support.visitor.equals.CloneHelper.clone(ref.getDeclaringType())); - aCtTypeParameterReference.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(ref.getAnnotations())); - aCtTypeParameterReference.setBoundingType(spoon.support.visitor.equals.CloneHelper.clone(ref.getBoundingType())); + aCtTypeParameterReference.setPackage(this.cloneHelper.clone(ref.getPackage())); + aCtTypeParameterReference.setDeclaringType(this.cloneHelper.clone(ref.getDeclaringType())); + aCtTypeParameterReference.setAnnotations(this.cloneHelper.clone(ref.getAnnotations())); + aCtTypeParameterReference.setBoundingType(this.cloneHelper.clone(ref.getBoundingType())); this.other = aCtTypeParameterReference; } @@ -639,10 +644,10 @@ public void visitCtTypeParameterReference(final spoon.reflect.reference.CtTypePa @java.lang.Override public void visitCtWildcardReference(spoon.reflect.reference.CtWildcardReference wildcardReference) { spoon.reflect.reference.CtWildcardReference aCtWildcardReference = spoon.support.visitor.clone.CloneBuilder.build(this.builder, wildcardReference, wildcardReference.getFactory().Core().createWildcardReference()); - aCtWildcardReference.setPackage(spoon.support.visitor.equals.CloneHelper.clone(wildcardReference.getPackage())); - aCtWildcardReference.setDeclaringType(spoon.support.visitor.equals.CloneHelper.clone(wildcardReference.getDeclaringType())); - aCtWildcardReference.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(wildcardReference.getAnnotations())); - aCtWildcardReference.setBoundingType(spoon.support.visitor.equals.CloneHelper.clone(wildcardReference.getBoundingType())); + aCtWildcardReference.setPackage(this.cloneHelper.clone(wildcardReference.getPackage())); + aCtWildcardReference.setDeclaringType(this.cloneHelper.clone(wildcardReference.getDeclaringType())); + aCtWildcardReference.setAnnotations(this.cloneHelper.clone(wildcardReference.getAnnotations())); + aCtWildcardReference.setBoundingType(this.cloneHelper.clone(wildcardReference.getBoundingType())); this.other = aCtWildcardReference; } @@ -650,21 +655,21 @@ public void visitCtWildcardReference(spoon.reflect.reference.CtWildcardReference @java.lang.Override public void visitCtIntersectionTypeReference(final spoon.reflect.reference.CtIntersectionTypeReference reference) { spoon.reflect.reference.CtIntersectionTypeReference aCtIntersectionTypeReference = spoon.support.visitor.clone.CloneBuilder.build(this.builder, reference, reference.getFactory().Core().createIntersectionTypeReference()); - aCtIntersectionTypeReference.setPackage(spoon.support.visitor.equals.CloneHelper.clone(reference.getPackage())); - aCtIntersectionTypeReference.setDeclaringType(spoon.support.visitor.equals.CloneHelper.clone(reference.getDeclaringType())); - aCtIntersectionTypeReference.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(reference.getAnnotations())); - aCtIntersectionTypeReference.setBounds(spoon.support.visitor.equals.CloneHelper.clone(reference.getBounds())); + aCtIntersectionTypeReference.setPackage(this.cloneHelper.clone(reference.getPackage())); + aCtIntersectionTypeReference.setDeclaringType(this.cloneHelper.clone(reference.getDeclaringType())); + aCtIntersectionTypeReference.setAnnotations(this.cloneHelper.clone(reference.getAnnotations())); + aCtIntersectionTypeReference.setBounds(this.cloneHelper.clone(reference.getBounds())); this.other = aCtIntersectionTypeReference; } // auto-generated, see spoon.generating.CloneVisitorGenerator public void visitCtTypeReference(final spoon.reflect.reference.CtTypeReference reference) { spoon.reflect.reference.CtTypeReference aCtTypeReference = spoon.support.visitor.clone.CloneBuilder.build(this.builder, reference, reference.getFactory().Core().createTypeReference()); - aCtTypeReference.setPackage(spoon.support.visitor.equals.CloneHelper.clone(reference.getPackage())); - aCtTypeReference.setDeclaringType(spoon.support.visitor.equals.CloneHelper.clone(reference.getDeclaringType())); - aCtTypeReference.setActualTypeArguments(spoon.support.visitor.equals.CloneHelper.clone(reference.getActualTypeArguments())); - aCtTypeReference.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(reference.getAnnotations())); - aCtTypeReference.setComments(spoon.support.visitor.equals.CloneHelper.clone(reference.getComments())); + aCtTypeReference.setPackage(this.cloneHelper.clone(reference.getPackage())); + aCtTypeReference.setDeclaringType(this.cloneHelper.clone(reference.getDeclaringType())); + aCtTypeReference.setActualTypeArguments(this.cloneHelper.clone(reference.getActualTypeArguments())); + aCtTypeReference.setAnnotations(this.cloneHelper.clone(reference.getAnnotations())); + aCtTypeReference.setComments(this.cloneHelper.clone(reference.getComments())); this.other = aCtTypeReference; } @@ -672,21 +677,21 @@ public void visitCtTypeReference(final spoon.reflect.reference.CtTypeReferen @java.lang.Override public void visitCtTypeAccess(final spoon.reflect.code.CtTypeAccess typeAccess) { spoon.reflect.code.CtTypeAccess aCtTypeAccess = spoon.support.visitor.clone.CloneBuilder.build(this.builder, typeAccess, typeAccess.getFactory().Core().createTypeAccess()); - aCtTypeAccess.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(typeAccess.getAnnotations())); - aCtTypeAccess.setTypeCasts(spoon.support.visitor.equals.CloneHelper.clone(typeAccess.getTypeCasts())); - aCtTypeAccess.setAccessedType(spoon.support.visitor.equals.CloneHelper.clone(typeAccess.getAccessedType())); - aCtTypeAccess.setComments(spoon.support.visitor.equals.CloneHelper.clone(typeAccess.getComments())); + aCtTypeAccess.setAnnotations(this.cloneHelper.clone(typeAccess.getAnnotations())); + aCtTypeAccess.setTypeCasts(this.cloneHelper.clone(typeAccess.getTypeCasts())); + aCtTypeAccess.setAccessedType(this.cloneHelper.clone(typeAccess.getAccessedType())); + aCtTypeAccess.setComments(this.cloneHelper.clone(typeAccess.getComments())); this.other = aCtTypeAccess; } // auto-generated, see spoon.generating.CloneVisitorGenerator public void visitCtUnaryOperator(final spoon.reflect.code.CtUnaryOperator operator) { spoon.reflect.code.CtUnaryOperator aCtUnaryOperator = spoon.support.visitor.clone.CloneBuilder.build(this.builder, operator, operator.getFactory().Core().createUnaryOperator()); - aCtUnaryOperator.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(operator.getAnnotations())); - aCtUnaryOperator.setType(spoon.support.visitor.equals.CloneHelper.clone(operator.getType())); - aCtUnaryOperator.setTypeCasts(spoon.support.visitor.equals.CloneHelper.clone(operator.getTypeCasts())); - aCtUnaryOperator.setOperand(spoon.support.visitor.equals.CloneHelper.clone(operator.getOperand())); - aCtUnaryOperator.setComments(spoon.support.visitor.equals.CloneHelper.clone(operator.getComments())); + aCtUnaryOperator.setAnnotations(this.cloneHelper.clone(operator.getAnnotations())); + aCtUnaryOperator.setType(this.cloneHelper.clone(operator.getType())); + aCtUnaryOperator.setTypeCasts(this.cloneHelper.clone(operator.getTypeCasts())); + aCtUnaryOperator.setOperand(this.cloneHelper.clone(operator.getOperand())); + aCtUnaryOperator.setComments(this.cloneHelper.clone(operator.getComments())); this.other = aCtUnaryOperator; } @@ -694,10 +699,10 @@ public void visitCtUnaryOperator(final spoon.reflect.code.CtUnaryOperator @java.lang.Override public void visitCtVariableRead(final spoon.reflect.code.CtVariableRead variableRead) { spoon.reflect.code.CtVariableRead aCtVariableRead = spoon.support.visitor.clone.CloneBuilder.build(this.builder, variableRead, variableRead.getFactory().Core().createVariableRead()); - aCtVariableRead.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(variableRead.getAnnotations())); - aCtVariableRead.setTypeCasts(spoon.support.visitor.equals.CloneHelper.clone(variableRead.getTypeCasts())); - aCtVariableRead.setVariable(spoon.support.visitor.equals.CloneHelper.clone(variableRead.getVariable())); - aCtVariableRead.setComments(spoon.support.visitor.equals.CloneHelper.clone(variableRead.getComments())); + aCtVariableRead.setAnnotations(this.cloneHelper.clone(variableRead.getAnnotations())); + aCtVariableRead.setTypeCasts(this.cloneHelper.clone(variableRead.getTypeCasts())); + aCtVariableRead.setVariable(this.cloneHelper.clone(variableRead.getVariable())); + aCtVariableRead.setComments(this.cloneHelper.clone(variableRead.getComments())); this.other = aCtVariableRead; } @@ -705,45 +710,45 @@ public void visitCtVariableRead(final spoon.reflect.code.CtVariableRead v @java.lang.Override public void visitCtVariableWrite(final spoon.reflect.code.CtVariableWrite variableWrite) { spoon.reflect.code.CtVariableWrite aCtVariableWrite = spoon.support.visitor.clone.CloneBuilder.build(this.builder, variableWrite, variableWrite.getFactory().Core().createVariableWrite()); - aCtVariableWrite.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(variableWrite.getAnnotations())); - aCtVariableWrite.setTypeCasts(spoon.support.visitor.equals.CloneHelper.clone(variableWrite.getTypeCasts())); - aCtVariableWrite.setVariable(spoon.support.visitor.equals.CloneHelper.clone(variableWrite.getVariable())); - aCtVariableWrite.setComments(spoon.support.visitor.equals.CloneHelper.clone(variableWrite.getComments())); + aCtVariableWrite.setAnnotations(this.cloneHelper.clone(variableWrite.getAnnotations())); + aCtVariableWrite.setTypeCasts(this.cloneHelper.clone(variableWrite.getTypeCasts())); + aCtVariableWrite.setVariable(this.cloneHelper.clone(variableWrite.getVariable())); + aCtVariableWrite.setComments(this.cloneHelper.clone(variableWrite.getComments())); this.other = aCtVariableWrite; } // auto-generated, see spoon.generating.CloneVisitorGenerator public void visitCtWhile(final spoon.reflect.code.CtWhile whileLoop) { spoon.reflect.code.CtWhile aCtWhile = spoon.support.visitor.clone.CloneBuilder.build(this.builder, whileLoop, whileLoop.getFactory().Core().createWhile()); - aCtWhile.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(whileLoop.getAnnotations())); - aCtWhile.setLoopingExpression(spoon.support.visitor.equals.CloneHelper.clone(whileLoop.getLoopingExpression())); - aCtWhile.setBody(spoon.support.visitor.equals.CloneHelper.clone(whileLoop.getBody())); - aCtWhile.setComments(spoon.support.visitor.equals.CloneHelper.clone(whileLoop.getComments())); + aCtWhile.setAnnotations(this.cloneHelper.clone(whileLoop.getAnnotations())); + aCtWhile.setLoopingExpression(this.cloneHelper.clone(whileLoop.getLoopingExpression())); + aCtWhile.setBody(this.cloneHelper.clone(whileLoop.getBody())); + aCtWhile.setComments(this.cloneHelper.clone(whileLoop.getComments())); this.other = aCtWhile; } // auto-generated, see spoon.generating.CloneVisitorGenerator public void visitCtCodeSnippetExpression(final spoon.reflect.code.CtCodeSnippetExpression expression) { spoon.reflect.code.CtCodeSnippetExpression aCtCodeSnippetExpression = spoon.support.visitor.clone.CloneBuilder.build(this.builder, expression, expression.getFactory().Core().createCodeSnippetExpression()); - aCtCodeSnippetExpression.setType(spoon.support.visitor.equals.CloneHelper.clone(expression.getType())); - aCtCodeSnippetExpression.setComments(spoon.support.visitor.equals.CloneHelper.clone(expression.getComments())); - aCtCodeSnippetExpression.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(expression.getAnnotations())); - aCtCodeSnippetExpression.setTypeCasts(spoon.support.visitor.equals.CloneHelper.clone(expression.getTypeCasts())); + aCtCodeSnippetExpression.setType(this.cloneHelper.clone(expression.getType())); + aCtCodeSnippetExpression.setComments(this.cloneHelper.clone(expression.getComments())); + aCtCodeSnippetExpression.setAnnotations(this.cloneHelper.clone(expression.getAnnotations())); + aCtCodeSnippetExpression.setTypeCasts(this.cloneHelper.clone(expression.getTypeCasts())); this.other = aCtCodeSnippetExpression; } // auto-generated, see spoon.generating.CloneVisitorGenerator public void visitCtCodeSnippetStatement(final spoon.reflect.code.CtCodeSnippetStatement statement) { spoon.reflect.code.CtCodeSnippetStatement aCtCodeSnippetStatement = spoon.support.visitor.clone.CloneBuilder.build(this.builder, statement, statement.getFactory().Core().createCodeSnippetStatement()); - aCtCodeSnippetStatement.setComments(spoon.support.visitor.equals.CloneHelper.clone(statement.getComments())); - aCtCodeSnippetStatement.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(statement.getAnnotations())); + aCtCodeSnippetStatement.setComments(this.cloneHelper.clone(statement.getComments())); + aCtCodeSnippetStatement.setAnnotations(this.cloneHelper.clone(statement.getAnnotations())); this.other = aCtCodeSnippetStatement; } // auto-generated, see spoon.generating.CloneVisitorGenerator public void visitCtUnboundVariableReference(final spoon.reflect.reference.CtUnboundVariableReference reference) { spoon.reflect.reference.CtUnboundVariableReference aCtUnboundVariableReference = spoon.support.visitor.clone.CloneBuilder.build(this.builder, reference, reference.getFactory().Core().createUnboundVariableReference()); - aCtUnboundVariableReference.setType(spoon.support.visitor.equals.CloneHelper.clone(reference.getType())); + aCtUnboundVariableReference.setType(this.cloneHelper.clone(reference.getType())); this.other = aCtUnboundVariableReference; } @@ -751,11 +756,11 @@ public void visitCtUnboundVariableReference(final spoon.reflect.reference.Ct @java.lang.Override public void visitCtFieldRead(final spoon.reflect.code.CtFieldRead fieldRead) { spoon.reflect.code.CtFieldRead aCtFieldRead = spoon.support.visitor.clone.CloneBuilder.build(this.builder, fieldRead, fieldRead.getFactory().Core().createFieldRead()); - aCtFieldRead.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(fieldRead.getAnnotations())); - aCtFieldRead.setTypeCasts(spoon.support.visitor.equals.CloneHelper.clone(fieldRead.getTypeCasts())); - aCtFieldRead.setTarget(spoon.support.visitor.equals.CloneHelper.clone(fieldRead.getTarget())); - aCtFieldRead.setVariable(spoon.support.visitor.equals.CloneHelper.clone(fieldRead.getVariable())); - aCtFieldRead.setComments(spoon.support.visitor.equals.CloneHelper.clone(fieldRead.getComments())); + aCtFieldRead.setAnnotations(this.cloneHelper.clone(fieldRead.getAnnotations())); + aCtFieldRead.setTypeCasts(this.cloneHelper.clone(fieldRead.getTypeCasts())); + aCtFieldRead.setTarget(this.cloneHelper.clone(fieldRead.getTarget())); + aCtFieldRead.setVariable(this.cloneHelper.clone(fieldRead.getVariable())); + aCtFieldRead.setComments(this.cloneHelper.clone(fieldRead.getComments())); this.other = aCtFieldRead; } @@ -763,11 +768,11 @@ public void visitCtFieldRead(final spoon.reflect.code.CtFieldRead fieldRe @java.lang.Override public void visitCtFieldWrite(final spoon.reflect.code.CtFieldWrite fieldWrite) { spoon.reflect.code.CtFieldWrite aCtFieldWrite = spoon.support.visitor.clone.CloneBuilder.build(this.builder, fieldWrite, fieldWrite.getFactory().Core().createFieldWrite()); - aCtFieldWrite.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(fieldWrite.getAnnotations())); - aCtFieldWrite.setTypeCasts(spoon.support.visitor.equals.CloneHelper.clone(fieldWrite.getTypeCasts())); - aCtFieldWrite.setTarget(spoon.support.visitor.equals.CloneHelper.clone(fieldWrite.getTarget())); - aCtFieldWrite.setVariable(spoon.support.visitor.equals.CloneHelper.clone(fieldWrite.getVariable())); - aCtFieldWrite.setComments(spoon.support.visitor.equals.CloneHelper.clone(fieldWrite.getComments())); + aCtFieldWrite.setAnnotations(this.cloneHelper.clone(fieldWrite.getAnnotations())); + aCtFieldWrite.setTypeCasts(this.cloneHelper.clone(fieldWrite.getTypeCasts())); + aCtFieldWrite.setTarget(this.cloneHelper.clone(fieldWrite.getTarget())); + aCtFieldWrite.setVariable(this.cloneHelper.clone(fieldWrite.getVariable())); + aCtFieldWrite.setComments(this.cloneHelper.clone(fieldWrite.getComments())); this.other = aCtFieldWrite; } @@ -775,12 +780,12 @@ public void visitCtFieldWrite(final spoon.reflect.code.CtFieldWrite field @java.lang.Override public void visitCtSuperAccess(final spoon.reflect.code.CtSuperAccess f) { spoon.reflect.code.CtSuperAccess aCtSuperAccess = spoon.support.visitor.clone.CloneBuilder.build(this.builder, f, f.getFactory().Core().createSuperAccess()); - aCtSuperAccess.setType(spoon.support.visitor.equals.CloneHelper.clone(f.getType())); - aCtSuperAccess.setComments(spoon.support.visitor.equals.CloneHelper.clone(f.getComments())); - aCtSuperAccess.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(f.getAnnotations())); - aCtSuperAccess.setTypeCasts(spoon.support.visitor.equals.CloneHelper.clone(f.getTypeCasts())); - aCtSuperAccess.setTarget(spoon.support.visitor.equals.CloneHelper.clone(f.getTarget())); - aCtSuperAccess.setVariable(spoon.support.visitor.equals.CloneHelper.clone(f.getVariable())); + aCtSuperAccess.setType(this.cloneHelper.clone(f.getType())); + aCtSuperAccess.setComments(this.cloneHelper.clone(f.getComments())); + aCtSuperAccess.setAnnotations(this.cloneHelper.clone(f.getAnnotations())); + aCtSuperAccess.setTypeCasts(this.cloneHelper.clone(f.getTypeCasts())); + aCtSuperAccess.setTarget(this.cloneHelper.clone(f.getTarget())); + aCtSuperAccess.setVariable(this.cloneHelper.clone(f.getVariable())); this.other = aCtSuperAccess; } @@ -788,8 +793,8 @@ public void visitCtSuperAccess(final spoon.reflect.code.CtSuperAccess f) @java.lang.Override public void visitCtComment(final spoon.reflect.code.CtComment comment) { spoon.reflect.code.CtComment aCtComment = spoon.support.visitor.clone.CloneBuilder.build(this.builder, comment, comment.getFactory().Core().createComment()); - aCtComment.setComments(spoon.support.visitor.equals.CloneHelper.clone(comment.getComments())); - aCtComment.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(comment.getAnnotations())); + aCtComment.setComments(this.cloneHelper.clone(comment.getComments())); + aCtComment.setAnnotations(this.cloneHelper.clone(comment.getAnnotations())); this.other = aCtComment; } @@ -797,9 +802,9 @@ public void visitCtComment(final spoon.reflect.code.CtComment comment) { @java.lang.Override public void visitCtJavaDoc(final spoon.reflect.code.CtJavaDoc javaDoc) { spoon.reflect.code.CtJavaDoc aCtJavaDoc = spoon.support.visitor.clone.CloneBuilder.build(this.builder, javaDoc, javaDoc.getFactory().Core().createJavaDoc()); - aCtJavaDoc.setComments(spoon.support.visitor.equals.CloneHelper.clone(javaDoc.getComments())); - aCtJavaDoc.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(javaDoc.getAnnotations())); - aCtJavaDoc.setTags(spoon.support.visitor.equals.CloneHelper.clone(javaDoc.getTags())); + aCtJavaDoc.setComments(this.cloneHelper.clone(javaDoc.getComments())); + aCtJavaDoc.setAnnotations(this.cloneHelper.clone(javaDoc.getAnnotations())); + aCtJavaDoc.setTags(this.cloneHelper.clone(javaDoc.getTags())); this.other = aCtJavaDoc; } @@ -807,8 +812,8 @@ public void visitCtJavaDoc(final spoon.reflect.code.CtJavaDoc javaDoc) { @java.lang.Override public void visitCtJavaDocTag(final spoon.reflect.code.CtJavaDocTag docTag) { spoon.reflect.code.CtJavaDocTag aCtJavaDocTag = spoon.support.visitor.clone.CloneBuilder.build(this.builder, docTag, docTag.getFactory().Core().createJavaDocTag()); - aCtJavaDocTag.setComments(spoon.support.visitor.equals.CloneHelper.clone(docTag.getComments())); - aCtJavaDocTag.setAnnotations(spoon.support.visitor.equals.CloneHelper.clone(docTag.getAnnotations())); + aCtJavaDocTag.setComments(this.cloneHelper.clone(docTag.getComments())); + aCtJavaDocTag.setAnnotations(this.cloneHelper.clone(docTag.getAnnotations())); this.other = aCtJavaDocTag; } } diff --git a/src/main/java/spoon/support/visitor/equals/CloneHelper.java b/src/main/java/spoon/support/visitor/equals/CloneHelper.java index 23e491d1137..a2d4305e9b0 100644 --- a/src/main/java/spoon/support/visitor/equals/CloneHelper.java +++ b/src/main/java/spoon/support/visitor/equals/CloneHelper.java @@ -30,25 +30,37 @@ import spoon.support.util.EmptyClearableSet; import spoon.support.visitor.clone.CloneVisitor; -public final class CloneHelper { - public static T clone(T element) { - final CloneVisitor cloneVisitor = new CloneVisitor(); +/** + * {@link CloneHelper} is responsible for creating clones of {@link CtElement} AST nodes including the whole subtree. + * + * By default, the same instance of {@link CloneHelper} is used for whole clonning process. + * + * However, by subclassing this class and overriding method {@link #clone(CtElement)}, + * one can extend and/or modify the cloning behavior. + * + * For instance, one can listen to each call to clone and get each pair of `clone source` and `clone target`. + */ +public class CloneHelper { + public static final CloneHelper INSTANCE = new CloneHelper(); + + public T clone(T element) { + final CloneVisitor cloneVisitor = new CloneVisitor(this); cloneVisitor.scan(element); return cloneVisitor.getClone(); } - public static Collection clone(Collection elements) { + public Collection clone(Collection elements) { if (elements == null || elements.isEmpty()) { return new ArrayList<>(); } Collection others = new ArrayList<>(); for (T element : elements) { - others.add(CloneHelper.clone(element)); + others.add(clone(element)); } return others; } - public static List clone(List elements) { + public List clone(List elements) { if (elements instanceof EmptyClearableList) { return elements; } @@ -57,12 +69,12 @@ public static List clone(List elements) { } List others = new ArrayList<>(); for (T element : elements) { - others.add(CloneHelper.clone(element)); + others.add(clone(element)); } return others; } - private static Set createRightSet(Set elements) { + private Set createRightSet(Set elements) { try { if (elements instanceof TreeSet) { // we copy the set, incl its comparator @@ -78,7 +90,7 @@ private static Set createRightSet(Set elements) { } } - public static Set clone(Set elements) { + public Set clone(Set elements) { if (elements instanceof EmptyClearableSet) { return elements; } @@ -88,23 +100,19 @@ public static Set clone(Set elements) { Set others = createRightSet(elements); for (T element : elements) { - others.add(CloneHelper.clone(element)); + others.add(clone(element)); } return others; } - public static Map clone(Map elements) { + public Map clone(Map elements) { if (elements == null || elements.isEmpty()) { return new HashMap<>(); } Map others = new HashMap<>(); for (Map.Entry tEntry : elements.entrySet()) { - others.put(tEntry.getKey(), CloneHelper.clone(tEntry.getValue())); + others.put(tEntry.getKey(), clone(tEntry.getValue())); } return others; } - - private CloneHelper() { - throw new AssertionError("No instance."); - } } diff --git a/src/test/java/spoon/reflect/ast/CloneTest.java b/src/test/java/spoon/reflect/ast/CloneTest.java index 6af6c917c2d..a9d25d17133 100644 --- a/src/test/java/spoon/reflect/ast/CloneTest.java +++ b/src/test/java/spoon/reflect/ast/CloneTest.java @@ -6,16 +6,27 @@ import spoon.processing.AbstractProcessor; import spoon.reflect.code.CtConditional; import spoon.reflect.declaration.CtClass; +import spoon.reflect.declaration.CtElement; import spoon.reflect.declaration.CtInterface; import spoon.reflect.declaration.CtMethod; +import spoon.reflect.declaration.CtType; +import spoon.reflect.factory.Factory; import spoon.reflect.visitor.CtScanner; +import spoon.reflect.visitor.DefaultJavaPrettyPrinter; +import spoon.reflect.visitor.PrinterHelper; import spoon.reflect.visitor.Query; import spoon.reflect.visitor.filter.TypeFilter; +import spoon.support.visitor.equals.CloneHelper; +import spoon.testing.utils.ModelUtils; +import java.io.File; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.IdentityHashMap; +import java.util.Map; import java.util.stream.Collectors; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.*; public class CloneTest { @Test @@ -99,4 +110,42 @@ public void process(CtConditional conditional) { }); launcher.run(); } + + @Test + public void testCloneListener() throws Exception { + // contract: it is possible to extend the cloning behavior + + // in this example extension, a listener of cloning process gets access to origin node and cloned node + // we check the contract with some complicated class as target of cloning + Factory factory = ModelUtils.build(new File("./src/main/java/spoon/reflect/visitor/DefaultJavaPrettyPrinter.java")); + CtType cloneSource = factory.Type().get(DefaultJavaPrettyPrinter.class); + class CloneListener extends CloneHelper { + Map sourceToTarget = new IdentityHashMap<>(); + @Override + public T clone(T source) { + if (source == null) { + return null; + } + T target = super.clone(source); + onCloned(source, target); + return target; + } + private void onCloned(CtElement source, CtElement target) { + CtElement previousTarget = sourceToTarget.put(source, target); + assertNull(previousTarget); + } + } + + CloneListener cl = new CloneListener(); + CtType cloneTarget = cl.clone(cloneSource); + + cloneSource.filterChildren(null).forEach(sourceElement -> { + //contract: there exists cloned target for each visitable element + CtElement targetElement = cl.sourceToTarget.remove(sourceElement); + assertNotNull("Missing target for sourceElement\n" + sourceElement, targetElement); + assertEquals("Source and Target are not equal", sourceElement, targetElement); + }); + //contract: each visitable elements was cloned exactly once. No more no less. + assertTrue(cl.sourceToTarget.isEmpty()); + } }