Search in sources :

Example 21 with ReturnStatement

use of org.codehaus.groovy.ast.stmt.ReturnStatement in project groovy by apache.

the class ReturnAdder method addReturnsIfNeeded.

private Statement addReturnsIfNeeded(final Statement statement, final VariableScope scope) {
    if (statement instanceof ReturnStatement || statement instanceof ThrowStatement || statement instanceof EmptyStatement || statement instanceof BytecodeSequence) {
        return statement;
    }
    if (statement == null) {
        ReturnStatement returnStatement = new ReturnStatement(nullX());
        listener.returnStatementAdded(returnStatement);
        return returnStatement;
    }
    if (statement instanceof ExpressionStatement) {
        Expression expression = ((ExpressionStatement) statement).getExpression();
        ReturnStatement returnStatement = new ReturnStatement(expression);
        returnStatement.copyStatementLabels(statement);
        returnStatement.setSourcePosition(statement.getLineNumber() < 0 ? expression : statement);
        listener.returnStatementAdded(returnStatement);
        return returnStatement;
    }
    if (statement instanceof SynchronizedStatement) {
        SynchronizedStatement syncStatement = (SynchronizedStatement) statement;
        Statement code = addReturnsIfNeeded(syncStatement.getCode(), scope);
        if (doAdd)
            syncStatement.setCode(code);
        return syncStatement;
    }
    if (statement instanceof IfStatement) {
        IfStatement ifElseStatement = (IfStatement) statement;
        Statement ifBlock = addReturnsIfNeeded(ifElseStatement.getIfBlock(), scope);
        Statement elseBlock = addReturnsIfNeeded(ifElseStatement.getElseBlock(), scope);
        if (doAdd) {
            ifElseStatement.setIfBlock(ifBlock);
            ifElseStatement.setElseBlock(elseBlock);
        }
        return ifElseStatement;
    }
    if (statement instanceof SwitchStatement) {
        SwitchStatement switchStatement = (SwitchStatement) statement;
        Statement defaultStatement = switchStatement.getDefaultStatement();
        List<CaseStatement> caseStatements = switchStatement.getCaseStatements();
        for (Iterator<CaseStatement> it = caseStatements.iterator(); it.hasNext(); ) {
            CaseStatement caseStatement = it.next();
            Statement code = adjustSwitchCaseCode(caseStatement.getCode(), scope, // GROOVY-9896: return if no default and last case lacks break
            defaultStatement == EmptyStatement.INSTANCE && !it.hasNext());
            if (doAdd)
                caseStatement.setCode(code);
        }
        defaultStatement = adjustSwitchCaseCode(defaultStatement, scope, true);
        if (doAdd)
            switchStatement.setDefaultStatement(defaultStatement);
        return switchStatement;
    }
    if (statement instanceof TryCatchStatement) {
        TryCatchStatement tryCatchFinally = (TryCatchStatement) statement;
        boolean[] missesReturn = new boolean[1];
        new ReturnAdder(returnStatement -> missesReturn[0] = true).addReturnsIfNeeded(tryCatchFinally.getFinallyStatement(), scope);
        boolean hasFinally = !(tryCatchFinally.getFinallyStatement() instanceof EmptyStatement);
        // there is nothing to do
        if (hasFinally && !missesReturn[0])
            return tryCatchFinally;
        // add returns to try and catch blocks
        Statement tryStatement = addReturnsIfNeeded(tryCatchFinally.getTryStatement(), scope);
        if (doAdd)
            tryCatchFinally.setTryStatement(tryStatement);
        for (CatchStatement catchStatement : tryCatchFinally.getCatchStatements()) {
            Statement code = addReturnsIfNeeded(catchStatement.getCode(), scope);
            if (doAdd)
                catchStatement.setCode(code);
        }
        return tryCatchFinally;
    }
    if (statement instanceof BlockStatement) {
        BlockStatement blockStatement = (BlockStatement) statement;
        if (blockStatement.isEmpty()) {
            ReturnStatement returnStatement = new ReturnStatement(nullX());
            returnStatement.copyStatementLabels(blockStatement);
            returnStatement.setSourcePosition(blockStatement);
            listener.returnStatementAdded(returnStatement);
            return returnStatement;
        } else {
            List<Statement> statements = blockStatement.getStatements();
            int lastIndex = statements.size() - 1;
            Statement last = addReturnsIfNeeded(statements.get(lastIndex), blockStatement.getVariableScope());
            if (doAdd)
                statements.set(lastIndex, last);
            return blockStatement;
        }
    }
    List<Statement> statements = new ArrayList<>(2);
    statements.add(statement);
    ReturnStatement returnStatement = new ReturnStatement(nullX());
    listener.returnStatementAdded(returnStatement);
    statements.add(returnStatement);
    BlockStatement blockStatement = new BlockStatement(statements, new VariableScope(scope));
    blockStatement.setSourcePosition(statement);
    return blockStatement;
}
Also used : Statement(org.codehaus.groovy.ast.stmt.Statement) VariableScope(org.codehaus.groovy.ast.VariableScope) Iterator(java.util.Iterator) BreakStatement(org.codehaus.groovy.ast.stmt.BreakStatement) ReturnStatement(org.codehaus.groovy.ast.stmt.ReturnStatement) CatchStatement(org.codehaus.groovy.ast.stmt.CatchStatement) SynchronizedStatement(org.codehaus.groovy.ast.stmt.SynchronizedStatement) ArrayList(java.util.ArrayList) EmptyStatement(org.codehaus.groovy.ast.stmt.EmptyStatement) Objects(java.util.Objects) SwitchStatement(org.codehaus.groovy.ast.stmt.SwitchStatement) IfStatement(org.codehaus.groovy.ast.stmt.IfStatement) List(java.util.List) MethodNode(org.codehaus.groovy.ast.MethodNode) ExpressionStatement(org.codehaus.groovy.ast.stmt.ExpressionStatement) BlockStatement(org.codehaus.groovy.ast.stmt.BlockStatement) ThrowStatement(org.codehaus.groovy.ast.stmt.ThrowStatement) TryCatchStatement(org.codehaus.groovy.ast.stmt.TryCatchStatement) GeneralUtils.nullX(org.codehaus.groovy.ast.tools.GeneralUtils.nullX) CaseStatement(org.codehaus.groovy.ast.stmt.CaseStatement) Expression(org.codehaus.groovy.ast.expr.Expression) DefaultGroovyMethods.last(org.codehaus.groovy.runtime.DefaultGroovyMethods.last) Statement(org.codehaus.groovy.ast.stmt.Statement) BreakStatement(org.codehaus.groovy.ast.stmt.BreakStatement) ReturnStatement(org.codehaus.groovy.ast.stmt.ReturnStatement) CatchStatement(org.codehaus.groovy.ast.stmt.CatchStatement) SynchronizedStatement(org.codehaus.groovy.ast.stmt.SynchronizedStatement) EmptyStatement(org.codehaus.groovy.ast.stmt.EmptyStatement) SwitchStatement(org.codehaus.groovy.ast.stmt.SwitchStatement) IfStatement(org.codehaus.groovy.ast.stmt.IfStatement) ExpressionStatement(org.codehaus.groovy.ast.stmt.ExpressionStatement) BlockStatement(org.codehaus.groovy.ast.stmt.BlockStatement) ThrowStatement(org.codehaus.groovy.ast.stmt.ThrowStatement) TryCatchStatement(org.codehaus.groovy.ast.stmt.TryCatchStatement) CaseStatement(org.codehaus.groovy.ast.stmt.CaseStatement) CaseStatement(org.codehaus.groovy.ast.stmt.CaseStatement) EmptyStatement(org.codehaus.groovy.ast.stmt.EmptyStatement) TryCatchStatement(org.codehaus.groovy.ast.stmt.TryCatchStatement) ArrayList(java.util.ArrayList) BlockStatement(org.codehaus.groovy.ast.stmt.BlockStatement) SynchronizedStatement(org.codehaus.groovy.ast.stmt.SynchronizedStatement) IfStatement(org.codehaus.groovy.ast.stmt.IfStatement) SwitchStatement(org.codehaus.groovy.ast.stmt.SwitchStatement) CatchStatement(org.codehaus.groovy.ast.stmt.CatchStatement) TryCatchStatement(org.codehaus.groovy.ast.stmt.TryCatchStatement) Expression(org.codehaus.groovy.ast.expr.Expression) ExpressionStatement(org.codehaus.groovy.ast.stmt.ExpressionStatement) ReturnStatement(org.codehaus.groovy.ast.stmt.ReturnStatement) ThrowStatement(org.codehaus.groovy.ast.stmt.ThrowStatement) VariableScope(org.codehaus.groovy.ast.VariableScope)

