agent/src/share/classes/sun/jvm/hotspot/jdi/InterfaceTypeImpl.java

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

*** 22,40 **** * */ package sun.jvm.hotspot.jdi; ! import com.sun.jdi.*; ! import sun.jvm.hotspot.oops.InstanceKlass; ! ! import java.util.List; import java.util.ArrayList; - import java.util.Map; - import java.util.Iterator; import java.util.Collections; ! import java.lang.ref.SoftReference; public class InterfaceTypeImpl extends ReferenceTypeImpl implements InterfaceType { private SoftReference superInterfacesCache = null; private SoftReference subInterfacesCache = null; --- 22,47 ---- * */ package sun.jvm.hotspot.jdi; ! import java.lang.ref.SoftReference; import java.util.ArrayList; import java.util.Collections; ! import java.util.Iterator; ! import java.util.List; ! import java.util.Map; ! import java.util.Set; ! ! import sun.jvm.hotspot.oops.InstanceKlass; ! ! import com.sun.jdi.ClassNotPreparedException; ! import com.sun.jdi.ClassType; ! import com.sun.jdi.InterfaceType; ! import com.sun.jdi.Method; ! import com.sun.jdi.ReferenceType; ! import com.sun.jdi.VirtualMachine; public class InterfaceTypeImpl extends ReferenceTypeImpl implements InterfaceType { private SoftReference superInterfacesCache = null; private SoftReference subInterfacesCache = null;
*** 94,113 **** implementorsCache = new SoftReference(implementors); } return implementors; } ! void addVisibleMethods(Map methodMap) { /* * Add methods from * parent types first, so that the methods in this class will * overwrite them in the hash table */ ! Iterator iter = superinterfaces().iterator(); while (iter.hasNext()) { InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next(); ! interfaze.addVisibleMethods(methodMap); } addToMethodMap(methodMap, methods()); } --- 101,124 ---- implementorsCache = new SoftReference(implementors); } return implementors; } ! @Override ! void addVisibleMethods(Map<String, Method> methodMap, Set<InterfaceType> seenInterfaces) { /* * Add methods from * parent types first, so that the methods in this class will * overwrite them in the hash table */ ! Iterator<InterfaceType> iter = superinterfaces().iterator(); while (iter.hasNext()) { InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next(); ! if (!seenInterfaces.contains(interfaze)) { ! interfaze.addVisibleMethods(methodMap, seenInterfaces); ! seenInterfaces.add(interfaze); ! } } addToMethodMap(methodMap, methods()); }