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

[lw4] Unable to extend a separately compiled abstract value class

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • repo-valhalla
    • repo-valhalla
    • tools
    • generic
    • generic

      Frederic reports:

      It seems there’s an issue with separate compilation when abstract value classes are extended:

      $ cat AbstractValue.java
      public abstract value class AbstractValue { }

      $ cat MyValue.java
      public value class MyValue extends AbstractValue {}
      $ javac AbstractValue.java MyValue.java
      $ rm *.class
      $ javac AbstractValue.java
      $ javac MyValue.java
      MyValue.java:1: error: The super class AbstractValue of the value class MyValue defines a nonempty no-arg constructor AbstractValue(). This is disallowed
      public value class MyValue extends AbstractValue {}
                   ^
      1 error
      In the first case, AbstractValue and MyValue are compiled together, and javac successfully compiles both of them.
      In the second case, AbstractValue is compiled first, then MyValue is compiled (using the already compiled AbstractValue.class class file), and this second compilation fails with the error above.

            sadayapalam Srikanth Adayapalam (Inactive)
            sadayapalam Srikanth Adayapalam (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: