JDK-6998735 : Variable arity parameter type involving arrays
  • Type: Enhancement
  • Component: specification
  • Sub-Component: language
  • Affected Version: 7
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2010-11-09
  • Updated: 2014-02-26
  • Resolved: 2011-07-21
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 7
7 rcFixed
Related Reports
Relates :  
Relates :  
Description
JLS3 allows legacy array syntax ('int x[]') for a variable-arity parameter ('int... x[]') but neither javac nor Eclipse ever supported it. We should seize this opportunity to ban it by allowing only an identifier after '...' in 8.4.1:

LastFormalParameter:
  VariableModifiers_opt Type '...' Identifier   // Note '...' is not _opt
  FormalParameter

"The last formal parameter in a list may be a variable arity parameter, indicated by an ellipsis following the type. ***Legacy array syntax (10.2) is not supported for a variable arity parameter.***"

Regarding legacy array syntax elsewhere in the JLS:

JLS3 14.4.1 says: "The type of the variable is denoted by the Type that appears in the local variable declaration, followed by any bracket pairs that follows the Identifier in the declarator."

This text applies to any variable declaration at an array type, so JLS 10.2 should include it (suitably modified) after the paragraph "The [] may appear as part...". 8.3's paragraph "Variable declarations involving array types are discussed in 10.2" then has more utility.

10.2's reference to 8.3 should also point to 14.4.1.

Comments
EVALUATION Yes.
02-12-2010