RFR: 8188055: (ref) Add Reference::refersTo predicate [v5]

Mandy Chung mchung at openjdk.java.net
Mon Oct 19 23:13:21 UTC 2020


On Fri, 16 Oct 2020 17:04:51 GMT, Mandy Chung <mchung at openjdk.org> wrote:

>> Kim Barrett has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev
>> excludes the unrelated changes brought in by the merge/rebase. The pull request contains 11 additional commits since
>> the last revision:
>>  - Merge branch 'master' into refersto
>>  - More explicit refersTo0 comment.
>>  - simplify test
>>  - cleanup nits from Mandy
>>  - use Object instead of TestObject
>>  - improve refersTo0 descriptions
>>  - basic functional test
>>  - change referent access
>>  - expand test
>>  - remove CMS comment
>>  - ... and 1 more: https://git.openjdk.java.net/jdk/compare/6bb7151b...ab4e519b
>
> Looks good.

> That's the crux of it: what exactly is meant by "the referent"? Does it
> mean the original object that was used as the referent, or does it mean
> the current value of the "referent" field inside the Reference (as get
> might return)?

"the referent" is the object a `Reference` object refers to.

as it's described in java.lang.ref package description:

> Each reference-object type is implemented by a subclass of the abstract base Reference class. An instance of one of
> these subclasses encapsulates a single reference to a particular object, called the referent.

See also `@return` in `Reference::get`:
> @return The object to which this reference refers, or null if this reference object has been cleared

-------------

PR: https://git.openjdk.java.net/jdk/pull/498


More information about the core-libs-dev mailing list