private static boolean hasConversionStructureInfo(Node node, String key) { return Position.UNPLACED == getConversionPositionInfo(node, key); }
private static boolean hasConversionStructureInfo(Node node, String key) { return Position.UNPLACED == getConversionPositionInfo(node, key); }
private static boolean hasConversionStructureInfo(Node node, String key) { return Position.UNPLACED == getConversionPositionInfo(node, key); }
private JCExpression reParen(Node node, JCExpression expr) { int start, end; Position jcParensPos = getConversionPositionInfo(node, "()"); start = jcParensPos == null ? posOfStructure(node, "(", true) : jcParensPos.getStart(); end = jcParensPos == null ? posOfStructure(node, ")", false) : jcParensPos.getEnd(); return setPos(start, end, treeMaker.Parens(expr)); }
private JCExpression reParen(Node node, JCExpression expr) { int start, end; Position jcParensPos = getConversionPositionInfo(node, "()"); start = jcParensPos == null ? posOfStructure(node, "(", true) : jcParensPos.getStart(); end = jcParensPos == null ? posOfStructure(node, ")", false) : jcParensPos.getEnd(); return setPos(start, end, treeMaker.Parens(expr)); }
private JCExpression reParen(Node node, JCExpression expr) { int start, end; Position jcParensPos = getConversionPositionInfo(node, "()"); start = jcParensPos == null ? posOfStructure(node, "(", true) : jcParensPos.getStart(); end = jcParensPos == null ? posOfStructure(node, ")", false) : jcParensPos.getEnd(); return setPos(start, end, treeMaker.Parens(expr)); }
private JCExpression addDimensions(Node node, JCExpression type, int dimensions) { JCExpression resultingType = type; for (int i = 0; i < dimensions; i++) { int start, end; int currentDim = dimensions - i - 1; Position jcBracketPos = getConversionPositionInfo(node, "[]" + i); if (jcBracketPos == null) { start = posOfStructure(node, "[", currentDim, true); end = posOfStructure(node, "]", false); } else { start = jcBracketPos.getStart(); end = jcBracketPos.getEnd(); } resultingType = setPos(start, end, treeMaker.TypeArray(resultingType)); } return resultingType; }
private JCExpression addDimensions(Node node, JCExpression type, int dimensions) { JCExpression resultingType = type; for (int i = 0; i < dimensions; i++) { int start, end; int currentDim = dimensions - i - 1; Position jcBracketPos = getConversionPositionInfo(node, "[]" + i); if (jcBracketPos == null) { start = posOfStructure(node, "[", currentDim, true); end = posOfStructure(node, "]", false); } else { start = jcBracketPos.getStart(); end = jcBracketPos.getEnd(); } resultingType = setPos(start, end, treeMaker.TypeArray(resultingType)); } return resultingType; }
@Override public boolean visitCast(lombok.ast.Cast node) { Expression typeRef = toExpression(node.astTypeReference()); Expression operand = toExpression(node.astOperand()); CastExpression expr = createCastExpression(typeRef, operand); Position ecjTypePos = getConversionPositionInfo(node, "type"); typeRef.sourceStart = ecjTypePos == null ? posOfStructure(node, "(", true) + 1 : ecjTypePos.getStart(); typeRef.sourceEnd = ecjTypePos == null ? posOfStructure(node, ")", 0, false) - 2 : ecjTypePos.getEnd() - 1; expr.sourceStart = start(node); expr.sourceEnd = end(node); return set(node, expr); }
@Override public boolean visitCast(lombok.ast.Cast node) { Expression typeRef = toExpression(node.astTypeReference()); Expression operand = toExpression(node.astOperand()); CastExpression expr = createCastExpression(typeRef, operand); Position ecjTypePos = getConversionPositionInfo(node, "type"); typeRef.sourceStart = ecjTypePos == null ? posOfStructure(node, "(", true) + 1 : ecjTypePos.getStart(); typeRef.sourceEnd = ecjTypePos == null ? posOfStructure(node, ")", 0, false) - 2 : ecjTypePos.getEnd() - 1; expr.sourceStart = start(node); expr.sourceEnd = end(node); return set(node, expr); }
@Override public boolean visitCast(lombok.ast.Cast node) { Expression typeRef = toExpression(node.astTypeReference()); Expression operand = toExpression(node.astOperand()); CastExpression expr = createCastExpression(typeRef, operand); Position ecjTypePos = getConversionPositionInfo(node, "type"); typeRef.sourceStart = ecjTypePos == null ? posOfStructure(node, "(", true) + 1 : ecjTypePos.getStart(); typeRef.sourceEnd = ecjTypePos == null ? posOfStructure(node, ")", 0, false) - 2 : ecjTypePos.getEnd() - 1; expr.sourceStart = start(node); expr.sourceEnd = end(node); return set(node, expr); }
@Override public boolean visitImportDeclaration(ImportDeclaration node) { JCExpression name = chain(node.astParts()); if (node.astStarImport()) { int start, end; Position jcDotStarPos = getConversionPositionInfo(node, ".*"); start = jcDotStarPos == null ? posOfStructure(node, ".", true) : jcDotStarPos.getStart(); end = jcDotStarPos == null ? posOfStructure(node, "*", false) : jcDotStarPos.getEnd(); name = setPos(start, end, treeMaker.Select(name, table.asterisk)); } return posSet(node, treeMaker.Import(name, node.astStaticImport())); }
@Override public boolean visitImportDeclaration(ImportDeclaration node) { JCExpression name = chain(node.astParts()); if (node.astStarImport()) { int start, end; Position jcDotStarPos = getConversionPositionInfo(node, ".*"); start = jcDotStarPos == null ? posOfStructure(node, ".", true) : jcDotStarPos.getStart(); end = jcDotStarPos == null ? posOfStructure(node, "*", false) : jcDotStarPos.getEnd(); name = setPos(start, end, treeMaker.Select(name, table.asterisk)); } return posSet(node, treeMaker.Import(name, node.astStaticImport())); }
@Override public boolean visitImportDeclaration(ImportDeclaration node) { JCExpression name = chain(node.astParts()); if (node.astStarImport()) { int start, end; Position jcDotStarPos = getConversionPositionInfo(node, ".*"); start = jcDotStarPos == null ? posOfStructure(node, ".", true) : jcDotStarPos.getStart(); end = jcDotStarPos == null ? posOfStructure(node, "*", false) : jcDotStarPos.getEnd(); name = setPos(start, end, treeMaker.Select(name, table.asterisk)); } return posSet(node, treeMaker.Import(name, node.astStaticImport())); }
@Override public boolean visitAlternateConstructorInvocation(lombok.ast.AlternateConstructorInvocation node) { ExplicitConstructorCall inv = new ExplicitConstructorCall(ExplicitConstructorCall.This); inv.sourceStart = posOfStructure(node, "this", true); inv.sourceEnd = end(node); // inv.modifiers = decl.modifiers & VISIBILITY_MASK; if (!node.astConstructorTypeArguments().isEmpty()) { inv.typeArguments = toArray(TypeReference.class, node.astConstructorTypeArguments()); Position ecjTypeArgsPos = getConversionPositionInfo(node, "typeArguments"); inv.typeArgumentsSourceStart = ecjTypeArgsPos == null ? posOfStructure(node, "<", true) : ecjTypeArgsPos.getStart(); } inv.arguments = toArray(Expression.class, node.astArguments()); return set(node, inv); }
@Override public boolean visitAlternateConstructorInvocation(lombok.ast.AlternateConstructorInvocation node) { ExplicitConstructorCall inv = new ExplicitConstructorCall(ExplicitConstructorCall.This); inv.sourceStart = posOfStructure(node, "this", true); inv.sourceEnd = end(node); // inv.modifiers = decl.modifiers & VISIBILITY_MASK; if (!node.astConstructorTypeArguments().isEmpty()) { inv.typeArguments = toArray(TypeReference.class, node.astConstructorTypeArguments()); Position ecjTypeArgsPos = getConversionPositionInfo(node, "typeArguments"); inv.typeArgumentsSourceStart = ecjTypeArgsPos == null ? posOfStructure(node, "<", true) : ecjTypeArgsPos.getStart(); } inv.arguments = toArray(Expression.class, node.astArguments()); return set(node, inv); }
@Override public boolean visitAlternateConstructorInvocation(lombok.ast.AlternateConstructorInvocation node) { ExplicitConstructorCall inv = new ExplicitConstructorCall(ExplicitConstructorCall.This); inv.sourceStart = posOfStructure(node, "this", true); inv.sourceEnd = end(node); // inv.modifiers = decl.modifiers & VISIBILITY_MASK; if (!node.astConstructorTypeArguments().isEmpty()) { inv.typeArguments = toArray(TypeReference.class, node.astConstructorTypeArguments()); Position ecjTypeArgsPos = getConversionPositionInfo(node, "typeArguments"); inv.typeArgumentsSourceStart = ecjTypeArgsPos == null ? posOfStructure(node, "<", true) : ecjTypeArgsPos.getStart(); } inv.arguments = toArray(Expression.class, node.astArguments()); return set(node, inv); }
@Override public boolean visitSuperConstructorInvocation(lombok.ast.SuperConstructorInvocation node) { ExplicitConstructorCall inv = new ExplicitConstructorCall(ExplicitConstructorCall.Super); inv.sourceStart = start(node); inv.sourceEnd = end(node); // inv.modifiers = decl.modifiers & VISIBILITY_MASK; if (!node.astConstructorTypeArguments().isEmpty()) { inv.typeArguments = toArray(TypeReference.class, node.astConstructorTypeArguments()); Position ecjTypeArgsPos = getConversionPositionInfo(node, "typeArguments"); inv.typeArgumentsSourceStart = ecjTypeArgsPos == null ? posOfStructure(node, "<", true) : ecjTypeArgsPos.getStart(); } inv.arguments = toArray(Expression.class, node.astArguments()); inv.qualification = toExpression(node.astQualifier()); return set(node, inv); }
@Override public boolean visitSuperConstructorInvocation(lombok.ast.SuperConstructorInvocation node) { ExplicitConstructorCall inv = new ExplicitConstructorCall(ExplicitConstructorCall.Super); inv.sourceStart = start(node); inv.sourceEnd = end(node); // inv.modifiers = decl.modifiers & VISIBILITY_MASK; if (!node.astConstructorTypeArguments().isEmpty()) { inv.typeArguments = toArray(TypeReference.class, node.astConstructorTypeArguments()); Position ecjTypeArgsPos = getConversionPositionInfo(node, "typeArguments"); inv.typeArgumentsSourceStart = ecjTypeArgsPos == null ? posOfStructure(node, "<", true) : ecjTypeArgsPos.getStart(); } inv.arguments = toArray(Expression.class, node.astArguments()); inv.qualification = toExpression(node.astQualifier()); return set(node, inv); }
@Override public boolean visitTypeReferencePart(TypeReferencePart node) { JCIdent ident = (JCIdent) toTree(node.astIdentifier()); List<JCExpression> typeArguments = toList(JCExpression.class, node.astTypeArguments()); if (typeArguments.isEmpty()) { return set(node, ident); } else { JCTypeApply typeApply = treeMaker.TypeApply(ident, typeArguments); Position jcOpenBracketPos = getConversionPositionInfo(node, "<"); if (jcOpenBracketPos == null) { setPos(posOfStructure(node, "<", true), node.getPosition().getEnd(), typeApply); } else { setPos(jcOpenBracketPos.getStart(), node.getPosition().getEnd(), typeApply); } return set(node, typeApply); } }