Code Review Request: 7157893: Warnings Cleanup in java.util.* (original) (raw)

Stuart Marks stuart.marks at oracle.com
Thu Apr 5 07:08:24 UTC 2012


Hi Kurchi, Remi,

Sorry for the delay in this review. There were a lot of files to go through, and I wanted to dig up some history as well. (I've also been busy....) There are no real major issues, but I wanted to clear a couple things up and possibly file issues for further work.

Comments follow on a file-by-file basis.

src/share/classes/java/util/Arrays.java

In this file there are several places where @SuppressWarnings is placed on a method, which is rather a broad scope. In some cases like mergeSort() it's probably not worth extracting expressions into declarations just to narrow the scope. In other cases there's a declaration handy already, for example those listed below. It would be good to narrow @SW to these declarations.

src/share/classes/java/util/Collections.java

I was going to suggest adding a comment to explain this but I suspect that would make this code even more confusing.

[1] http://mail.openjdk.java.net/pipermail/jdk8-dev/2011-December/000497.html

[2] http://mail.openjdk.java.net/pipermail/jdk8-dev/2011-December/000501.html

src/share/classes/java/util/ComparableTimSort.java

Is there any reason to keep the local variables, for example, if this code came from an upstream repo?

src/share/classes/java/util/Currency.java

[3] http://mail.openjdk.java.net/pipermail/jdk8-dev/2011-December/000469.html

src/share/classes/java/util/EnumMap.java

src/share/classes/java/util/HashMap.java

src/share/classes/java/util/Hashtable.java

src/share/classes/java/util/PropertyPermission.java

Meanwhile leaving the cast to raw is probably reasonable. There should be a comment that mentions the inability to convert directly to Enumeration. This generates an unchecked warning, so that should be suppressed too.

[4] http://mail.openjdk.java.net/pipermail/jdk8-dev/2011-December/000488.html

Thanks!!

s'marks

On 03/30/2012 02:15 AM, Kurchi Hazra wrote:

Bug : http://monaco.us.oracle.com/detail.jsf?cr=7157893 Webrev: http://cr.openjdk.java.net/~khazra/7157893/webrev.00/

Some related discussion that I could find in the core-libs-dev archives: http://mail.openjdk.java.net/pipermail/core-libs-dev/2011-December/008601.html http://mail.openjdk.java.net/pipermail/core-libs-dev/2011-December/008602.html



More information about the core-libs-dev mailing list