changeset 5858:30c6386161c0

backport from it2 branch.
author mduigou
date Mon, 20 Aug 2012 17:00:55 -0700
parents e197bd7653e3
children 32604983b70c 2e76d9500022
files src/share/classes/java/lang/invoke/InnerClassGenerator.java
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/lang/invoke/InnerClassGenerator.java	Mon Aug 20 17:00:39 2012 -0700
+++ b/src/share/classes/java/lang/invoke/InnerClassGenerator.java	Mon Aug 20 17:00:55 2012 -0700
@@ -28,6 +28,7 @@
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
 import java.security.ProtectionDomain;
 import java.util.ArrayList;
 import java.util.List;
@@ -116,7 +117,13 @@
         List<Method> methodsDone = new ArrayList<>();
         Methods:
         for (Method m : methods) {
-            if (!m.getName().equals(samMethodName) || isObjectMethod(m)) {
+            // @@@ Need a more precise definition of which methods we bridge and which not
+            // This hack approximates it by arity
+            // Also need to exclude default methods that are similarly named; currently using isAbstract to approximate
+            if (!m.getName().equals(samMethodName)
+                || !Modifier.isAbstract(m.getModifiers())
+                || m.getGenericParameterTypes().length != samInfo.getMethodType().parameterCount()
+                || isObjectMethod(m)) {
                 continue Methods;
             }
             for (Method md : methodsDone) {