JDK 9 RFR of JDK-8036744: Fix raw lint warnings in java.lang.reflect.WeakCache (original) (raw)

Mandy Chung mandy.chung at oracle.com
Thu Mar 6 00:57:11 UTC 2014


Thumbs up. Mandy

On 3/5/2014 4:52 PM, Joe Darcy wrote:

Hello,

Please review the simple patch below which resolves two unchecked cast lint warnings in java.lang.reflect.WeakCache. Thanks, -Joe diff -r 9099a251d211 src/share/classes/java/lang/reflect/WeakCache.java --- a/src/share/classes/java/lang/reflect/WeakCache.java Wed Mar 05 11:53:35 2014 -0800 +++ b/src/share/classes/java/lang/reflect/WeakCache.java Wed Mar 05 16:51:20 2014 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -184,6 +184,7 @@ return reverseMap.size(); } + @SuppressWarnings("unchecked") // refQueue.poll actually returns CacheKey private void expungeStaleEntries() { CacheKey cacheKey; while ((cacheKey = (CacheKey)refQueue.poll()) != null) { @@ -351,6 +352,7 @@ } @Override + @SuppressWarnings("unchecked") public boolean equals(Object obj) { K key; return obj == this || @@ -359,7 +361,7 @@ // cleared CacheKey is only equal to itself (key = this.get()) != null && // compare key by identity - key == ((CacheKey) obj).get(); + key == ((CacheKey) obj).get(); // Cast is safe from getClass check } void expungeFrom(ConcurrentMap> map,



More information about the core-libs-dev mailing list