@Override public void visitTypeApply(JCTypeApply node) { TypeReference ref = (TypeReference) toTree(node.clazz, FlagKey.TYPE_REFERENCE); TypeReferencePart last = ref.astParts().last(); fillList(node.arguments, last.rawTypeArguments(), FlagKey.TYPE_REFERENCE); setPos(node, ref); setConversionPositionInfo(last, "<", getPosition(node)); set(node, ref); }
@Override public void visitTypeArray(JCArrayTypeTree node) { TypeReference ref = (TypeReference) toTree(node.getType(), FlagKey.TYPE_REFERENCE); int currentDim = ref.astArrayDimensions(); ref.astArrayDimensions(currentDim + 1); setConversionPositionInfo(ref, "[]" + currentDim, getPosition(node)); set(node, ref); }
@Override public void visitExec(JCExpressionStatement node) { Node expr = toTree(node.getExpression()); if (expr instanceof SuperConstructorInvocation || expr instanceof AlternateConstructorInvocation) { setConversionPositionInfo(expr, "exec", getPosition(node)); set(node, expr); return; } ExpressionStatement exec = new ExpressionStatement(); exec.rawExpression(expr); set(node, exec); }
@Override public void visitAnnotationMethodDeclaration(AnnotationMethodDeclaration node) { lombok.ast.AnnotationMethodDeclaration decl = new lombok.ast.AnnotationMethodDeclaration(); decl.astMethodName(toIdentifier(node.selector, node.sourceStart, node.sourceEnd)); decl.astJavadoc((lombok.ast.Comment) toTree(node.javadoc)); decl.astModifiers(toModifiers(node.modifiers, node.annotations, node.modifiersSourceStart, node.declarationSourceStart)); decl.astReturnTypeReference((lombok.ast.TypeReference) toTree(node.returnType)); decl.astDefaultValue((lombok.ast.Expression) toTree(node.defaultValue)); setConversionPositionInfo(decl, "signature", toPosition(node.sourceStart, node.sourceEnd)); setConversionPositionInfo(decl, "extendedDimensions", new Position(node.extendedDimensions, -1)); decl.setPosition(toPosition(node.declarationSourceStart, node.declarationSourceEnd)); set(node, decl); }
@Override public void visitTypeArray(JCArrayTypeTree node) { TypeReference ref = (TypeReference) toTree(node.getType(), FlagKey.TYPE_REFERENCE); int currentDim = ref.astArrayDimensions(); ref.astArrayDimensions(currentDim + 1); setConversionPositionInfo(ref, "[]" + currentDim, getPosition(node)); set(node, ref); }
@Override public void visitAnnotationMethodDeclaration(AnnotationMethodDeclaration node) { lombok.ast.AnnotationMethodDeclaration decl = new lombok.ast.AnnotationMethodDeclaration(); decl.astMethodName(toIdentifier(node.selector, node.sourceStart, node.sourceEnd)); decl.astJavadoc((lombok.ast.Comment) toTree(node.javadoc)); decl.astModifiers(toModifiers(node.modifiers, node.annotations, node.modifiersSourceStart, node.declarationSourceStart)); decl.astReturnTypeReference((lombok.ast.TypeReference) toTree(node.returnType)); decl.astDefaultValue((lombok.ast.Expression) toTree(node.defaultValue)); setConversionPositionInfo(decl, "signature", toPosition(node.sourceStart, node.sourceEnd)); setConversionPositionInfo(decl, "extendedDimensions", new Position(node.extendedDimensions, -1)); decl.setPosition(toPosition(node.declarationSourceStart, node.declarationSourceEnd)); set(node, decl); }
@Override public void visitTypeArray(JCArrayTypeTree node) { TypeReference ref = (TypeReference) toTree(node.getType(), FlagKey.TYPE_REFERENCE); int currentDim = ref.astArrayDimensions(); ref.astArrayDimensions(currentDim + 1); setConversionPositionInfo(ref, "[]" + currentDim, getPosition(node)); set(node, ref); }
@Override public void visitTypeApply(JCTypeApply node) { TypeReference ref = (TypeReference) toTree(node.clazz, FlagKey.TYPE_REFERENCE); TypeReferencePart last = ref.astParts().last(); fillList(node.arguments, last.rawTypeArguments(), FlagKey.TYPE_REFERENCE); setPos(node, ref); setConversionPositionInfo(last, "<", getPosition(node)); set(node, ref); }
@Override public void visitCastExpression(CastExpression node) { TypeReference ref = getTypeFromCast(node); Node result = toTree(ref, FlagKey.NAMEREFERENCE_IS_TYPE); lombok.ast.Cast cast = new lombok.ast.Cast().astTypeReference((lombok.ast.TypeReference) result); cast.astOperand((lombok.ast.Expression)toTree(node.expression)); setConversionPositionInfo(cast, "type", toPosition(ref.sourceStart, ref.sourceEnd)); set(node, setPosition(node, cast)); }
@Override public void visitDoLoop(JCDoWhileLoop node) { DoWhile dw = new DoWhile(); JCExpression cond = node.getCondition(); setConversionPositionInfo(dw, "()", getPosition(cond)); set(node, dw.rawCondition(toTree(removeParens(cond))).rawStatement(toTree(node.getStatement()))); }
@Override public void visitWhileLoop(JCWhileLoop node) { While w = new While(); JCExpression cond = node.getCondition(); setConversionPositionInfo(w, "()", getPosition(cond)); set(node, w.rawCondition(toTree(removeParens(cond))).rawStatement(toTree(node.getStatement()))); }
@Override public void visitDoLoop(JCDoWhileLoop node) { DoWhile dw = new DoWhile(); JCExpression cond = node.getCondition(); setConversionPositionInfo(dw, "()", getPosition(cond)); set(node, dw.rawCondition(toTree(removeParens(cond))).rawStatement(toTree(node.getStatement()))); }
@Override public void visitDoLoop(JCDoWhileLoop node) { DoWhile dw = new DoWhile(); JCExpression cond = node.getCondition(); setConversionPositionInfo(dw, "()", getPosition(cond)); set(node, dw.rawCondition(toTree(removeParens(cond))).rawStatement(toTree(node.getStatement()))); }
@Override public void visitSynchronized(JCSynchronized node) { Synchronized s = new Synchronized(); JCExpression cond = node.getExpression(); setConversionPositionInfo(s, "()", getPosition(cond)); set(node, s.rawLock(toTree(removeParens(cond))).rawBody(toTree(node.getBlock()))); }
@Override public void visitSynchronized(JCSynchronized node) { Synchronized s = new Synchronized(); JCExpression cond = node.getExpression(); setConversionPositionInfo(s, "()", getPosition(cond)); set(node, s.rawLock(toTree(removeParens(cond))).rawBody(toTree(node.getBlock()))); }
@Override public void visitWhileLoop(JCWhileLoop node) { While w = new While(); JCExpression cond = node.getCondition(); setConversionPositionInfo(w, "()", getPosition(cond)); set(node, w.rawCondition(toTree(removeParens(cond))).rawStatement(toTree(node.getStatement()))); }
@Override public void visitIf(JCIf node) { If i = new If(); JCExpression cond = node.getCondition(); setConversionPositionInfo(i, "()", getPosition(cond)); i.rawCondition(toTree(removeParens(cond))); i.rawStatement(toTree(node.getThenStatement())); i.rawElseStatement(toTree(node.getElseStatement())); set(node, i); }
@Override public void visitIf(JCIf node) { If i = new If(); JCExpression cond = node.getCondition(); setConversionPositionInfo(i, "()", getPosition(cond)); i.rawCondition(toTree(removeParens(cond))); i.rawStatement(toTree(node.getThenStatement())); i.rawElseStatement(toTree(node.getElseStatement())); set(node, i); }
@Override public void visitImport(JCImport node) { ImportDeclaration imp = new ImportDeclaration(); fillWithIdentifiers(node.getQualifiedIdentifier(), imp.astParts()); Identifier last = imp.astParts().last(); if (last != null && "*".equals(last.astValue())) { imp.astParts().remove(last); imp.astStarImport(true); setConversionPositionInfo(imp, ".*", last.getPosition()); } imp.astStaticImport(node.isStatic()); set(node, imp); }
@Override public void visitImport(JCImport node) { ImportDeclaration imp = new ImportDeclaration(); fillWithIdentifiers(node.getQualifiedIdentifier(), imp.astParts()); Identifier last = imp.astParts().last(); if (last != null && "*".equals(last.astValue())) { imp.astParts().remove(last); imp.astStarImport(true); setConversionPositionInfo(imp, ".*", last.getPosition()); } imp.astStaticImport(node.isStatic()); set(node, imp); }