Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-7196160

Project Coin: Allow @SafeVarargs on private methods

    Details

    • Subcomponent:
    • Introduced In Build:
      b123
    • Introduced In Version:
      7
    • Resolved In Build:
      b22
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                darcy Joe Darcy
                Reporter:
                darcy Joe Darcy
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: