Annotations across modules

Stephen Colebourne scolebourne at joda.org
Mon Nov 16 23:43:16 UTC 2015


On 16 November 2015 at 22:04, Alex Buckley <alex.buckley at oracle.com> wrote:
> This is all true -- a static reference to java.beans.ConstructorProperties
> necessitates a dependency on java.desktop at compile time.
>
> The reason for my stripped-down answer was that Stephen phrased the question
> using some rather abstract language -- "an annotation is placed into a
> class", "a user may run my software ...". This made me think something
> clever was going on -- for example, the user's dependency on java.desktop is
> factored out and Stephen's software receives a Class object for
> java.beans.ConstructorProperties from someone else.

FWIW, the case I was considering no longer applies. Joda-Beans is a
source code generator. I was planning on always adding
@ConstructorProperties and relying on the fact that if the annotation
is not found at runtime it does not matter. But the discussion above
indicates that it will be hard to have a different set of modules at
compile time to runtime. In the end, I made generation of
@ConstructorProperties opt-in, so the problem effectively goes away.

I suspect that I will return to discuss optional dependencies before
too long, as it is a big concern of mine.

Stephen


More information about the jigsaw-dev mailing list