RFR 9: 8138696 : java.lang.ref.Cleaner - an easy to use alternative to finalization

Kim Barrett kim.barrett at oracle.com
Mon Dec 14 22:49:37 UTC 2015


On Dec 14, 2015, at 5:38 PM, Roger Riggs <roger.riggs at oracle.com> wrote:
> 
> Hi,
> 
> The complexity of using Lambda for cleaning functions are too hard to explain in depth
> in the context of an example.  A more conservative approach is to show using a static nested
> class.  A lambda savvy developer can correctly determine how to avoid the pitfalls, and others
> should stick to the static nested class.
> 
> [1]http://cr.openjdk.java.net/~rriggs/webrev-cleaner-8138696/
> [2]http://cr.openjdk.java.net/~rriggs/cleaner-doc/index.html
> 
> Thanks, Roger
> 
> p.s. last call for comments

A few editorial nits:

------------------------------------------------------------------------------ 
src/java.base/share/classes/java/lang/ref/Cleaner.java 
  72  * The cleaning function is invoked after the object it is cleaning up after it
  73  * becomes phantom reachable, so it is important that the references and values

"after it becomes" => “after becomes”

or maybe instead something like

"after the object it is cleaning up after it" => "after the associated object"

------------------------------------------------------------------------------
src/java.base/share/classes/java/lang/ref/Cleaner.java 
  74  * it needs do not prevent the object from becoming phantom reachable.

Perhaps "it needs" => "the cleaning function needs".

------------------------------------------------------------------------------ 
src/java.base/share/classes/java/lang/ref/Cleaner.java 
 116  * the object reference, by referring to fields of the objecting being cleaned,

"objecting" => "object"

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




More information about the core-libs-dev mailing list