On Thu, 23 May 2024 13:59:19 GMT, Hannes Wallnöfer <hann...@openjdk.org> wrote:

>> Please review a simple patch to exclude preview visitor classes meant to 
>> support future preview features from the Preview API page. 
>> 
>> The test adds an sample element annotated with the new 
>> `PreviewFeature.Feature.LANGUAGE_MODEL` constant (which does not have a 
>> `@JEP` annotation) to make sure it is not listed in the Preview API page. 
>> The test itself does not have to be modified, as it would fail without the 
>> change in `PreviewAPIListBuilder.java`.
>
> Hannes Wallnöfer has updated the pull request with a new target base due to a 
> merge or a rebase. The pull request now contains three commits:
> 
>  - Merge branch 'master' of https://git.openjdk.org/jdk into JDK-8331947
>  - Only include preview features with a JEP
>  - JDK-8331947: Preview creates checkbox for JEP-less preview feature

I updated this PR to exclude elements of preview features that don't have a JEP 
from the Preview API page. 

In order to do this, I changed the way `SummaryAPIListBuilder` determines which 
API elements to include from using a `Predicate` passed to the constructor to 
using a new abstract `belongsToSummary(Element)` method. The reason for this is 
that the predicate had to be passed to the builder's super-constructor, which 
made it impossible to use an instance method of the current builder. However, 
since determining whether a preview API element has a JEP is somewhat involved 
(retrieving annotation elements of an enum constant used as annotation 
element), we only want to do this once, and ideally the first time we look at 
an element. Being able to use an ordinary instance method was the simplest 
solution to this problem.

I also changed the workaround method that retrieves the JEP info to return a 
`Map<String, Object>` instead of the the raw `javax.lang.model.element` types, 
which makes it easier to use.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/19344#issuecomment-2127244561

Reply via email to