Example 22 with ReturnStatement

use of org.codehaus.groovy.ast.stmt.ReturnStatement in project groovy by apache.

the class AnnotationVisitor method checkCircularReference.

public void checkCircularReference(ClassNode searchClass, ClassNode attrType, Expression startExp) {
    if (!isValidAnnotationClass(attrType))
        return;
    if (!(startExp instanceof AnnotationConstantExpression)) {
        addError("Found '" + startExp.getText() + "' when expecting an Annotation Constant", startExp);
        return;
    }
    AnnotationConstantExpression ace = (AnnotationConstantExpression) startExp;
    AnnotationNode annotationNode = (AnnotationNode) ace.getValue();
    if (annotationNode.getClassNode().equals(searchClass)) {
        addError("Circular reference discovered in " + searchClass.getName(), startExp);
        return;
    }
    ClassNode cn = annotationNode.getClassNode();
    for (MethodNode method : cn.getMethods()) {
        if (method.getReturnType().equals(searchClass)) {
            addError("Circular reference discovered in " + cn.getName(), startExp);
        }
        ReturnStatement code = (ReturnStatement) method.getCode();
        if (code == null)
            continue;
        checkCircularReference(searchClass, method.getReturnType(), code.getExpression());
    }
}
Also used : ClassNode(org.codehaus.groovy.ast.ClassNode) MethodNode(org.codehaus.groovy.ast.MethodNode) AnnotationConstantExpression(org.codehaus.groovy.ast.expr.AnnotationConstantExpression) AnnotationNode(org.codehaus.groovy.ast.AnnotationNode) ReturnStatement(org.codehaus.groovy.ast.stmt.ReturnStatement)

