JDK-8029012 : parameter_index for type annotation not updated after outer.this added
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 8,9
  • Priority: P3
  • Status: Resolved
  • Resolution: Won't Fix
  • Submitted: 2013-11-22
  • Updated: 2015-06-04
  • Resolved: 2014-12-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.
JDK 8 JDK 9 Other
8u45Fixed 9Fixed naResolved
Related Reports
Blocks :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
For this Class:

public class A {
    public A(@X A.@Y B jjj) { }

    class B {
        public B(@X A. @Y B lll) { }
    }
}

This method is generated:

  public A$B(A, A$B);
    descriptor: (LA;LA$B;)V
    flags: ACC_PUBLIC
    Code:

...

    RuntimeVisibleTypeAnnotations:
      0: #14(): METHOD_FORMAL_PARAMETER, param_index=0, location=[INNER_TYPE]
      1: #15(): METHOD_FORMAL_PARAMETER, param_index=0


param_index=0 is wrong since outer.this A is now param 0 and param "lll" is now param 1.

Comments
Fixing this in 8u40 causes a breaking change for previous 8-branch javac builds. See JDK-8066725.
11-12-2014

re-opening the master bug for 8u40. This was closed incorrectly.
18-11-2014

Could somebody comment on my question from 2014-03-01 20:36? With this change there is now a mismatch between the parameter index for a declaration annotation vs. a type annotation.
07-11-2014

Out for review
03-11-2014

SQE is ok to defer from 8u20.
25-06-2014

need SQE-OK prior to approval. We need some sort of Fixversion or what should we put there? maybe 9-pool?
24-06-2014

Take the program at the end of this comment, which uses a declaration and a type annotation. The parameter index of the type annotations is consistent with the RuntimeInvisibleParameterAnnotations index of the declaration annotations: RuntimeInvisibleTypeAnnotations: 0: #15(): METHOD_RECEIVER 1: #15(): METHOD_FORMAL_PARAMETER, param_index=0 2: #15(): METHOD_FORMAL_PARAMETER, param_index=1 RuntimeInvisibleParameterAnnotations: 0: 0: #19() 1: 0: #19() Neither one accounts for the outer.this parameter that was added. The type annotation on the explicit receiver uses the correct METHOD_RECEIVER target type. Is there a separate issue to change this also for declaration annotations? Shouldn't the behavior for both be consistent? import java.lang.annotation.Annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; class ParamAnnos { @Retention(RetentionPolicy.CLASS) @interface DeclAnnotation {} @Retention(RetentionPolicy.CLASS) @Target(ElementType.TYPE_USE) @interface TypeAnnotation {} void foo(@DeclAnnotation @TypeAnnotation Object p1, @DeclAnnotation @TypeAnnotation String p2) {} class TestInner { TestInner(@TypeAnnotation ParamAnnos ParamAnnos.this, @DeclAnnotation @TypeAnnotation Object p1, @DeclAnnotation @TypeAnnotation String p2) {} } }
02-03-2014

Release team: Approved for deferral.
06-12-2013

8-defer-SQE-OK: this can be deferred as it may need further consideration.
25-11-2013

Release team: Need QA to approve this before deferring it.
25-11-2013

8-defer justification: Not a show stopper. You get the wrong result back in some cases with inner classes.
25-11-2013