@CopyMethod static List<Node> getValues(Annotation self, String key) { for (AnnotationElement elem : self.astElements()) { if (key == null && elem.astName() == null) return elem.getValues(); if (key != null && elem.astName() != null && elem.astName().astValue().equals(key)) return elem.getValues(); } return ImmutableList.of(); } }
@CopyMethod static List<Node> getValues(Annotation self, String key) { for (AnnotationElement elem : self.astElements()) { if (key == null && elem.astName() == null) return elem.getValues(); if (key != null && elem.astName() != null && elem.astName().astValue().equals(key)) return elem.getValues(); } return ImmutableList.of(); } }
for (AnnotationElement elem : node.astElements()) { if (!(elem.astName() == null && name.equals("value")) && !name.equals(elem.astName())) continue; for (Node val : elem.getValues()) {
for (AnnotationElement elem : node.astElements()) { if (!(elem.astName() == null && name.equals("value")) && !name.equals(elem.astName())) continue; for (Node val : elem.getValues()) {
@Override public void visitSingleMemberAnnotation(SingleMemberAnnotation node) { lombok.ast.Annotation annot = createAnnotation(node); lombok.ast.AnnotationElement element = new lombok.ast.AnnotationElement(); element.astValue((lombok.ast.AnnotationValue) toTree(node.memberValue)); annot.astElements().addToEnd(element); annot.setPosition(toPosition(node.sourceStart, node.declarationSourceEnd)); set(node, annot); }
@Override public void visitSingleMemberAnnotation(SingleMemberAnnotation node) { lombok.ast.Annotation annot = createAnnotation(node); lombok.ast.AnnotationElement element = new lombok.ast.AnnotationElement(); element.astValue((lombok.ast.AnnotationValue) toTree(node.memberValue)); annot.astElements().addToEnd(element); annot.setPosition(toPosition(node.sourceStart, node.declarationSourceEnd)); set(node, annot); }
@Override public void visitSingleMemberAnnotation(SingleMemberAnnotation node) { lombok.ast.Annotation annot = createAnnotation(node); lombok.ast.AnnotationElement element = new lombok.ast.AnnotationElement(); element.astValue((lombok.ast.AnnotationValue) toTree(node.memberValue)); annot.astElements().addToEnd(element); annot.setPosition(toPosition(node.sourceStart, node.declarationSourceEnd)); set(node, annot); }
@CopyMethod static List<Node> getValues(Annotation self, String key) { for (AnnotationElement elem : self.astElements()) { if (key == null && elem.astName() == null) return elem.getValues(); if (key != null && elem.astName() != null && elem.astName().astValue().equals(key)) return elem.getValues(); } return ImmutableList.of(); } }
@Override public boolean visitAnnotation(Annotation node) { int start = node.getPosition().getStart(); int end = node.getPosition().getEnd(); // Newer javacs //int end = node.astAnnotationTypeReference().getPosition().getEnd(); // Older javacs return set(node, setPos(start, end, treeMaker.Annotation(toTree(node.astAnnotationTypeReference()), toList(JCExpression.class, node.astElements())))); }
@Override public boolean visitAnnotation(lombok.ast.Annotation node) { //TODO add test where the value is the result of string concatenation TypeReference type = (TypeReference) toTree(node.astAnnotationTypeReference()); boolean isEcjNormal = Position.UNPLACED == getConversionPositionInfo(node, "isNormalAnnotation"); if (node.astElements().isEmpty() && countStructure(node, "(") == 0 && !isEcjNormal) { MarkerAnnotation ann = new MarkerAnnotation(type, start(node)); ann.declarationSourceEnd = end(node); return set(node, ann); } MemberValuePair[] values = toArray(MemberValuePair.class, node.astElements()); if (values != null && (values.length == 1 && values[0].name == null)) { SingleMemberAnnotation ann = new SingleMemberAnnotation(type, start(node)); ann.declarationSourceEnd = end(node); ann.memberValue = values[0].value; return set(node, ann); } NormalAnnotation ann = new NormalAnnotation(type, start(node)); ann.declarationSourceEnd = end(node); ann.memberValuePairs = values; return set(node, ann); }
@Override public boolean visitAnnotation(Annotation node) { int start = node.getPosition().getStart(); int end = node.getPosition().getEnd(); // Newer javacs //int end = node.astAnnotationTypeReference().getPosition().getEnd(); // Older javacs return set(node, setPos(start, end, treeMaker.Annotation(toTree(node.astAnnotationTypeReference()), toList(JCExpression.class, node.astElements())))); }
@Override public boolean visitAnnotation(Annotation node) { int start = node.getPosition().getStart(); int end = node.getPosition().getEnd(); // Newer javacs //int end = node.astAnnotationTypeReference().getPosition().getEnd(); // Older javacs return set(node, setPos(start, end, treeMaker.Annotation(toTree(node.astAnnotationTypeReference()), toList(JCExpression.class, node.astElements())))); }
@Override public boolean visitAnnotation(lombok.ast.Annotation node) { //TODO add test where the value is the result of string concatenation TypeReference type = (TypeReference) toTree(node.astAnnotationTypeReference()); boolean isEcjNormal = Position.UNPLACED == getConversionPositionInfo(node, "isNormalAnnotation"); if (node.astElements().isEmpty() && countStructure(node, "(") == 0 && !isEcjNormal) { MarkerAnnotation ann = new MarkerAnnotation(type, start(node)); ann.declarationSourceEnd = end(node); return set(node, ann); } MemberValuePair[] values = toArray(MemberValuePair.class, node.astElements()); if (values != null && (values.length == 1 && values[0].name == null)) { SingleMemberAnnotation ann = new SingleMemberAnnotation(type, start(node)); ann.declarationSourceEnd = end(node); ann.memberValue = values[0].value; return set(node, ann); } NormalAnnotation ann = new NormalAnnotation(type, start(node)); ann.declarationSourceEnd = end(node); ann.memberValuePairs = values; return set(node, ann); }
@Override public boolean visitAnnotation(lombok.ast.Annotation node) { //TODO add test where the value is the result of string concatenation TypeReference type = (TypeReference) toTree(node.astAnnotationTypeReference()); boolean isEcjNormal = Position.UNPLACED == getConversionPositionInfo(node, "isNormalAnnotation"); if (node.astElements().isEmpty() && countStructure(node, "(") == 0 && !isEcjNormal) { MarkerAnnotation ann = new MarkerAnnotation(type, start(node)); ann.declarationSourceEnd = end(node); return set(node, ann); } MemberValuePair[] values = toArray(MemberValuePair.class, node.astElements()); if (values != null && (values.length == 1 && values[0].name == null)) { SingleMemberAnnotation ann = new SingleMemberAnnotation(type, start(node)); ann.declarationSourceEnd = end(node); ann.memberValue = values[0].value; return set(node, ann); } NormalAnnotation ann = new NormalAnnotation(type, start(node)); ann.declarationSourceEnd = end(node); ann.memberValuePairs = values; return set(node, ann); }
parent = parent.getParent(); if (parent instanceof VariableDefinition) { for (AnnotationElement element : node.astElements()) { AnnotationValue valueNode = element.astValue(); if (valueNode == null) {
|| typeName.endsWith("SuppressWarnings")) { StrictListAccessor<AnnotationElement, Annotation> values = annotation.astElements(); if (values != null) { for (AnnotationElement element : values) {
@Override public void visitAnnotation(JCAnnotation node) { Annotation a = new Annotation(); a.rawAnnotationTypeReference(toTree(node.getAnnotationType(), FlagKey.TYPE_REFERENCE)); for (JCExpression elem : node.getArguments()) { AnnotationElement e = new AnnotationElement(); if (elem instanceof JCAssign) { JCExpression rawName = ((JCAssign) elem).getVariable(); if (rawName instanceof JCIdent) e.astName(setPos(rawName, new Identifier().astValue(((JCIdent)rawName).getName().toString()))); elem = ((JCAssign) elem).getExpression(); } e.rawValue(toTree(elem)); a.astElements().addToEnd(e); } set(node, a); } }
if (typeName.endsWith(TARGET_API)) { StrictListAccessor<AnnotationElement, Annotation> values = annotation.astElements(); if (values != null) { for (AnnotationElement element : values) {
@Override public void visitAnnotation(JCAnnotation node) { Annotation a = new Annotation(); a.rawAnnotationTypeReference(toTree(node.getAnnotationType(), FlagKey.TYPE_REFERENCE)); for (JCExpression elem : node.getArguments()) { AnnotationElement e = new AnnotationElement(); if (elem instanceof JCAssign) { JCExpression rawName = ((JCAssign) elem).getVariable(); if (rawName instanceof JCIdent) e.astName(setPos(rawName, new Identifier().astValue(((JCIdent)rawName).getName().toString()))); elem = ((JCAssign) elem).getExpression(); } e.rawValue(toTree(elem)); a.astElements().addToEnd(e); } set(node, a); } }
@Override public void visitAnnotation(JCAnnotation node) { Annotation a = new Annotation(); a.rawAnnotationTypeReference(toTree(node.getAnnotationType(), FlagKey.TYPE_REFERENCE)); for (JCExpression elem : node.getArguments()) { AnnotationElement e = new AnnotationElement(); if (elem instanceof JCAssign) { JCExpression rawName = ((JCAssign) elem).getVariable(); if (rawName instanceof JCIdent) e.astName(setPos(rawName, new Identifier().astValue(((JCIdent)rawName).getName().toString()))); elem = ((JCAssign) elem).getExpression(); } e.rawValue(toTree(elem)); a.astElements().addToEnd(e); } set(node, a); } }