Print this page
rev 5684 : 4990369: visibleMethods() and methodsByName() return wrong visible methods

@@ -22,28 +22,49 @@
 package sun.jvm.hotspot.jdi;
-import com.sun.jdi.*;
+import java.lang.ref.SoftReference;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 import sun.jvm.hotspot.memory.SystemDictionary;
+import sun.jvm.hotspot.oops.ArrayKlass;
+import sun.jvm.hotspot.oops.DefaultHeapVisitor;
 import sun.jvm.hotspot.oops.Instance;
 import sun.jvm.hotspot.oops.InstanceKlass;
-import sun.jvm.hotspot.oops.ArrayKlass;
 import sun.jvm.hotspot.oops.JVMDIClassStatus;
 import sun.jvm.hotspot.oops.Klass;
-import sun.jvm.hotspot.oops.ObjArray;
 import sun.jvm.hotspot.oops.Oop;
 import sun.jvm.hotspot.oops.Symbol;
-import sun.jvm.hotspot.oops.DefaultHeapVisitor;
 import sun.jvm.hotspot.utilities.Assert;
-import java.util.*;
-import java.lang.ref.SoftReference;
+import com.sun.jdi.AbsentInformationException;
+import com.sun.jdi.ArrayType;
+import com.sun.jdi.ClassLoaderReference;
+import com.sun.jdi.ClassNotLoadedException;
+import com.sun.jdi.ClassNotPreparedException;
+import com.sun.jdi.ClassObjectReference;
+import com.sun.jdi.Field;
+import com.sun.jdi.InterfaceType;
+import com.sun.jdi.Method;
+import com.sun.jdi.ObjectReference;
+import com.sun.jdi.PrimitiveType;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.Type;
+import com.sun.jdi.Value;
+import com.sun.jdi.VirtualMachine;
 public abstract class ReferenceTypeImpl extends TypeImpl
 implements ReferenceType {
     protected Klass       saKlass;          // This can be an InstanceKlass or an ArrayKlass
     protected Symbol      typeNameSymbol;   // This is used in vm.classesByName to speedup search

@@ -419,31 +440,32 @@
             Method method = (Method);
             methodMap.put(, method);
-    abstract void addVisibleMethods(Map methodMap);
+    abstract void addVisibleMethods(Map<String, Method> methodMap, Set<InterfaceType> seenInterfaces);
     public final List visibleMethods() throws ClassNotPreparedException {
          * Build a collection of all visible methods. The hash
          * map allows us to do this efficiently by keying on the
          * concatenation of name and signature.
         //System.out.println("jj: RTI: Calling addVisibleMethods for:" + this);
-        Map map = new HashMap();
-        addVisibleMethods(map);
+        Map<String, Method> map = new HashMap<String, Method>();
+        addVisibleMethods(map, new HashSet<InterfaceType>());
          * ... but the hash map destroys order. Methods should be
          * returned in a sensible order, as they are in allMethods().
          * So, start over with allMethods() and use the hash map
          * to filter that ordered collection.
         //System.out.println("jj: RTI: Calling allMethods for:" + this);
-        List list = new ArrayList(allMethods());
+        List<Method> list = new ArrayList<Method>(allMethods());
         //System.out.println("jj: allMethods = " + jjstr(list));
         //System.out.println("jj: map = " + map.toString());
         //System.out.println("jj: map = " + jjstr(map.values()));
         //System.out.println("jj: map = " + jjstr(list));