Example 23 with ReturnStatement

use of org.codehaus.groovy.ast.stmt.ReturnStatement in project groovy by apache.

the class AnnotationConstantsVisitor method visitStatement.

private static void visitStatement(Statement statement, ClassNode returnType) {
    if (statement instanceof ReturnStatement) {
        // normal path
        ReturnStatement rs = (ReturnStatement) statement;
        rs.setExpression(transformConstantExpression(rs.getExpression(), returnType));
    } else if (statement instanceof ExpressionStatement) {
        // path for JavaStubGenerator
        ExpressionStatement es = (ExpressionStatement) statement;
        es.setExpression(transformConstantExpression(es.getExpression(), returnType));
    }
}
Also used : ExpressionStatement(org.codehaus.groovy.ast.stmt.ExpressionStatement) ReturnStatement(org.codehaus.groovy.ast.stmt.ReturnStatement)

Example 24 with ReturnStatement

use of org.codehaus.groovy.ast.stmt.ReturnStatement in project groovy by apache.

the class FinalVariableAnalyzer method fallsThrough.

/**
 * @return true if the block falls through, i.e. no break/return
 */
private boolean fallsThrough(Statement statement) {
    if (statement instanceof EmptyStatement) {
        return true;
    }
    if (statement instanceof ReturnStatement) {
        // from ReturnAdder
        return false;
    }
    // currently only possibility
    BlockStatement block = (BlockStatement) statement;
    if (block.getStatements().size() == 0) {
        return true;
    }
    Statement last = DefaultGroovyMethods.last(block.getStatements());
    boolean completesAbruptly = last instanceof ReturnStatement || last instanceof BreakStatement || last instanceof ThrowStatement || last instanceof ContinueStatement;
    return !completesAbruptly;
}
Also used : BreakStatement(org.codehaus.groovy.ast.stmt.BreakStatement) Statement(org.codehaus.groovy.ast.stmt.Statement) ThrowStatement(org.codehaus.groovy.ast.stmt.ThrowStatement) CaseStatement(org.codehaus.groovy.ast.stmt.CaseStatement) ContinueStatement(org.codehaus.groovy.ast.stmt.ContinueStatement) BreakStatement(org.codehaus.groovy.ast.stmt.BreakStatement) ReturnStatement(org.codehaus.groovy.ast.stmt.ReturnStatement) CatchStatement(org.codehaus.groovy.ast.stmt.CatchStatement) EmptyStatement(org.codehaus.groovy.ast.stmt.EmptyStatement) SwitchStatement(org.codehaus.groovy.ast.stmt.SwitchStatement) IfStatement(org.codehaus.groovy.ast.stmt.IfStatement) BlockStatement(org.codehaus.groovy.ast.stmt.BlockStatement) TryCatchStatement(org.codehaus.groovy.ast.stmt.TryCatchStatement) EmptyStatement(org.codehaus.groovy.ast.stmt.EmptyStatement) ReturnStatement(org.codehaus.groovy.ast.stmt.ReturnStatement) BlockStatement(org.codehaus.groovy.ast.stmt.BlockStatement) ThrowStatement(org.codehaus.groovy.ast.stmt.ThrowStatement) ContinueStatement(org.codehaus.groovy.ast.stmt.ContinueStatement)

