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

[Testbug] compiler/linkage/LinkageErrors.java fails if run twice

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 11
    • 9, 10, 11
    • hotspot
    • b26

        The test consists of a Java source file and a jasm file which are used as follows:

         * @compile CallSites.jasm
         * @run main/othervm -Xverify:all -Xbatch
         * -XX:CompileCommand=dontinline,compiler.linkage.LinkageErrors::test*
         * compiler.linkage.LinkageErrors

        The Java file defines:

        interface I {
            void m1(int i);
            static void s1() {}
        }

        class A implements I {
            public void m1(int i) {}
        }

        the jasm file has:

        super class compiler/linkage/I
        version 52:0
        {

        }

        which defines I as a class not an interface.

        When we run the test from clean the @compile causes the jasm to be processed and I.class is generate where I is a class. Then the @run causes LinkageErrors.java to be compiled, which overwrites I.class with a new version when I is an interface again. The test then runs, instantiates class A, and everything passes.

        If you then run the test again, jtreg again processes the @compile for the jasm file and so we get I.class where I is a class. For the @run however jtreg sees that LinkageError.class is up to date and so doesn't re-run javac. Now when we instantiate A it claims I as a superinterface but I is class and so the test fails with:

         java.lang.IncompatibleClassChangeError: Implementing class

        which comes from the classFileParser when loading a class and it finds that a listed superinterface is not in fact an interface.

        The definition of I in the jasm file needs to be a proper interface definition, not a class definition.

              iignatyev Igor Ignatyev (Inactive)
              dholmes David Holmes
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: