On Sat, 26 Dec 2020 03:25:51 GMT, Kim Barrett <kbarr...@openjdk.org> wrote:
> Please review this change which fixes the type of the private > Reference.discovered field. It was Reference<T>, but that's wrong because > it can be any Reference object. > > I've changed it to Reference<?> and let that flow through, updating some > other variables that were previously somewhat incorrectly typed (usually > with an Object type parameter). The interesting change is to the > ReferenceQueue.enqueue parameter, which is now also Reference<?>. > > This ultimately end up with a provably safe and correct, but uncheckable, > cast in ReferenceQueue.enqueue. > > An alternative might be to use a raw type for the discovered field, but I > think that ends up with more @SuppressWarnings of various flavors. I think > the unbounded wildcard approach is clearer and cleaner. > > Note that all of the pending list handling, including the discovered field, > could be moved into a non-public, non-generic, sealed(?) base class of > Reference<T>. The pending list handling has nothing to do with the generic > parameter T. > > Testing: > mach5 tier1 and tier4 (tier4 is where vmTestbase_vm_gc_ref tests are run) This pull request has now been integrated. Changeset: 33dcc00c Author: Kim Barrett <kbarr...@openjdk.org> URL: https://git.openjdk.java.net/jdk/commit/33dcc00c Stats: 17 lines in 1 file changed: 10 ins; 1 del; 6 mod 8132984: incorrect type for Reference.discovered Use unbounded wildcard placeholders, plus a new helper to get back to the Reference<T> domain. Reviewed-by: rkennke, plevart, rriggs, mchung ------------- PR: https://git.openjdk.java.net/jdk/pull/1897