#ModuleAnnotations - Rethinking scope of ElementType.MODULE

Remi Forax forax at univ-mlv.fr
Fri Jul 8 15:35:17 UTC 2016


The exact semantics of an annotation depends on the annotation itself.

For some annotations on a class like @NonNull, the semantics applies on all the code inside the class. For an annotation like @Table the semantics as an effect on the class only.

So it should not be different for an annotation on a module.

Rémi


On July 8, 2016 4:38:47 PM GMT+02:00, Paul Benedict <pbenedict at apache.org> wrote:
>I am wondering if the addition of ElementType.MODULE should be
>rethought.
>When an annotation is applied to PACKAGE, it applies package-wide (and
>thus
>affecting things inside it too). For example, I can put a JAXB
>@XmlSchemaType annotation on a package to affect the way classes inside
>the
>package are mapped.
>
>However, the way annotations are being implemented on MODULE, if
>applies
>just to that file -- not the entire module. But what if in the future
>there
>is an RFE for annotations to apply to the entire module? Has it already
>been decided that feature has no use cases? I think some pause should
>be
>given here before this feature is taken away.
>
>Cheers,
>Paul
>
>---------- Forwarded message ----------
>From: <jan.lahoda at oracle.com>
>Date: Fri, Jul 8, 2016 at 9:25 AM
>Subject: hg: jigsaw/jake/jdk: Adding ElementType.MODULE as a target for
>@SuppressWarnings.
>To: jigsaw-dev at openjdk.java.net
>
>
>Changeset: f985e08a0422
>Author:    jlahoda
>Date:      2016-07-08 16:20 +0200
>URL:       http://hg.openjdk.java.net/jigsaw/jake/jdk/rev/f985e08a0422
>
>Adding ElementType.MODULE as a target for @SuppressWarnings.
>Contributed-by: joe.darcy at oracle.com
>
>! src/java.base/share/classes/java/lang/SuppressWarnings.java

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.


More information about the jigsaw-dev mailing list