JDK 8 RFR: more core libs raw warnings cleanup

Joe Darcy joe.darcy at oracle.com
Tue Nov 12 17:30:39 UTC 2013


I'll push with this improvement; thanks,

-Joe

On 11/12/2013 04:20 AM, Joel Borggren-Franck wrote:
> This also allows you to get rid of the raw type suppression I think, the
> attached code compiles.
>
> Thanks Remi,
>
> cheers
> /Joel
>
> diff --git a/src/share/classes/java/lang/reflect/Proxy.java b/src/share/classes/java/lang/reflect/Proxy.java
> --- a/src/share/classes/java/lang/reflect/Proxy.java
> +++ b/src/share/classes/java/lang/reflect/Proxy.java
> @@ -490,13 +490,14 @@
>        * a key used for proxy class with any number of implemented interfaces
>        * (used here for 3 or more only)
>        */
> +    @SuppressWarnings("unchecked")
>       private static final class KeyX {
>           private final int hash;
>           private final WeakReference<Class<?>>[] refs;
>   
>           KeyX(Class<?>[] interfaces) {
>               hash = Arrays.hashCode(interfaces);
> -            refs = new WeakReference[interfaces.length];
> +            refs = (WeakReference<Class<?>>[]) new WeakReference<?>[interfaces.length];
>               for (int i = 0; i < interfaces.length; i++) {
>                   refs[i] = new WeakReference<>(interfaces[i]);
>               }
>
> On 2013-11-12, Remi Forax wrote:
>> On 11/12/2013 10:51 AM, Chris Hegarty wrote:
>>> Looks ok to me Joe.
>>>
>>> -Chris.
>> A small issue,
>>    refs = (WeakReference<Class<?>>[])new WeakReference[interfaces.length];
>> should be
>>    refs = (WeakReference<Class<?>>[])new
>> WeakReference<?>[interfaces.length];
>>
>> otherwise, looks good.
>>
>> Rémi
>>
>>




More information about the core-libs-dev mailing list