Example 25 with ReturnStatement

use of org.codehaus.groovy.ast.stmt.ReturnStatement in project groovy by apache.

the class StaticTypeCheckingSupport method evaluateExpression.

/**
 * A helper method that can be used to evaluate expressions as found in annotation
 * parameters. For example, it will evaluate a constant, be it referenced directly as
 * an integer or as a reference to a field.
 * <p>
 * If this method throws an exception, then the expression cannot be evaluated on its own.
 *
 * @param expr   the expression to be evaluated
 * @param config the compiler configuration
 * @return the result of the expression
 */
public static Object evaluateExpression(final Expression expr, final CompilerConfiguration config) {
    Expression ce = expr instanceof CastExpression ? ((CastExpression) expr).getExpression() : expr;
    if (ce instanceof ConstantExpression) {
        if (expr.getType().equals(ce.getType()))
            return ((ConstantExpression) ce).getValue();
    } else if (ce instanceof ListExpression) {
        if (expr.getType().isArray() && expr.getType().getComponentType().equals(STRING_TYPE))
            return ((ListExpression) ce).getExpressions().stream().map(e -> evaluateExpression(e, config)).toArray(String[]::new);
    }
    String className = "Expression$" + UUID.randomUUID().toString().replace('-', '$');
    ClassNode simpleClass = new ClassNode(className, Opcodes.ACC_PUBLIC, OBJECT_TYPE);
    addGeneratedMethod(simpleClass, "eval", Opcodes.ACC_PUBLIC + Opcodes.ACC_STATIC, OBJECT_TYPE, Parameter.EMPTY_ARRAY, ClassNode.EMPTY_ARRAY, new ReturnStatement(expr));
    // adjust configuration so class can be inspected by this JVM
    CompilerConfiguration cc = new CompilerConfiguration(config);
    // unlikely to be required by expression
    cc.setPreviewFeatures(false);
    cc.setTargetBytecode(CompilerConfiguration.DEFAULT.getTargetBytecode());
    CompilationUnit cu = new CompilationUnit(cc);
    try {
        cu.addClassNode(simpleClass);
        cu.compile(Phases.CLASS_GENERATION);
        List<GroovyClass> classes = cu.getClasses();
        Class<?> aClass = cu.getClassLoader().defineClass(className, classes.get(0).getBytes());
        try {
            return aClass.getMethod("eval").invoke(null);
        } catch (ReflectiveOperationException e) {
            throw new GroovyBugError(e);
        }
    } finally {
        closeQuietly(cu.getClassLoader());
    }
}
Also used : Arrays(java.util.Arrays) BigInteger_TYPE(org.codehaus.groovy.ast.ClassHelper.BigInteger_TYPE) DEPRECATED_TYPE(org.codehaus.groovy.ast.ClassHelper.DEPRECATED_TYPE) COMPARE_GREATER_THAN(org.codehaus.groovy.syntax.Types.COMPARE_GREATER_THAN) GSTRING_TYPE(org.codehaus.groovy.ast.ClassHelper.GSTRING_TYPE) WideningCategories.isFloatingCategory(org.codehaus.groovy.ast.tools.WideningCategories.isFloatingCategory) Character_TYPE(org.codehaus.groovy.ast.ClassHelper.Character_TYPE) ClassHelper.make(org.codehaus.groovy.ast.ClassHelper.make) POWER_EQUAL(org.codehaus.groovy.syntax.Types.POWER_EQUAL) Matcher(java.util.regex.Matcher) INTDIV_EQUAL(org.codehaus.groovy.syntax.Types.INTDIV_EQUAL) Map(java.util.Map) COMPARE_GREATER_THAN_EQUAL(org.codehaus.groovy.syntax.Types.COMPARE_GREATER_THAN_EQUAL) VOID_TYPE(org.codehaus.groovy.ast.ClassHelper.VOID_TYPE) ClassHelper.isBigIntegerType(org.codehaus.groovy.ast.ClassHelper.isBigIntegerType) Traits(org.codehaus.groovy.transform.trait.Traits) ClassHelper.char_TYPE(org.codehaus.groovy.ast.ClassHelper.char_TYPE) COMPARE_TO(org.codehaus.groovy.syntax.Types.COMPARE_TO) COLLECTION_TYPE(org.codehaus.groovy.ast.ClassHelper.COLLECTION_TYPE) BITWISE_AND(org.codehaus.groovy.syntax.Types.BITWISE_AND) VariableExpression(org.codehaus.groovy.ast.expr.VariableExpression) PLUS(org.codehaus.groovy.syntax.Types.PLUS) ArgumentListExpression(org.codehaus.groovy.ast.expr.ArgumentListExpression) Set(java.util.Set) LOGICAL_AND(org.codehaus.groovy.syntax.Types.LOGICAL_AND) ClassHelper.getUnwrapper(org.codehaus.groovy.ast.ClassHelper.getUnwrapper) RIGHT_SHIFT_EQUAL(org.codehaus.groovy.syntax.Types.RIGHT_SHIFT_EQUAL) CLASS_Type(org.codehaus.groovy.ast.ClassHelper.CLASS_Type) COMPARE_NOT_EQUAL(org.codehaus.groovy.syntax.Types.COMPARE_NOT_EQUAL) OBJECT_TYPE(org.codehaus.groovy.ast.ClassHelper.OBJECT_TYPE) ClassHelper.makeWithoutCaching(org.codehaus.groovy.ast.ClassHelper.makeWithoutCaching) ClassHelper.byte_TYPE(org.codehaus.groovy.ast.ClassHelper.byte_TYPE) ClassNodeUtils.samePackageName(org.apache.groovy.ast.tools.ClassNodeUtils.samePackageName) STRING_TYPE(org.codehaus.groovy.ast.ClassHelper.STRING_TYPE) ClassHelper.long_TYPE(org.codehaus.groovy.ast.ClassHelper.long_TYPE) RIGHT_SHIFT_UNSIGNED(org.codehaus.groovy.syntax.Types.RIGHT_SHIFT_UNSIGNED) LEFT_SQUARE_BRACKET(org.codehaus.groovy.syntax.Types.LEFT_SQUARE_BRACKET) CastExpression(org.codehaus.groovy.ast.expr.CastExpression) ClassHelper.getWrapper(org.codehaus.groovy.ast.ClassHelper.getWrapper) PLUS_EQUAL(org.codehaus.groovy.syntax.Types.PLUS_EQUAL) RIGHT_SHIFT(org.codehaus.groovy.syntax.Types.RIGHT_SHIFT) DefaultGroovyMethods.asBoolean(org.codehaus.groovy.runtime.DefaultGroovyMethods.asBoolean) COMPARE_NOT_IN(org.codehaus.groovy.syntax.Types.COMPARE_NOT_IN) COMPARE_EQUAL(org.codehaus.groovy.syntax.Types.COMPARE_EQUAL) INTDIV(org.codehaus.groovy.syntax.Types.INTDIV) DIVIDE_EQUAL(org.codehaus.groovy.syntax.Types.DIVIDE_EQUAL) MINUS(org.codehaus.groovy.syntax.Types.MINUS) TreeSet(java.util.TreeSet) MOD_EQUAL(org.codehaus.groovy.syntax.Types.MOD_EQUAL) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap) BITWISE_OR_EQUAL(org.codehaus.groovy.syntax.Types.BITWISE_OR_EQUAL) LOGICAL_OR(org.codehaus.groovy.syntax.Types.LOGICAL_OR) DefaultGroovyMethodsSupport.closeQuietly(org.codehaus.groovy.runtime.DefaultGroovyMethodsSupport.closeQuietly) COMPARE_IDENTICAL(org.codehaus.groovy.syntax.Types.COMPARE_IDENTICAL) MethodNode(org.codehaus.groovy.ast.MethodNode) BITWISE_AND_EQUAL(org.codehaus.groovy.syntax.Types.BITWISE_AND_EQUAL) Expression(org.codehaus.groovy.ast.expr.Expression) ExpressionUtils.isNullConstant(org.apache.groovy.ast.tools.ExpressionUtils.isNullConstant) ClassHelper.short_TYPE(org.codehaus.groovy.ast.ClassHelper.short_TYPE) KEYWORD_IN(org.codehaus.groovy.syntax.Types.KEYWORD_IN) LinkedHashSet(java.util.LinkedHashSet) Opcodes(org.objectweb.asm.Opcodes) Parameter(org.codehaus.groovy.ast.Parameter) POWER(org.codehaus.groovy.syntax.Types.POWER) ClassNode(org.codehaus.groovy.ast.ClassNode) ClassHelper.isStringType(org.codehaus.groovy.ast.ClassHelper.isStringType) ClassHelper.float_TYPE(org.codehaus.groovy.ast.ClassHelper.float_TYPE) GenericsType(org.codehaus.groovy.ast.GenericsType) ClassHelper.isPrimitiveBoolean(org.codehaus.groovy.ast.ClassHelper.isPrimitiveBoolean) ReturnStatement(org.codehaus.groovy.ast.stmt.ReturnStatement) CompilerConfiguration(org.codehaus.groovy.control.CompilerConfiguration) Phases(org.codehaus.groovy.control.Phases) ClassHelper.isClassType(org.codehaus.groovy.ast.ClassHelper.isClassType) ClassHelper.isPrimitiveType(org.codehaus.groovy.ast.ClassHelper.isPrimitiveType) ClassHelper.double_TYPE(org.codehaus.groovy.ast.ClassHelper.double_TYPE) ClassHelper.isGroovyObjectType(org.codehaus.groovy.ast.ClassHelper.isGroovyObjectType) Float_TYPE(org.codehaus.groovy.ast.ClassHelper.Float_TYPE) MetaClassRegistryImpl(org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl) WideningCategories.isNumberCategory(org.codehaus.groovy.ast.tools.WideningCategories.isNumberCategory) ListExpression(org.codehaus.groovy.ast.expr.ListExpression) ClassHelper.isWrapperBoolean(org.codehaus.groovy.ast.ClassHelper.isWrapperBoolean) KEYWORD_INSTANCEOF(org.codehaus.groovy.syntax.Types.KEYWORD_INSTANCEOF) MapExpression(org.codehaus.groovy.ast.expr.MapExpression) ClassHelper.isGStringType(org.codehaus.groovy.ast.ClassHelper.isGStringType) GenericsTypeName(org.codehaus.groovy.ast.GenericsType.GenericsTypeName) ConstantExpression(org.codehaus.groovy.ast.expr.ConstantExpression) Long_TYPE(org.codehaus.groovy.ast.ClassHelper.Long_TYPE) LEFT_SHIFT_EQUAL(org.codehaus.groovy.syntax.Types.LEFT_SHIFT_EQUAL) Number_TYPE(org.codehaus.groovy.ast.ClassHelper.Number_TYPE) ClassHelper.findSAM(org.codehaus.groovy.ast.ClassHelper.findSAM) Enum_Type(org.codehaus.groovy.ast.ClassHelper.Enum_Type) ClassHelper.isBigDecimalType(org.codehaus.groovy.ast.ClassHelper.isBigDecimalType) Variable(org.codehaus.groovy.ast.Variable) ClassHelper.isSAMType(org.codehaus.groovy.ast.ClassHelper.isSAMType) MULTIPLY_EQUAL(org.codehaus.groovy.syntax.Types.MULTIPLY_EQUAL) GeneralUtils(org.codehaus.groovy.ast.tools.GeneralUtils) MULTIPLY(org.codehaus.groovy.syntax.Types.MULTIPLY) MATCH_REGEX(org.codehaus.groovy.syntax.Types.MATCH_REGEX) Integer_TYPE(org.codehaus.groovy.ast.ClassHelper.Integer_TYPE) ClassHelper.void_WRAPPER_TYPE(org.codehaus.groovy.ast.ClassHelper.void_WRAPPER_TYPE) ArrayExpression(org.codehaus.groovy.ast.expr.ArrayExpression) Collection(java.util.Collection) BITWISE_XOR(org.codehaus.groovy.syntax.Types.BITWISE_XOR) Types(org.codehaus.groovy.syntax.Types) LEFT_SHIFT(org.codehaus.groovy.syntax.Types.LEFT_SHIFT) UUID(java.util.UUID) RIGHT_SHIFT_UNSIGNED_EQUAL(org.codehaus.groovy.syntax.Types.RIGHT_SHIFT_UNSIGNED_EQUAL) InnerClassNode(org.codehaus.groovy.ast.InnerClassNode) Short_TYPE(org.codehaus.groovy.ast.ClassHelper.Short_TYPE) GroovyBugError(org.codehaus.groovy.GroovyBugError) List(java.util.List) BinaryExpression(org.codehaus.groovy.ast.expr.BinaryExpression) Optional(java.util.Optional) Double_TYPE(org.codehaus.groovy.ast.ClassHelper.Double_TYPE) BITWISE_XOR_EQUAL(org.codehaus.groovy.syntax.Types.BITWISE_XOR_EQUAL) ClassHelper.int_TYPE(org.codehaus.groovy.ast.ClassHelper.int_TYPE) WideningCategories.lowestUpperBound(org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound) HashMap(java.util.HashMap) DIVIDE(org.codehaus.groovy.syntax.Types.DIVIDE) Maps(org.apache.groovy.util.Maps) HashSet(java.util.HashSet) ClassHelper.isNumberType(org.codehaus.groovy.ast.ClassHelper.isNumberType) CompilationUnit(org.codehaus.groovy.control.CompilationUnit) CLOSURE_TYPE(org.codehaus.groovy.ast.ClassHelper.CLOSURE_TYPE) ClassHelper.boolean_TYPE(org.codehaus.groovy.ast.ClassHelper.boolean_TYPE) WideningCategories.isBigIntCategory(org.codehaus.groovy.ast.tools.WideningCategories.isBigIntCategory) ClassNodeUtils.addGeneratedMethod(org.apache.groovy.ast.tools.ClassNodeUtils.addGeneratedMethod) LinkedList(java.util.LinkedList) Byte_TYPE(org.codehaus.groovy.ast.ClassHelper.Byte_TYPE) Iterator(java.util.Iterator) COMPARE_NOT_INSTANCEOF(org.codehaus.groovy.syntax.Types.COMPARE_NOT_INSTANCEOF) ParameterUtils(org.codehaus.groovy.ast.tools.ParameterUtils) GroovyClass(org.codehaus.groovy.tools.GroovyClass) GenericsUtils.makeClassSafe0(org.codehaus.groovy.ast.tools.GenericsUtils.makeClassSafe0) COMPARE_NOT_IDENTICAL(org.codehaus.groovy.syntax.Types.COMPARE_NOT_IDENTICAL) ClosureExpression(org.codehaus.groovy.ast.expr.ClosureExpression) GenericsUtils(org.codehaus.groovy.ast.tools.GenericsUtils) MINUS_EQUAL(org.codehaus.groovy.syntax.Types.MINUS_EQUAL) StringJoiner(java.util.StringJoiner) WideningCategories(org.codehaus.groovy.ast.tools.WideningCategories) MOD(org.codehaus.groovy.syntax.Types.MOD) BaseStream(java.util.stream.BaseStream) COMPARE_LESS_THAN(org.codehaus.groovy.syntax.Types.COMPARE_LESS_THAN) COMPARE_LESS_THAN_EQUAL(org.codehaus.groovy.syntax.Types.COMPARE_LESS_THAN_EQUAL) Comparator(java.util.Comparator) ConstructorNode(org.codehaus.groovy.ast.ConstructorNode) Collections(java.util.Collections) ClassHelper.isObjectType(org.codehaus.groovy.ast.ClassHelper.isObjectType) BITWISE_OR(org.codehaus.groovy.syntax.Types.BITWISE_OR) CompilationUnit(org.codehaus.groovy.control.CompilationUnit) ClassNode(org.codehaus.groovy.ast.ClassNode) InnerClassNode(org.codehaus.groovy.ast.InnerClassNode) GroovyClass(org.codehaus.groovy.tools.GroovyClass) ConstantExpression(org.codehaus.groovy.ast.expr.ConstantExpression) ArgumentListExpression(org.codehaus.groovy.ast.expr.ArgumentListExpression) ListExpression(org.codehaus.groovy.ast.expr.ListExpression) GroovyBugError(org.codehaus.groovy.GroovyBugError) VariableExpression(org.codehaus.groovy.ast.expr.VariableExpression) ArgumentListExpression(org.codehaus.groovy.ast.expr.ArgumentListExpression) CastExpression(org.codehaus.groovy.ast.expr.CastExpression) Expression(org.codehaus.groovy.ast.expr.Expression) ListExpression(org.codehaus.groovy.ast.expr.ListExpression) MapExpression(org.codehaus.groovy.ast.expr.MapExpression) ConstantExpression(org.codehaus.groovy.ast.expr.ConstantExpression) ArrayExpression(org.codehaus.groovy.ast.expr.ArrayExpression) BinaryExpression(org.codehaus.groovy.ast.expr.BinaryExpression) ClosureExpression(org.codehaus.groovy.ast.expr.ClosureExpression) ReturnStatement(org.codehaus.groovy.ast.stmt.ReturnStatement) CompilerConfiguration(org.codehaus.groovy.control.CompilerConfiguration) CastExpression(org.codehaus.groovy.ast.expr.CastExpression)

