JDK-8179109 : 8.4.1: Error for receiver parameter of an inner class in a static context
  • Type: Bug
  • Component: specification
  • Sub-Component: language
  • Affected Version: 8,9
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2017-04-21
  • Updated: 2018-08-03
  • Resolved: 2017-11-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 10
10Fixed
Related Reports
Relates :  
Description
Some inner classes can occur in static contexts (8.4.1)���e.g., a local class declared in a static method. But these inner classes have no immediately enclosing instance, so shouldn't have a receiver parameter.

Proposed rule:

A receiver parameter may appear only in the FormalParameterList of an instance method or ~~an inner class's constructor~~ **a constructor of an inner class, where the inner class is not declared in a static context**; otherwise, a compile-time error occurs.

Or, if that's too much of a mouthful:

A receiver parameter may appear only in the FormalParameterList of an instance method or an inner class's constructor; otherwise, a compile-time error occurs.

**If a receiver parameter appears in the FormalParameterList of an inner class's constructor, but that class is declared in a static context, a compile-time error occurs.**