RFR: 8343239: Javadoc marks non-preview type as preview if it's the subtype of a preview type [v3]

Chen Liang liach at openjdk.org
Tue Nov 26 19:16:39 UTC 2024


On Tue, 26 Nov 2024 14:57:18 GMT, Nizar Benalla <nbenalla at openjdk.org> wrote:

>> Please review this patch to improve the javadoc preview header. The parent bug include more details.
>> 
>> This is meant to prevent a bug where, if a non preview class extend an `@PreviewFeature` interface, the Javadoc displays `Programs can only use <<Type>> when preview features are enabled` when the API can be used without enable preview features as long as we don't refer to any methods in the supertype
>> 
>> This is specifically the case in  #17543. Here is the javadoc output [AsymmetricKey](https://cr.openjdk.org/~nbenalla/GeneratedDocs/8343239-2/docs/api/java.base/java/security/AsymmetricKey.html) after merging this branch with the PR `298420: PEM API: Implementation (Preview) #17543`. The only files affected by this change are the class `DEREncodable` and it's Subinterfaces.
>> 
>> One other bug I noticed is that, on the `DEREncodable` page, it's direct subinterfaces had the superscript `PREVIEW` link. I've added a condition to remove it.
>
> Nizar Benalla has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Changed based on Hannes' changes

I don't think we should add 3 new files when we can just use `ToolBox.writeJavaFiles`.

src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java line 2488:

> 2486:                 }
> 2487:                 usedInDeclaration.addAll(types2Classes(List.of(te.getSuperclass())));
> 2488:                 usedInDeclaration.addAll(types2Classes(te.getPermittedSubclasses()));

This one is dubious too - imagine if we have a classfile `Attribute` that is preview-only, such as `Pattern` or `LoadableDescriptors`.  But that is out of scope for this patch.

test/langtools/jdk/javadoc/doclet/testPreview/api2/nonpreviewextendspreview/CoreInterface.java line 1:

> 1: /*

These files are tiny, yet they bring in extra directory structures and huge license headers.  Can we try to use `ToolBox.writeJavaFiles` to generate these source files from text blocks instead?

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

Changes requested by liach (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/22126#pullrequestreview-2462474683
PR Review Comment: https://git.openjdk.org/jdk/pull/22126#discussion_r1859101296
PR Review Comment: https://git.openjdk.org/jdk/pull/22126#discussion_r1859104540


More information about the javadoc-dev mailing list