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 9 Other
9Fixed naResolved
Related Reports
Blocks :  
Relates :  
Relates :  
Relates :  
Relates :  
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


      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.

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

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

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.

Out for review

SQE is ok to defer from 8u20.

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

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) {} } }

Release team: Approved for deferral.

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

Release team: Need QA to approve this before deferring it.

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