jdeps and annotations parameters
Alex Buckley
alex.buckley at oracle.com
Tue Sep 8 20:17:40 UTC 2015
On 9/5/2015 5:05 PM, Jeff Hain wrote:
> @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE_USE)
> public @interface A_TYPE_USE_R_COMPLEX {
> Class<? extends Number>[] nbrClsArr() default {Byte.class};
> String tooStrong();
> RoundingMode rounding();
> }
>
> Also found a possible javac problem (unless that's perfectly normal :):
> When you put the following code:
>
> @A_TYPE_USE_R_COMPLEX(nbrClsArr={Long.class},tooStrong="",rounding=RoundingMode.UNNECESSARY)
> Integer foo = 1;
>
> in a constructor or regular method, Long, RoundingMode and A_TYPE_USE_R_COMPLEX
> types make it into the class file (and jdeps properly detects them),
> but when you put it in an init block (static or not), they don't appear
> in the class file (only Integer does).
Either this is a huge bug in javac or you're not looking in the right
place. The code in an instance initializer compiles into the same <init>
method as the code in a constructor, so I would expect the <init> method
to have a RuntimeVisibleTypeAnnotations attribute whether the local
variable (whose type is annotated) exists in {...} or a ctor.
Alex
More information about the jigsaw-dev
mailing list