Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8216324

GetClassMethods is confused by the presence of default methods in super interfaces

    XMLWordPrintable

Details

    • b08

    Backports

      Description

        As reported here:

        http://mail.openjdk.java.net/pipermail/core-libs-dev/2019-January/057749.html

        when a default method is present in a super interface, the information GetClassMethods returns for the sub-interface or implementing class, incorrectly includes an inherited method (not the default method itself!).

        This can be seen with a simple modification to an existing test:

        TEST: vmTestbase/nsk/jvmti/GetClassMethods/getclmthd007/TestDescription.java

        diff -r 3da307766fb1 test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassMethods/getclmthd007.java
        --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassMethods/getclmthd007.java
        +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassMethods/getclmthd007.java
        @@ -109,7 +110,11 @@
             }
         }

        -interface OuterInterface1 {
        +interface DefaultInterface {
        + default void default_method() { } // should never be seen
        +}
        +
        +interface OuterInterface1 extends DefaultInterface {
             int meth_i1();
         }


        STDOUT:
        (7) wrong number of methods: 2, expected: 1
        >>> OuterInterface2:
        >>> [0]: meth_i1()I <= INHERITED from OuterInterface1
        >>> [1]: meth_i2()I
        (8) wrong number of methods: 3, expected: 2
        >>> OuterClass4:
        >>> [0]: <init>()V
        >>> [1]: meth_i1()I <= INHERITED from OuterInterface1
        >>> [2]: meth_i2()I


        Attachments

          Issue Links

            Activity

              People

                dtitov Daniil Titov (Inactive)
                dholmes David Holmes
                Votes:
                0 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: