JDK-7196160 : Project Coin: Allow @SafeVarargs on private methods
  • Type: Enhancement
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 7
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2012-09-05
  • Updated: 2021-12-27
  • Resolved: 2014-06-24
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9 b22Fixed
Related Reports
CSR :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Sub Tasks
JDK-8047159 :  
JDK-8048014 :  
Description
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.

Comments
URL: http://hg.openjdk.java.net/jdk9/jdk9/langtools/rev/9fe158562a96 User: lana Date: 2014-07-09 17:52:48 +0000
09-07-2014

URL: http://hg.openjdk.java.net/jdk9/dev/langtools/rev/9fe158562a96 User: darcy Date: 2014-06-24 17:51:10 +0000
24-06-2014

Review thread: http://mail.openjdk.java.net/pipermail/compiler-dev/2014-June/008855.html
17-06-2014