RFR: JDK-8241310 Fix warnings in jdk buildtools

Remi Forax forax at univ-mlv.fr
Thu Mar 19 18:12:54 UTC 2020

Hi Magnus,

please try not to use @SuppressWarnings("unchecked") on methods, but on local variable instead to reduce the scope,
you can introduce a local variable for that.

In Bundle, your patch declare @SuppressWarnings("unchecked") on the method while you already have a local variable with a @SuppressWarnings("unchecked").

Also, usually you don't need @SuppressWarnings("rawtype") apart when you use Object.getClass, otherwise using a wilcard solve the issue.
By example in PluralsParseHandle, 
  instead of
    Entry entry = (Entry)currentContainer;
  the code should be
    Entry<?,?> entry = (Entry<?,?>)currentContainer; 

BTW, in this method, you have an Arrays.stream(array).forEach() which is an antipattern, a simple loop should be used instead.


----- Mail original -----
> De: "Magnus Ihse Bursie" <magnus.ihse.bursie at oracle.com>
> À: "build-dev" <build-dev at openjdk.java.net>, "core-libs-dev" <core-libs-dev at openjdk.java.net>
> Envoyé: Jeudi 19 Mars 2020 17:53:09
> Objet: RFR: JDK-8241310 Fix warnings in jdk buildtools

> The buildtools (java tools needed to be run during the build) have long
> been plagued by warnings, includuing deprecations and unchecked
> warnings, which cannot be silenced during the build.
> This patch fixes all buildtool warnings. Most of the warnings are fixed
> properly, but a few have had their warnings suppressed locally.
> For two tools, cldrconverter and tzdb, I gave up to get them fully
> fixed, and instead suppressed warnings in some places. Common for both
> these tools were that they used collections of some kind, with a mixed
> bag of data types (e.g. a Map from String to either String, HashMap,
> ArrayList and String[]). I'm frankly not sure how this could ever have
> worked :-) but I assume that the data files being parsed has a structure
> that "guarantees" that this works.
> Two files in generatecharacter were missing a proper copyright header. I
> noticed this when I were about to update the copyright year, and when I
> checked the other files I noted another one without header. While I did
> not need to change this file, I thought it was suitable to fix the
> missing header for both files.
> I have verified that the code generated by the build is identical with
> and without this patch.
> Bug: https://bugs.openjdk.java.net/browse/JDK-8241310
> WebRev:
> http://cr.openjdk.java.net/~ihse/JDK-8241310-fix-warnings-in-buildtools/webrev.01
> /Magnus

More information about the core-libs-dev mailing list