> On 7/01/2019 8:46 pm, Michael Rasmussen wrote: > > Hi, > > > > We recently discovered something similar, although with the native > > counterparts of getDeclaredMethods: the JVM-TI function GetClassMethods and > > the JDI method ReferenceType.methods(). > > The documentation for which states "Only directly declared methods are > > returned (not inherited methods)" or "(...) declared directly in this type. > > Inherited methods are not included." > > > > When running the code pasted below with HotSpot (tried OpenJDK8 and 11), I > > get the following output: > > [public abstract java.lang.String app1.Test$Child.method2()] > > [public default java.lang.String app1.Test$Child.method(), public abstract > > java.lang.String app1.Test$Child.method2()] > > This would appear to be a bug with JVM TI in how default methods are > accounted for. GetClassMethods simply looks at the methods defined in > the instanceKlass, but for interfaces default methods are included. I'll > look into this in more detail and file a hotspot bug.
An interesting thing is that it's not the default method "def" that is listed, but the abstract method "method" (with incorrect modifier?) /Michael