Package com.strobel.assembler.metadata

Examples of com.strobel.assembler.metadata.MethodReference


            case InvokeVirtual:
            case InvokeSpecial:
            case InvokeStatic:
            case InvokeInterface: {
                final MethodReference method = (MethodReference) e.getOperand();

                if (method != null) {
                    final String methodName = method.getName();

                    String name = methodName;

                    final String mappedMethodName = METHOD_NAME_MAPPINGS.get(methodName);
View Full Code Here


            case InvokeVirtual:
            case InvokeSpecial:
            case InvokeStatic:
            case InvokeInterface:
            case InitObject: {
                final MethodReference method = (MethodReference) parent.getOperand();

                if (method != null) {
                    final String methodName = method.getName();
                    final List<ParameterDefinition> parameters = method.getParameters();

                    if (parameters.size() == 1 && i == parent.getArguments().size() - 1) {
                        if (methodName.length() > 3 &&
                            StringUtilities.startsWith(methodName, "set") &&
                            Character.isUpperCase(methodName.charAt(3))) {

                            return cleanUpVariableName(methodName.substring(3));
                        }
                    }

                    final MethodDefinition definition = method.resolve();

                    if (definition != null) {
                        final ParameterDefinition p = getOrDefault(
                            definition.getParameters(),
                            parent.getCode() != AstCode.InitObject && !definition.isStatic() ? i - 1 : i
View Full Code Here

        //
        if (node.getRole() == Roles.ARGUMENT) {
            final MemberReference member = parent.getUserData(Keys.MEMBER_REFERENCE);

            if (member instanceof MethodReference) {
                final MethodReference method = (MethodReference) parent.getUserData(Keys.MEMBER_REFERENCE);

                if (method == null || MetadataHelper.isOverloadCheckingRequired(method)) {
                    return false;
                }
            }
View Full Code Here

            if (parameter.getPosition() == parameter.getMethod().getParameters().size() - 1 &&
                parameter.getParameterType().isArray() &&
                parameter.getMethod() instanceof MethodReference) {

                final MethodReference method = (MethodReference) parameter.getMethod();
                final MethodDefinition resolvedMethod = method.resolve();

                if (resolvedMethod != null && Flags.testAny(resolvedMethod.getFlags(), Flags.ACC_VARARGS | Flags.VARARGS)) {
                    isVarArgs = true;
                }
            }
View Full Code Here

            final Expression test = node.getExpression();
            final Match m = SWITCH_INPUT.match(test);

            if (m.success()) {
                final InvocationExpression switchMapMethodCall = first(m.<InvocationExpression>get("switchMapMethodCall"));
                final MethodReference switchMapMethod = (MethodReference) switchMapMethodCall.getUserData(Keys.MEMBER_REFERENCE);

                if (!isSwitchMapMethod(switchMapMethod)) {
                    return super.visitSwitchStatement(node, data);
                }

                final FieldDefinition switchMapField;

                try {
                    final FieldReference r = new MetadataParser(currentType.getResolver()).parseField(
                        currentType,
                        switchMapMethod.getName(),
                        switchMapMethod.getReturnType().getErasedSignature()
                    );

                    switchMapField = r.resolve();
                }
                catch (Throwable t) {
View Full Code Here

    @Override
    public Void visitMethodGroupExpression(final MethodGroupExpression node, final Void data) {
        final MemberReference reference = node.getUserData(Keys.MEMBER_REFERENCE);

        if (reference instanceof MethodReference) {
            final MethodReference method = (MethodReference) reference;
            final MethodDefinition resolvedMethod = method.resolve();
            final DynamicCallSite callSite = node.getUserData(Keys.DYNAMIC_CALL_SITE);

            if (resolvedMethod != null && resolvedMethod.isSynthetic() && callSite != null) {
                inlineLambda(node, resolvedMethod);
                return null;
View Full Code Here

        if (!newArray.getAdditionalArraySpecifiers().hasSingleElement()) {
            return null;
        }

        final MethodReference method = (MethodReference) node.getUserData(Keys.MEMBER_REFERENCE);

        if (method == null) {
            return null;
        }

        final MethodDefinition resolved = method.resolve();

        if (resolved == null || !resolved.isVarArgs()) {
            return null;
        }
View Full Code Here

                        isEnclosedBy(resolvedCreatedType, argumentType)) {

                        if (isContextWithinTypeInstance(argumentType) &&
                            firstArgument instanceof ThisReferenceExpression) {

                            final MethodReference constructor = (MethodReference) node.getUserData(Keys.MEMBER_REFERENCE);

                            if (constructor != null &&
                                arguments.size() == constructor.getParameters().size()) {

                                firstArgument.remove();
                            }
                        }
                        else {
View Full Code Here

        return resolvedInnerType != null &&
               isEnclosedBy(resolvedInnerType.getBaseType(), outerType);
    }

    private boolean isContextWithinTypeInstance(final TypeReference type) {
        final MethodReference method = context.getCurrentMethod();

        if (method != null) {
            final MethodDefinition resolvedMethod = method.resolve();

            if (resolvedMethod != null && resolvedMethod.isStatic()) {
                return false;
            }
        }

        final TypeReference scope = context.getCurrentType();

        for (TypeReference current = scope;
             current != null;
             current = current.getDeclaringType()) {

            if (MetadataResolver.areEquivalent(current, type)) {
                return true;
            }

            final TypeDefinition resolved = current.resolve();

            if (resolved != null && resolved.isLocalClass()) {
                final MethodReference declaringMethod = resolved.getDeclaringMethod();

                if (declaringMethod != null) {
                    final MethodDefinition resolvedDeclaringMethod = declaringMethod.resolve();

                    if (resolvedDeclaringMethod != null && resolvedDeclaringMethod.isStatic()) {
                        break;
                    }
                }
View Full Code Here

        else if (_operand instanceof MethodReference) {
            if (!(e._operand instanceof MethodReference)) {
                return false;
            }

            final MethodReference f1 = (MethodReference) _operand;
            final MethodReference f2 = (MethodReference) e._operand;

            if (!StringUtilities.equals(f1.getFullName(), f2.getFullName()) ||
                !StringUtilities.equals(f1.getErasedSignature(), f2.getErasedSignature())) {

                return false;
            }
        }
        else if (!Comparer.equals(e._operand, _operand)) {
View Full Code Here

TOP

Related Classes of com.strobel.assembler.metadata.MethodReference

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.