please review 7117612: warnings fixes in java.lang

Alan Bateman Alan.Bateman at oracle.com
Mon Dec 5 10:12:55 UTC 2011


On 05/12/2011 01:02, Stuart Marks wrote:
> Please review the following webrev submitted by Omair Majid, 
> consisting of warnings fixes for a variety of files in java.lang.
>
> http://cr.openjdk.java.net/~omajid/webrevs/warnings-day-2011/01/
>
> It looks pretty clean, but it would be good to get another pair of 
> eyes on this since there is sometimes great subtlety in java.lang.
>
> My comments below.
>
> AutoCloseable.java --
>
>     java/lang/AutoCloseable.java:34: warning: [try] auto-closeable
>     resource AutoCloseable has a member method close() that could
>     throw InterruptedException
>
> The warning here is kind of silly. The intent is to warn implementors 
> of AutoCloseable not to throw InterruptedException. But this is an 
> interface, not an implementation, and it's the AutoCloseable interface 
> itself! We may want to rethink when the compiler emits this warning, 
> instead of suppressing the warning in source code. Joe, what do you 
> think about this?
>
> CharacterName.java --
>
> Consider narrowing the scope of @SuppressWarnings by using a local 
> variable.
>
> Thanks,
>
> s'marks
I see this fixes a warning in 
src/solaris/classes/java/lang/ProcessEnvironment.java, there are also a 
couple of warnings in 
src/windows/classes/java/lang/ProcessEnvironment.java.

Otherwise looks like to me (except for EnumConstantNotPresentException 
that David has already pointed out).  I also agree suppressing the try 
warning in AutoCloseable, maybe it has to be special cased in the compiler.

-Alan







More information about the core-libs-dev mailing list