JDK-8029042 : Receiver parameter not supported on local class constructor
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 8
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2013-11-22
  • Updated: 2016-07-26
  • Resolved: 2014-06-11
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.
8u20Fixed 9 b19Fixed
Related Reports
Relates :  
Relates :  
If an inner class is a member, then a receiver parameter works fine:

class Top {
  class Inner {
    Inner(Top Top.this) {}

but if the inner class is local:

class Top {
  void m() {
    class Inner {
      Inner(Top Top.this) {}

then javac (JDK8 b116) gets confused - it thinks Inner is top level:

error: receiver parameter not applicable for constructor of top-level class
      Inner(Top Top.this) {}

This is a bug. A local class is a perfectly good inner class - the ctor of Top$1Inner.class even takes a Top - so its constructor ought to permit a receiver parameter. This is even true when the local class is inside a default method of an interface - in that case, the type of the receiver parameter is the interface. (As of JLS8, it is legal to say InterfaceName.this inside a default method of an interface.)
Release team: Approved for deferral. We should add a test for this for the JCK8a release.

The issue didn't cause any JCK test failures thus there is no reason for 'tck-red" label.

sqe ok to defer. Not a regression. There is a conformance label but no tck-red. Is there a tck test for this?