jdeps and annotations parameters
Jeff Hain
jeffhain at rocketmail.com
Sun Sep 6 00:05:13 UTC 2015
Hi Mandy.
>This is a bug. It should inspect inner classes only if the outer class is public.
The class file format contains the access flags of nested classes
that are on the way to the top level class (inner_class_access_flags),
but not the flags of the top level class, so the API-ness of a nested
class can't be fully computed.
What could be done (will do that in my lib) is supposing that the top level
class is public, since public or protected things in a package-private
top level class should be rare (and weird?) anyway.
While building up (hopefully) exhaustive unit tests,
I found out one more jdeps issue:
When computing dependencies of an annotation, types involved
in default values ("AnnotationDefault" attribute) are ignored:
Ex.:
@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();
}
===> Dependency to Byte is not detected
(along with dependencies to ElementType and RetentionPolicy
as already reported)
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).
-Jeff
More information about the jigsaw-dev
mailing list