JDK-8029012: parameter_index for type annotation not updated after outer.this added
Werner Dietl
wdietl at gmail.com
Tue Mar 4 11:56:50 PST 2014
I added the comment below to:
https://bugs.openjdk.java.net/browse/JDK-8029012
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) {}
}
}
--
http://www.google.com/profiles/wdietl
More information about the type-annotations-dev
mailing list