RFR: JDK-8286153: Remove redundant casts and other cleanup
Jonathan Gibbons
jjg at openjdk.java.net
Thu May 5 16:33:17 UTC 2022
On Thu, 5 May 2022 10:09:32 GMT, Pavel Rappo <prappo at openjdk.org> wrote:
>> Please review some cleanup updates to address issues reported by an IDE.
>>
>> The seeds for the change were a series of redundant casts, that have now all been removed. Various other warnings and suggestions were made by the IDE for the affected files. There were a number of places with redundant type arguments, for which the general fix was in favor of using `var` instead of `<>`.
>>
>> Some `switch` statements were converted to the enhanced `switch` form, which also revealed a couple of places where `RECORD` should have been added alongside `ENUM`.
>
> src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/MetaKeywords.java line 125:
>
>> 123: */
>> 124: public List<String> getOverviewMetaKeywords(String title, String docTitle) {
>> 125: List<String> result = new ArrayList<>(1);
>
> Consider using `var` similarly to my suggestion above. Alternatively, we can use two calls to `List.of(e)` and one call to `List.of()`.
Most of these cases seem better with appropriate variants of `List.of`
-------------
PR: https://git.openjdk.java.net/jdk/pull/8543
More information about the javadoc-dev
mailing list