-
Enhancement
-
Resolution: Fixed
-
P4
-
7
A SafeVarargs annotation can only be applied to variable-arity executables that are one of:
* static methods
* final methods
* constructors (which from a certain point of view are a special kind of static method)
None of these executables can be overriden, which is a constraint since annotation are only inherited along the superclass chain at a type level and *not* at the method/constructor level. Since annotations are not inherited at the method level, an overriding method could knowingly or unknowingly violate the @SafeVararags constraint of the overridden method.
Another kind of non-overridable executable is a private method. Therefore, it would be reasonable to allow @SafeVarargs to be applied to private methods too.
* static methods
* final methods
* constructors (which from a certain point of view are a special kind of static method)
None of these executables can be overriden, which is a constraint since annotation are only inherited along the superclass chain at a type level and *not* at the method/constructor level. Since annotations are not inherited at the method level, an overriding method could knowingly or unknowingly violate the @SafeVararags constraint of the overridden method.
Another kind of non-overridable executable is a private method. Therefore, it would be reasonable to allow @SafeVarargs to be applied to private methods too.
- csr of
-
CCC-7196160 Project Coin: Allow @SafeVarargs on private methods
-
- Closed
-
- relates to
-
JDK-6993978 Project Coin: Compiler support of annotation to reduce varargs warnings
-
- Closed
-
-
JDK-7006129 Project Coin: Annotation type to reduce varargs warnings
-
- Closed
-
-
JDK-6945418 Project Coin: Simplified Varargs Method Invocation
-
- Closed
-
-
JDK-8042880 JEP 213: Milling Project Coin
-
- Closed
-
-
JDK-8279291 Remove restrictions from @SafeVarargs
-
- Closed
-
(1 relates to)