7092897: sun.security.util.Cache should be generified (original) (raw)
Sean Mullan sean.mullan at oracle.com
Tue Oct 18 13:12:30 UTC 2011
- Previous message (by thread): 7092897: sun.security.util.Cache should be generified
- Next message (by thread): hg: jdk8/tl/jdk: 7031830: bad_record_mac failure on TLSv1.2 enabled connection with SSLEngine
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 10/17/11 11:07 PM, Xuelei Fan wrote:
I only have a few very minor suggestions.
in sun/security/util/Cache.java: -> 264 this.queue = soft ? new ReferenceQueue() : null; ^ I would like to remove the generic "V" in the right side of the assignment: 264 this.queue = soft ? new ReferenceQueue<>() : null;
I tried that, but I get a compiler error:
../../../../src/share/classes/sun/security/util/Cache.java:264: error: incompatible types this.queue = soft ? new ReferenceQueue<>() : null; ^ required: ReferenceQueue found: ReferenceQueue where V is a type-variable: V extends Object declared in class MemoryCache 1 error
I think it may be a bug in the compiler though, because if I break out the code like this:
if (soft)
this.queue = new ReferenceQueue<>();
else
this.queue = null;
I don't get an error. I'll look into filing a compiler bug on this, but in the meantime, I'll change the code to the above.
-> 255 private final ReferenceQueue queue; ^ From my first look at the update, I think the real generic type should be "CacheEntry<K,V>", instead of "V". However, because SoftCacheEntry class need to extend SoftReference, we have to use a dummy type "V" here. I was wondering we may want to add a line or two comments here.
Good point. I will add some comments.
Thanks, Sean
Otherwise, looks fine to me. Xuelei On 10/18/2011 2:51 AM, Sean Mullan wrote: Hi Xuelei,
Would you be able to review this fix? http://cr.openjdk.java.net/~mullan/webrevs/7092897/webrev.00/ Thanks, Sean
- Previous message (by thread): 7092897: sun.security.util.Cache should be generified
- Next message (by thread): hg: jdk8/tl/jdk: 7031830: bad_record_mac failure on TLSv1.2 enabled connection with SSLEngine
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]