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

javac, known parameter's names should be copied to automatically generated constructors for inner classes

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 8
    • 8
    • tools
    • b94
    • Verified

      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.

            vromero Vicente Arturo Romero Zaldivar
            vromero Vicente Arturo Romero Zaldivar
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: