langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java
changeset 18000 5d29ce00a7a2
parent 17810 db9f3e9cd760
child 18010 604faee85350
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java	Sat Jun 01 21:57:56 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java	Sat Jun 01 22:09:18 2013 +0100
@@ -258,6 +258,14 @@
                                                meth.name,
                                                bridgeType,
                                                origin);
+        /* once JDK-6996415 is solved it should be checked if this approach can
+         * be applied to method addOverrideBridgesIfNeeded
+         */
+        bridge.params = createBridgeParams(impl, bridge, bridgeType);
+        if (impl.annotations != null) {
+            bridge.annotations.setAttributes(impl.annotations);
+        }
+
         if (!hypothetical) {
             JCMethodDecl md = make.MethodDef(bridge, null);
 
@@ -292,6 +300,28 @@
         overridden.put(bridge, meth);
     }
 
+    private List<VarSymbol> createBridgeParams(MethodSymbol impl, MethodSymbol bridge,
+            Type bridgeType) {
+        List<VarSymbol> bridgeParams = null;
+        if (impl.params != null) {
+            bridgeParams = List.nil();
+            List<VarSymbol> implParams = impl.params;
+            Type.MethodType mType = (Type.MethodType)bridgeType;
+            List<Type> argTypes = mType.argtypes;
+            while (implParams.nonEmpty() && argTypes.nonEmpty()) {
+                VarSymbol param = new VarSymbol(implParams.head.flags() | SYNTHETIC,
+                        implParams.head.name, argTypes.head, bridge);
+                if (implParams.head.annotations != null) {
+                    param.annotations.setAttributes(implParams.head.annotations);
+                }
+                bridgeParams = bridgeParams.append(param);
+                implParams = implParams.tail;
+                argTypes = argTypes.tail;
+            }
+        }
+        return bridgeParams;
+    }
+
     /** Add bridge if given symbol is a non-private, non-static member
      *  of the given class, which is either defined in the class or non-final
      *  inherited, and one of the two following conditions holds: