Though, there is some dissension as to just how far we should go in minimizing the scope. I think Mario's fixes walk the line pretty well (even with my suggested dup of a line or two of code in Path2D), but I'm forwarding these messages for transparency about the process and strategy...

                        ...jim

-------- Original Message --------
Subject: Re: Warnings Cleanup in java.util.<various> (more from hack day)
Date: Fri, 02 Dec 2011 19:30:46 -0500
From: Doug Lea <[email protected]>
To: [email protected]

On 12/02/11 19:16, John Rose wrote:

Presently we are aiming at removing warnings with no changes to semantics
(i.e., bytecodes).

Note that this is at odds with suggestions such as:

java/util/Currency.java --

The @SuppressWarnings covers the entire method. We're trying to use
@SuppressWarnings with as narrow a scope as possible. Sometimes it's helpful to
create a local variable declaration for this purpose; perhaps something like
this will help:

@SuppressedWarnings("unchecked")
Set<Currency> result = (Set<Currency>) available.clone();
return result;

This generates two more bytecodes and a local variable.
This won't matter when the code is actually JIT-compiled, but
the increased size might inhibit inlining or compilation.
Surely it doesn't matter in this class, but we are very careful
about these and many related issues in performance-sensitive
java.util.concurrent code.

Too bad you cannot place annotations on expressions.

Also too bad that javac doesn't do trivial optimizations.

-Doug

Reply via email to