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

Make PopupFeatures and PromptData final

XMLWordPrintable

    • web

      Richard Bair writes:
      Looking at PromptData, either the class should be final if it is not meant to be extended, or the getters at least should be final. The reason for this is that these properties are clearly intended to be immutable, however because the methods are non-final subclasses can override and "do mischief". It is somewhat controversial, but this is the pattern we've used throughout the rest of the platform, such that all property getters / setters are all final.

      Same with PopupFeatures, should have final getters or a final class.

      Personally I like to have both final methods and final classes, because if the class ever becomes non-final, we would know that we didn't accidentally make a bunch of methods non-final at the same time. Some IDE's complain about having final methods in a final class, but personally I prefer that for safety sake.

            peterz Peter Zhelezniakov
            peterz Peter Zhelezniakov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: