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

Unhelpful error message when wrongfully trying to extend a record.

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • None
    • tools
    • generic
    • generic

      ADDITIONAL SYSTEM INFORMATION :
      Ubuntu 22.04.2 LTS
      openjdk version "20-internal" 2023-03-21
      OpenJDK Runtime Environment (build 20-internal-adhoc.admin1.jdk-jdk-20-34)
      OpenJDK 64-Bit Server VM (build 20-internal-adhoc.admin1.jdk-jdk-20-34, mixed mode)

      A DESCRIPTION OF THE PROBLEM :
      When a user tries to extend a record then 2 errors are produced. One that states that inheritance from a final record is not possible, which is good. However, there is another, more prominent error message that complains about the constructor (constructor ... in record ... cannot be applied to given types). This second error message and description is quite a bit bigger, hence the first error can be easily overlooked, and generally the second error is not necessary.
      It would be good if the second error can be removed to avoid unnecessary confusion in this case.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      public record Record2(int a, int b){
      }

      public class TestClass extends Record2{
      public TestClass(){}
      }


      FREQUENCY : always


            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: