RFR: 8329644: Discuss expected visitor evolution patterns in javax.lang.model.util
Jan Lahoda
jlahoda at openjdk.org
Wed Apr 17 15:27:00 UTC 2024
On Wed, 17 Apr 2024 15:10:28 GMT, Pavel Rappo <prappo at openjdk.org> wrote:
> > > I have a few inline comments and a dumb question. The question: what happens if a preview feature exits the preview stage without being promoted to the standard, i.e. the preview feature is dropped?
> >
> >
> > When the preview feature is dropped, I would assume the API elements related to it would be removed. The `Preview` help with that, as they stay, only the methods are removed. At least, this is what I would expect.
> > Overall, looks reasonable to me. I wonder if the text should say the newly-added API entry points should be marked as preview? I assume it may be difficult to talk explicitly about `@jdk.internal.javac.PreviewFeature` here, but maybe a general note that it should be ensured the entry points are recognized as preview? Or did I miss that? Thanks.
>
> Your latter paragraph is why I asked my question in the first place. If you reflect on an element of a preview feature Y, one could say that you indirectly use that preview feature Y, and so all the terms and conditions for preview features apply. If Y then goes away, you weren't warned/reminded that your code will no longer compile, and that's bad.
We mark the preview-related entry points of the javax.lang.model and Trees API with `@PreviewFeature(..., reflective=true)`, and this then produces warnings like:
$ javac /tmp/TestPreview.java
/tmp/TestPreview.java:3: warning: [preview] COMPONENT_LOCAL_VARIABLE is a reflective preview API and may be removed in a future release.
System.err.println(javax.lang.model.element.ElementKind.COMPONENT_LOCAL_VARIABLE);
^
1 warning
I.e. the potential removal is not without a warning. (The difference between "reflective" and non-"reflective" Preview API is that the reflective API can be used without `--enable-preview`.)
>
> Let's wait for Joe to respond.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/18804#issuecomment-2061533572
More information about the compiler-dev
mailing list