RFR: 8295653: Add a graph of the sealed class hierarchy for marked classes [v2]

Jonathan Gibbons jjg at openjdk.org
Mon Oct 24 19:56:09 UTC 2022


On Thu, 20 Oct 2022 11:13:18 GMT, Magnus Ihse Bursie <ihse at openjdk.org> wrote:

>> It would be possible to mark classes with `@sealedGraph` to indicate that the sealed hierarchy should be rendered graphically in the JavaDocs. Classes not marked would be unaffected, creating an opt-in approach.
>> 
>> [Here](https://bugs.openjdk.org/secure/attachment/101126/Screen%20Shot%202022-10-19%20at%2012.47.47%20PM.png) is an example of MemoryLayout class rendering.
>> 
>> This feature has been developed in cooperation with Per Minborg.
>
> Magnus Ihse Bursie has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Fix styleheet

make/jdk/src/classes/build/tools/taglet/SealedGraph.java line 93:

> 91:                 .map(ModuleElement.ExportsDirective.class::cast)
> 92:                 // Only include packages that are globally exported (i.e. no "to" exports)
> 93:                 .filter(me -> me.getTargetModules() == null)

The lambda parameter here is an `ExportsDirective`, not a `ModuleElement`, suggesting that the name here should be `ed` instead of `me`.

make/jdk/src/classes/build/tools/taglet/SealedGraph.java line 182:

> 180:                         .append(lineSeparator())
> 181:                         .append("  rankdir=\"BT\";")
> 182:                         .append(lineSeparator());

Note to future selves: if we come up with Yet Another Kind of Graph, we should consider creating a `DotBuilder` class to share/simplify the code.

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

PR: https://git.openjdk.org/jdk/pull/10761



More information about the build-dev mailing list