src/share/classes/com/sun/tools/javac/comp/TransTypes.java

changeset 1792
ec871c3e8337
parent 1785
92e420e9807d
child 1802
8fb68f73d4b1
     1.1 --- a/src/share/classes/com/sun/tools/javac/comp/TransTypes.java	Sat Jun 01 21:57:56 2013 +0100
     1.2 +++ b/src/share/classes/com/sun/tools/javac/comp/TransTypes.java	Sat Jun 01 22:09:18 2013 +0100
     1.3 @@ -258,6 +258,14 @@
     1.4                                                 meth.name,
     1.5                                                 bridgeType,
     1.6                                                 origin);
     1.7 +        /* once JDK-6996415 is solved it should be checked if this approach can
     1.8 +         * be applied to method addOverrideBridgesIfNeeded
     1.9 +         */
    1.10 +        bridge.params = createBridgeParams(impl, bridge, bridgeType);
    1.11 +        if (impl.annotations != null) {
    1.12 +            bridge.annotations.setAttributes(impl.annotations);
    1.13 +        }
    1.14 +
    1.15          if (!hypothetical) {
    1.16              JCMethodDecl md = make.MethodDef(bridge, null);
    1.17  
    1.18 @@ -292,6 +300,28 @@
    1.19          overridden.put(bridge, meth);
    1.20      }
    1.21  
    1.22 +    private List<VarSymbol> createBridgeParams(MethodSymbol impl, MethodSymbol bridge,
    1.23 +            Type bridgeType) {
    1.24 +        List<VarSymbol> bridgeParams = null;
    1.25 +        if (impl.params != null) {
    1.26 +            bridgeParams = List.nil();
    1.27 +            List<VarSymbol> implParams = impl.params;
    1.28 +            Type.MethodType mType = (Type.MethodType)bridgeType;
    1.29 +            List<Type> argTypes = mType.argtypes;
    1.30 +            while (implParams.nonEmpty() && argTypes.nonEmpty()) {
    1.31 +                VarSymbol param = new VarSymbol(implParams.head.flags() | SYNTHETIC,
    1.32 +                        implParams.head.name, argTypes.head, bridge);
    1.33 +                if (implParams.head.annotations != null) {
    1.34 +                    param.annotations.setAttributes(implParams.head.annotations);
    1.35 +                }
    1.36 +                bridgeParams = bridgeParams.append(param);
    1.37 +                implParams = implParams.tail;
    1.38 +                argTypes = argTypes.tail;
    1.39 +            }
    1.40 +        }
    1.41 +        return bridgeParams;
    1.42 +    }
    1.43 +
    1.44      /** Add bridge if given symbol is a non-private, non-static member
    1.45       *  of the given class, which is either defined in the class or non-final
    1.46       *  inherited, and one of the two following conditions holds:

mercurial