Uploaded image for project: 'CCC Migration Project'
  1. CCC Migration Project
  2. CCC-7196160

Project Coin: Allow @SafeVarargs on private methods

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 9
    • tools
    • 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.

            darcy Joe Darcy
            darcy Joe Darcy
            Alex Buckley
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: