Proposal: #ModuleAnnotations and #ModuleDeprecation
Stephane Epardaud
stef at epardaud.fr
Wed Jun 29 09:01:56 UTC 2016
Hi,
This all sounds great, except:
On 28/06/16 23:19, Mark Reinhold wrote:
> - Should it be possible to annotate the individual directives in a
> module declaration? This would allow you to deprecate individual
> exports and requires-public directives, which could be useful in the
> process of evolving an API: If you plan to remove a package, or
> remove a public dependence upon some other module, then you could
> deprecate the corresponding `exports` or `requires public` directive
> (presumably with `forRemoval = true`) to warn your users that the
> API is going to change.
>
> There are no cases in the JDK itself where we need this ability, at least
> not desperately. Designing and implementing this would be a non-trivial
> exercise, and it is a separable feature that could be added later on if
> justified by experience.
In Ceylon we allow annotations on module imports, and we were planning
on recording imported module versions in annotations for Jigsaw. I fear
that disallowing annotations on module imports will lead to people
sticking these annotations on the module, like this for example:
@Versions({
@Version(name = "bar", version = "2.0"),
@Version(name = "gee", version = "1.2")
})
module foo {
import bar;
import gee;
}
So, there's always a way to get around this limitation, but it's quite
horrible and ad-hoc.
More information about the jpms-spec-observers
mailing list