-
CSR
-
Resolution: Approved
-
P4
-
source
-
minimal
-
Java API, Language construct
-
SE
Summary
Allow the SafeVarargs
annotation to be used on private methods.
Problem
One of the rough edges of Project Coin is that @SafeVarargs cannot be applied to a private instance method even though private instance methods cannot be overridden, just like final instances methods and static methods where @SafeVarargs can be applied.
Solution
Add the capability for @SafeVarargs to be used on
Specification
In the javadoc of the java.lang.SafeVarags annotation, change
"... it is a compile-time error if a method or constructor declaration is annotated with a @SafeVarargs annotation, and either:
the declaration is a fixed arity method or constructor the declaration is a variable arity method that is neither static nor final."
to
"... it is a compile-time error if a method or constructor declaration is annotated with a @SafeVarargs annotation, and either:
the declaration is a fixed arity method or constructor the declaration is a variable arity method that is neither static nor final nor private."
In JLS 9.6.3.7 on SafeVarags, make the following change:
-It is a compile-time error if a variable arity method declaration that is neither static nor final is annotated with the SafeVarargs annotation.
+It is a compile-time error if a variable arity method declaration that is neither static nor final nor private is annotated with the SafeVarargs annotation.
- csr for
-
JDK-7196160 Project Coin: Allow @SafeVarargs on private methods
-
- Closed
-