private static void addBridgeMethod(ClassFile cf,
                                        MethodEntry mainMethod,
                                        MethodEntry bridgeMethod) {

        Method method = bridgeMethod.getMethod();

        // Don't override any methods in Object, especially final ones.
        if (isDefinedInObject(method)) {
            return;
        }

        Modifiers modifiers = new Modifiers(method.getModifiers());
        modifiers.setAbstract(false);
        modifiers.setFinal(true);
        modifiers.setSynchronized(false);
        modifiers.setNative(false);
        modifiers.setStatic(false);
        modifiers.setBridge(true);

        Modifiers staticModifiers = (Modifiers)modifiers.clone();
        staticModifiers.setStatic(true);

        GenericType mainType = new GenericType(mainMethod.getReturnType());
        TypeDesc mainReturn = TypeDesc.forClass(mainType.getRawType().getType(),
                                         resolve(mainType));

        GenericType returnType = new GenericType(bridgeMethod.getReturnType());
        TypeDesc ret = TypeDesc.forClass(returnType.getRawType().getType(),
                                         resolve(returnType));

        Class<?>[] paramTypes = bridgeMethod.getParameterTypes();
        TypeDesc[] params = new TypeDesc[paramTypes.length];
        for (int i=0; i<params.length; i++) {
            GenericType paramType = new GenericType(paramTypes[i]);
            params[i] = TypeDesc.forClass(paramType.getRawType().getType(),
                                          resolve(paramType));
        }

        MethodInfo mi;
        if (Modifier.isStatic(method.getModifiers())) {
            mi = cf.addMethod
                (staticModifiers, bridgeMethod.getName(), ret, params);
        }
        else {
            mi = cf.addMethod(modifiers, bridgeMethod.getName(), ret, params);
        }

        // Exception stuff...
        Class<?>[] exceptions = method.getExceptionTypes();
        for (int i=0; i<exceptions.length; i++) {
            mi.addException(exceptions[i].getName());
        }

        // Check for deprecation
        if (ClassUtils.isDeprecated(method)) {
            mi.addRuntimeVisibleAnnotation(TypeDesc.forClass(Deprecated.class));
        }

        // Delegate to wrapped object.
        CodeBuilder builder = new CodeBuilder(mi);
        if (!Modifier.isStatic(method.getModifiers())) {
            builder.loadThis();
        }

        LocalVariable[] locals = builder.getParameters();
        for (int i=0; i<locals.length; i++) {
            builder.loadLocal(locals[i]);
        }

        builder.invokeVirtual(bridgeMethod.getName(), mainReturn, params);
        builder.returnValue(TypeDesc.OBJECT);
    }