protected boolean tryBridgeMethod(MethodNode target, Expression receiver, boolean implicitThis,
                                      TupleExpression args, ClassNode thisClass) {
        ClassNode lookupClassNode;
        if (target.isProtected()) {
            lookupClassNode = controller.getClassNode();
            while (lookupClassNode != null && !lookupClassNode.isDerivedFrom(target.getDeclaringClass())) {
                lookupClassNode = lookupClassNode.getOuterClass();
            }
            if (lookupClassNode == null) {
                return false;
            }
        } else {
            lookupClassNode = target.getDeclaringClass().redirect();
        }
        Map<MethodNode, MethodNode> bridges = lookupClassNode.getNodeMetaData(PRIVATE_BRIDGE_METHODS);
        MethodNode bridge = bridges==null?null:bridges.get(target);
        if (bridge != null) {
            Expression fixedReceiver = receiver;
            if (implicitThis) {
                if (!controller.isInClosure()) {
                    fixedReceiver = new PropertyExpression(new ClassExpression(lookupClassNode), "this");
                } else if (thisClass != null) {
                    ClassNode current = thisClass.getOuterClass();
                    fixedReceiver = new VariableExpression("thisObject", current);
                    // adjust for multiple levels of nesting if needed
                    while (current instanceof InnerClassNode && !lookupClassNode.equals(current)) {
                        FieldNode thisField = current.getField("this$0");
                        current = current.getOuterClass();
                        if (thisField != null) {
                            fixedReceiver = new PropertyExpression(fixedReceiver, "this$0");
                            fixedReceiver.setType(current);
                        }
                    }
                }
            }
            ArgumentListExpression newArgs = new ArgumentListExpression(target.isStatic()?new ConstantExpression(null):fixedReceiver);
            for (Expression expression : args.getExpressions()) {
                newArgs.addExpression(expression);
            }
            return writeDirectMethodCall(bridge, implicitThis, fixedReceiver, newArgs);
        }
        return false;
    }
protected boolean tryBridgeMethod ( MethodNode target , Expression receiver , boolean implicitThis , TupleExpression args , ClassNode thisClass ) { ClassNode lookupClassNode ; if ( target . isProtected ( ) ) { lookupClassNode = controller . getClassNode ( ) ; while ( lookupClassNode != null && ! lookupClassNode . isDerivedFrom ( target . getDeclaringClass ( ) ) ) { lookupClassNode = lookupClassNode . getOuterClass ( ) ; } if ( lookupClassNode == null ) { return false ; } } else { lookupClassNode = target . getDeclaringClass ( ) . redirect ( ) ; } Map < MethodNode , MethodNode > bridges = lookupClassNode . getNodeMetaData ( PRIVATE_BRIDGE_METHODS ) ; MethodNode bridge = bridges == null ? null : bridges . get ( target ) ; if ( bridge != null ) { Expression fixedReceiver = receiver ; if ( implicitThis ) { if ( ! controller . isInClosure ( ) ) { fixedReceiver = new PropertyExpression ( new ClassExpression ( lookupClassNode ) , "this" ) ; } else if ( thisClass != null ) { ClassNode current = thisClass . getOuterClass ( ) ; fixedReceiver = new VariableExpression ( "thisObject" , current ) ; while ( current instanceof InnerClassNode && ! lookupClassNode . equals ( current ) ) { FieldNode thisField = current . getField ( "this$0" ) ; current = current . getOuterClass ( ) ; if ( thisField != null ) { fixedReceiver = new PropertyExpression ( fixedReceiver , "this$0" ) ; fixedReceiver . setType ( current ) ; } } } } ArgumentListExpression newArgs = new ArgumentListExpression ( target . isStatic ( ) ? new ConstantExpression ( null ) : fixedReceiver ) ; for ( Expression expression : args . getExpressions ( ) ) { newArgs . addExpression ( expression ) ; } return writeDirectMethodCall ( bridge , implicitThis , fixedReceiver , newArgs ) ; } return false ; }
Attempts to make a direct method call on a bridge method, if it exists.