On Mon, 8 Nov 2021 18:31:11 GMT, Anthony Vanelverdinghe <d...@openjdk.java.net> wrote:
>> Trivial improvement. >> >> Explicitly show how to create a `Cleaner` instance using `Cleaner.create()`. >> Repeat (again) in the code example that the `State` `Runnable `should be >> implemented as static class and not reference the instance to be cleaned, to >> make the point even more clear to those people who never read the javadoc >> *prose*. >> >> I have signed the OCA a while back as >> [hschreiber](https://openjdk.java.net/census#hschreiber). > > src/java.base/share/classes/java/lang/ref/Cleaner.java line 90: > >> 88: * public class CleaningExample implements AutoCloseable { >> 89: * // A cleaner, preferably one shared within a library >> 90: * private static final Cleaner cleaner = Cleaner.create(); > > Now the code (creating a private instance) goes against what the comment > advises (using a shared instance), doesn't it? You have a point. BUT, at least it's a working example and not some pseudo code. We do want to move to working example code long term, don't we? When I see <cleaner>, I'm just wondering what those <> type operators are good for here... ------------- PR: https://git.openjdk.java.net/jdk/pull/6076