Aggregations

ReturnStatement (org.codehaus.groovy.ast.stmt.ReturnStatement)74 BlockStatement (org.codehaus.groovy.ast.stmt.BlockStatement)44 Statement (org.codehaus.groovy.ast.stmt.Statement)38 ConstantExpression (org.codehaus.groovy.ast.expr.ConstantExpression)37 ExpressionStatement (org.codehaus.groovy.ast.stmt.ExpressionStatement)35 VariableExpression (org.codehaus.groovy.ast.expr.VariableExpression)32 ArgumentListExpression (org.codehaus.groovy.ast.expr.ArgumentListExpression)30 MethodNode (org.codehaus.groovy.ast.MethodNode)28 MethodCallExpression (org.codehaus.groovy.ast.expr.MethodCallExpression)26 Expression (org.codehaus.groovy.ast.expr.Expression)25 ConstructorCallExpression (org.codehaus.groovy.ast.expr.ConstructorCallExpression)24 IfStatement (org.codehaus.groovy.ast.stmt.IfStatement)23 ClassNode (org.codehaus.groovy.ast.ClassNode)22 Parameter (org.codehaus.groovy.ast.Parameter)22 StaticMethodCallExpression (org.codehaus.groovy.ast.expr.StaticMethodCallExpression)22 BinaryExpression (org.codehaus.groovy.ast.expr.BinaryExpression)21 ClassExpression (org.codehaus.groovy.ast.expr.ClassExpression)18 ArrayList (java.util.ArrayList)17 EmptyStatement (org.codehaus.groovy.ast.stmt.EmptyStatement)17 BooleanExpression (org.codehaus.groovy.ast.expr.BooleanExpression)15