RFR: JDK-8286153: Remove redundant casts and other cleanup [v2]

liach duke at openjdk.java.net
Thu May 5 23:58:50 UTC 2022


On Thu, 5 May 2022 17:20:25 GMT, Jonathan Gibbons <jjg 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`.
>
> Jonathan Gibbons has updated the pull request incrementally with one additional commit since the last revision:
> 
>   address review feedback

src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/ClassUseMapper.java line 224:

> 222:                 mapTypeParameters(classToFieldTypeParam, fd, fd);
> 223:                 mapAnnotations(annotationToField, fd, fd);
> 224:                  var stv = new SimpleTypeVisitor9<Void, VariableElement>() {

Extra space before `var`

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

> 1526:             instance.setStrength(strength);
> 1527: 
> 1528:             keys = new LinkedHashMap<>(MAX_SIZE + 1, 0.75f, true) {

This map's initial capacity requires it to resize before it starts evicting, see https://github.com/openjdk/jdk/blob/7ebc4bce930e7d406f1e68c8bd09ac1dc3a21e5a/src/java.base/share/classes/java/util/HashMap.java#L2563

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

PR: https://git.openjdk.java.net/jdk/pull/8543


More information about the javadoc-dev mailing list