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

Project Coin: Allow @SafeVarargs on private methods

XMLWordPrintable

    • b123
    • 7
    • b22
    • generic
    • generic
    • Verified

      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.

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: