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

Duplicate error message: cannot inherit from final (class) F

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • 9
    • None
    • tools
    • b94
    • generic
    • generic
    • Verified

    Description

      I ran into this while testing https://bugs.openjdk.java.net/browse/JDK-8062373.

      This is however low priority, just so we have a record of it, I have created a ticket.

      While compiling the following program:

      final class F<T> {}

      public class X {
          F f = new F<String> () { };
      }

      we emit two error messages:

      /home/srikanth/tmp/X.java:4: error: cannot inherit from final F
          F f = new F<String> () { };
                    ^
      /home/srikanth/tmp/X.java:4: error: cannot inherit from final F
          F f = new F<String> () { };
                     ^
      2 errors

      one from hierarchy phase and and the other from headers phase.

      When anonymous classes are not involved, the two error messages
      have the same co-ordinate pair and so the second one is discarded.

      Not so while dealing with anonymous classes.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: