public <T> void visitCtLiteral(final spoon.reflect.code.CtLiteral<T> literal) { spoon.reflect.code.CtLiteral other = ((spoon.reflect.code.CtLiteral) (this.stack.peek())); enter(literal); biScan(spoon.reflect.path.CtRole.ANNOTATION, literal.getAnnotations(), other.getAnnotations()); biScan(spoon.reflect.path.CtRole.TYPE, literal.getType(), other.getType()); biScan(spoon.reflect.path.CtRole.CAST, literal.getTypeCasts(), other.getTypeCasts()); biScan(spoon.reflect.path.CtRole.COMMENT, literal.getComments(), other.getComments()); exit(literal); }
@Override public <T> void visitCtLiteral(CtLiteral<T> literal) { super.visitCtLiteral(literal); if (!literalsValues.contains(literal) && !"String".equals(literal.getType().getSimpleName())) literalsValues.add(literal); }
public <T> void visitCtLiteral(final CtLiteral<T> literal) { enter(literal); scan(CtRole.ANNOTATION, literal.getAnnotations()); scan(CtRole.TYPE, literal.getType()); scan(CtRole.CAST, literal.getTypeCasts()); scan(CtRole.COMMENT, literal.getComments()); exit(literal); }
@Override public List<LiteralPlaceholder> createTOS(T ingredientSource) { List<LiteralPlaceholder> results = new ArrayList<>(); boolean mustclone = false; List<CtLiteral> literals = ip.createFixSpace(ingredientSource, mustclone); for (CtLiteral ctLiteral : literals) { //TODO: int i = 0; LiteralPlaceholder lp = new LiteralPlaceholder("_l_"+ctLiteral.getType().getSimpleName()+"_"+i, ctLiteral); results.add(lp); } return results; }
@java.lang.Override public <T> void visitCtLiteral(final spoon.reflect.code.CtLiteral<T> literal) { replaceInListIfExist(literal.getAnnotations(), new spoon.support.visitor.replace.ReplacementVisitor.CtElementAnnotationsReplaceListener(literal)); replaceElementIfExist(literal.getType(), new spoon.support.visitor.replace.ReplacementVisitor.CtTypedElementTypeReplaceListener(literal)); replaceInListIfExist(literal.getTypeCasts(), new spoon.support.visitor.replace.ReplacementVisitor.CtExpressionTypeCastsReplaceListener(literal)); replaceInListIfExist(literal.getComments(), new spoon.support.visitor.replace.ReplacementVisitor.CtElementCommentsReplaceListener(literal)); }
public List<Transformation> process(ModificationPoint modificationPoint, LiteralPlaceholder literalPlaceholder) { List<Transformation> transformation = new ArrayList<>(); /// List<Ingredient> ingredients = getSpace(modificationPoint.getProgramVariant()) .getIngredients(modificationPoint.getCodeElement()); logger.debug("Ingredients lit (" + ingredients.size() + ") " + ingredients); // logger.debug("Placeholder vars "+ // varplaceholder.getPalceholders().keySet().size()); for (Ingredient ctCodeElement : ingredients) { CtLiteral literal4Space = (CtLiteral) ctCodeElement.getCode(); if (literal4Space.getType().isSubtypeOf(literalPlaceholder.getAffected().getType())) { Transformation t = new LiteralTransformation(literalPlaceholder, literalPlaceholder.getAffected(), literal4Space.getValue()); transformation.add(t); } } return transformation; }
public <T> void visitCtLiteral(final spoon.reflect.code.CtLiteral<T> literal) { spoon.reflect.code.CtLiteral<T> aCtLiteral = literal.getFactory().Core().createLiteral(); this.builder.copy(literal, aCtLiteral); 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.cloneHelper.tailor(literal, aCtLiteral); this.other = aCtLiteral; }
public List<Transformation> process(ModificationPoint modificationPoint, VarLiPlaceholder varLiPlaceholder) { List<Transformation> transformation = new ArrayList<>(); List<Ingredient> ingredients = getSpace(modificationPoint.getProgramVariant()) .getIngredients(modificationPoint.getCodeElement()); logger.debug("Ingredients lit (" + ingredients.size() + ") " + ingredients); for (Ingredient ctCodeElement : ingredients) { CtLiteral literal4Space = (CtLiteral) ctCodeElement.getCode(); if (literal4Space.getType().isSubtypeOf(varLiPlaceholder.getAffectedVariable().getType())) { Transformation t = new VarLiTransformation(varLiPlaceholder, varLiPlaceholder.getAffectedVariable(), literal4Space.clone()); transformation.add(t); } } return transformation; }
public <T> void visitCtLiteral(CtLiteral<T> literal) { enter(literal); scan(literal.getAnnotations()); scan(literal.getType()); scanReferences(literal.getTypeCasts()); T value = literal.getValue(); if (value instanceof CtReference) scan((CtReference) value); exit(literal); }