-
Enhancement
-
Resolution: Fixed
-
P4
-
8
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.
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.