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

Lambda Spec: Array types cannot be used for static method references

XMLWordPrintable

    • Verified

      A static method invocation syntactically looks like
      TypeName . Identifier (...)

      A static method reference syntactically looks like
      ReferenceType :: Identifier

      (This is also the syntax for an unbound instance method reference.)

      If the referenced method turns out to be static, an error should occur if the ReferenceType cannot be expressed as a TypeName. The current (0.7.0) rule is:

      "It is a compile-time error if the method reference is of the form ReferenceType :: NonWildTypeArgumentsopt Identifier, where ReferenceType is a parameterized type, and the compile-time declaration is static."

      But this rule, as written, does not apply to ArrayTypes, even though they cannot be used as static invocation qualifiers.

      (Fortunately, for now array types have no static members. But it's best if the language doesn't depend on that.)

            dlsmith Dan Smith
            dlsmith Dan Smith
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: