JDK-8010737 : javac, known parameter's names should be copied to automatically generated constructors for inner classes
  • Type: Enhancement
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 8
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2013-03-25
  • Updated: 2013-12-09
  • Resolved: 2013-06-01
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 8
8 b94Fixed
Related Reports
Relates :  
Description
When generating the method symbol for the anonymous inner class of the example:

    @Target(value = {ElementType.PARAMETER})
    @interface ParamAnnotation {}

    public class initParams {
        public initParams(@ParamAnnotation int i) {}

        public void m() {
            new initParams(2) {};
        }
    }

Javac will create an int parameter for it, named x0 instead of reusing the more logical "i" in this case.
Also the parameter annotation should be copied to the generated parameter.
Comments
Parameter annotations are copied to automatically generated constructors for inner classes This fix implies that now for programs like: @Target(value = {ElementType.PARAMETER}) @interface ParamAnnotation {} public class initParams { public initParams(@ParamAnnotation int i) {} public void m() { new initParams(2) {}; } } The constructor generated for the inner class created in method m() will have a parameter int i with the annotation @ParamAnnotation. This change in the behavior may impact some annotations processor or applications that use the annotations.
21-11-2013

webrev sent
20-04-2013

waiting for ccc approval
09-04-2013