Package com.strobel.reflection

Examples of com.strobel.reflection.Type


        verifyCanRead(left, "left");
        verifyCanWrite(left, "left");
        verifyCanRead(right, "right");

        final Type leftType = left.getType();
        final Type rightType = right.getType();

        if (method == null) {
            if (TypeUtils.hasIdentityPrimitiveOrBoxingConversion(leftType, rightType) &&
                TypeUtils.isArithmetic(leftType)) {
                // conversion is not supported for binary ops on arithmetic types without operator overloading
View Full Code Here


        verifyCanRead(left, "left");
        verifyCanWrite(left, "left");
        verifyCanRead(right, "right");

        final Type leftType = left.getType();
        final Type rightType = right.getType();

        if (method == null) {
            if (TypeUtils.hasIdentityPrimitiveOrBoxingConversion(leftType, rightType) &&
                TypeUtils.isArithmetic(leftType)) {
                // conversion is not supported for binary ops on arithmetic types without operator overloading
View Full Code Here

        verifyCanRead(left, "left");
        verifyCanWrite(left, "left");
        verifyCanRead(right, "right");

        final Type leftType = left.getType();
        final Type rightType = right.getType();

        if (method == null) {
            if (TypeUtils.hasIdentityPrimitiveOrBoxingConversion(leftType, rightType) &&
                TypeUtils.isArithmetic(leftType)) {
                // conversion is not supported for binary ops on arithmetic types without operator overloading
View Full Code Here

        verifyCanRead(left, "left");
        verifyCanWrite(left, "left");
        verifyCanRead(right, "right");

        final Type leftType = left.getType();
        final Type rightType = right.getType();

        if (method == null) {
            if (TypeUtils.hasIdentityPrimitiveOrBoxingConversion(leftType, rightType) &&
                TypeUtils.isArithmetic(leftType)) {
                // conversion is not supported for binary ops on arithmetic types without operator overloading
View Full Code Here

        verifyCanRead(left, "left");
        verifyCanWrite(left, "left");
        verifyCanRead(right, "right");

        final Type leftType = left.getType();
        final Type rightType = right.getType();

        if (method == null) {
            if (TypeUtils.hasIdentityPrimitiveOrBoxingConversion(leftType, rightType) &&
                TypeUtils.isArithmetic(leftType)) {
                // conversion is not supported for binary ops on arithmetic types without operator overloading
View Full Code Here

        verifyCanRead(left, "left");
        verifyCanWrite(left, "left");
        verifyCanRead(right, "right");

        final Type leftType = left.getType();
        final Type rightType = right.getType();

        if (method == null) {
            if (TypeUtils.hasIdentityPrimitiveOrBoxingConversion(leftType, rightType) &&
                TypeUtils.isIntegralOrBoolean(leftType)) {
                // conversion is not supported for binary ops on arithmetic types without operator overloading
View Full Code Here

        verifyCanRead(left, "left");
        verifyCanWrite(left, "left");
        verifyCanRead(right, "right");

        final Type leftType = left.getType();
        final Type rightType = right.getType();

        if (method == null) {
            if (TypeUtils.hasIdentityPrimitiveOrBoxingConversion(leftType, rightType) &&
                TypeUtils.isIntegralOrBoolean(leftType)) {
                // conversion is not supported for binary ops on arithmetic types without operator overloading
View Full Code Here

        verifyCanRead(left, "left");
        verifyCanWrite(left, "left");
        verifyCanRead(right, "right");

        final Type leftType = left.getType();
        final Type rightType = right.getType();

        if (method == null) {
            if (TypeUtils.hasIdentityPrimitiveOrBoxingConversion(leftType, rightType) &&
                TypeUtils.isIntegralOrBoolean(leftType)) {
                // conversion is not supported for binary ops on arithmetic types without operator overloading
View Full Code Here

        final ExpressionList<? extends Expression> arguments) {

        if (method.getCallingConvention() == CallingConvention.VarArgs) {
            final TypeList pt = method.getParameters().getParameterTypes();
            final int varArgArrayPosition = pt.size() - 1;
            final Type varArgArrayType = pt.get(varArgArrayPosition);

            final boolean needArray = arguments.size() != pt.size() ||
                                      !TypeUtils.areEquivalent(
                                          varArgArrayType,
                                          arguments.get(arguments.size() - 1).getType());

            if (needArray) {
                final Expression[] newArguments = new Expression[pt.size()];

                for (int i = 0; i < varArgArrayPosition; i++) {
                    newArguments[i] = arguments.get(i);
                }

                ExpressionList<Expression> arrayInitList = ExpressionList.empty();

                for (int i = varArgArrayPosition, n = arguments.size(); i < n; i++) {
                    arrayInitList = arrayInitList.add(arguments.get(i));
                }

                newArguments[varArgArrayPosition] = newArrayInit(
                    varArgArrayType.getElementType(),
                    arrayInitList
                );

                return new ExpressionList<>(newArguments);
            }
View Full Code Here

        VerifyArgument.notEmpty(cases, "cases");
        VerifyArgument.noNullElements(cases, "cases");

        final boolean customType = type != null;
        final Type resultType = type != null ? type : cases.get(0).getBody().getType();
        final MethodInfo actualComparison;

        if (comparison != null) {
            final ParameterList parameters = comparison.getParameters();

            if (parameters.size() != 2) {
                throw Error.incorrectNumberOfMethodCallArguments(comparison);
            }

            // Validate that the switch value's type matches the comparison method's
            // left hand side parameter type.
            final ParameterInfo leftArg = parameters.get(0);
            final ParameterInfo rightArg = parameters.get(1);

            for (int i = 0, n = cases.size(); i < n; i++) {
                final SwitchCase c = cases.get(i);

                validateSwitchCaseType(c.getBody(), customType, resultType, "cases");

                final ExpressionList<? extends Expression> testValues = c.getTestValues();

                for (int j = 0, m = testValues.size(); j < m; j++) {
                    // When a comparison method is provided, test values can have different type but have to
                    // be reference assignable to the right hand side parameter of the method.
                    final Type rightOperandType = testValues.get(j).getType();

                    if (!parameterIsAssignable(rightArg.getParameterType(), rightOperandType)) {
                        throw Error.testValueTypeDoesNotMatchComparisonMethodParameter(
                            rightOperandType,
                            rightArg.getParameterType()
View Full Code Here

TOP

Related Classes of com.strobel.reflection.Type

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.