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

Expand default constructor warning to cover more cases

    XMLWordPrintable

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P4
    • Resolution: Approved
    • Fix Version/s: 16
    • Component/s: tools
    • Labels:
      None
    • Subcomponent:
    • Compatibility Kind:
      behavioral
    • Compatibility Risk:
      minimal
    • Compatibility Risk Description:
      Protected classes occur much less often than public ones, minimal addition in practice to the number of warnings that would be issued.
    • Interface Kind:
      Other
    • Scope:
      JDK

      Description

      Summary

      Expand the lint warning added under JDK-8071961 to cover protected classes as well as public ones.

      Problem

      Besides public classes having default constructors exposed accidentally, a protected class can have its default constructors exposed too as part of the full API of a package.

      Solution

      Expand the lint warning to cover protected classes with the other conditions staying the same. In detail, a warning is issued for public or protected classes in a named package that has an unqualified export from its module where, for nested classes, all the syntactically enclosing classes must are either public or protected.

      Specification

       javac.opt.Xlint.desc.missing-explicit-ctor=\
      -    Warn about missing explicit constructors in public classes in exported packages.
      +    Warn about missing explicit constructors in public and protected classes in exported packages.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              darcy Joe Darcy
              Reporter:
              darcy Joe Darcy
              Reviewed By:
              Alex Buckley
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: