RFR: JDK-8285869: Selective cleanup in doclint Checker class
Jonathan Gibbons
jjg at openjdk.java.net
Tue May 3 21:29:19 UTC 2022
On Tue, 3 May 2022 11:31:09 GMT, Pavel Rappo <prappo at openjdk.org> wrote:
>> Please review some localized cleanup for the doclint Checker class, primarily focused on upgrading to the use of "enhanced `switch`"
>>
>> The output of one test was changed because of some improvements in one switch statement to eliminate the use of fall-through semantics.
>
> src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclint/Checker.java line 866:
>
>> 864: if (paramElement == null) {
>> 865: switch (env.currElement.getKind()) {
>> 866: case CLASS, ENUM, INTERFACE, ANNOTATION_TYPE -> {
>
> Neither an enum nor annotation can be generic.
good point
> src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclint/Checker.java line 1127:
>
>> 1125: return false;
>> 1126:
>> 1127: return switch (e.getKind()) {
>
> While uniformity of constructs is good, to me, the previous variant read better. Does this have to be a switch expression?
no. it may work better as a simple (non-switch) expression; i'll try it
> src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclint/Checker.java line 1171:
>
>> 1169:
>> 1170: private boolean isDefaultConstructor() {
>> 1171: return switch (env.currElement.getKind()) {
>
> Similar to the above.
similar answer
-------------
PR: https://git.openjdk.java.net/jdk/pull/8460
More information about the compiler-dev
mailing list