1919 * collected. Uses {@link PhantomReference} for GC detection, which is available on all platforms
2020 * including Android.
2121 *
22- * @see <a
23- * href="https://tc39.es/ecma262/#sec-finalization-registry-objects">ECMAScript
22+ * @see <a href="https://tc39.es/ecma262/#sec-finalization-registry-objects">ECMAScript
2423 * FinalizationRegistry Objects</a>
2524 */
2625public class NativeFinalizationRegistry extends ScriptableObject {
@@ -33,8 +32,7 @@ public class NativeFinalizationRegistry extends ScriptableObject {
3332 private final Function cleanupCallback ;
3433 private final Scriptable parentScope ;
3534 private final Set <RegistrationReference > activeRegistrations = ConcurrentHashMap .newKeySet ();
36- private final Map <TokenKey , Set <RegistrationReference >> tokenIndex =
37- new ConcurrentHashMap <>();
35+ private final Map <TokenKey , Set <RegistrationReference >> tokenIndex = new ConcurrentHashMap <>();
3836
3937 /** Initialize FinalizationRegistry constructor and prototype. */
4038 static Object init (Context cx , Scriptable scope , boolean sealed ) {
@@ -208,18 +206,16 @@ private void executeCleanup(Context cx, Object heldValue) {
208206 cleanupCallback .call (cx , parentScope , this , new Object [] {heldValue });
209207 } catch (RhinoException e ) {
210208 // Per spec, errors in cleanup callbacks don't propagate
211- Context .reportWarning (
212- "FinalizationRegistry cleanup callback threw: " + e .getMessage ());
209+ Context .reportWarning ("FinalizationRegistry cleanup callback threw: " + e .getMessage ());
213210 }
214211 }
215212
216213 /**
217214 * Check if the given object can be used as a FinalizationRegistry target.
218215 *
219- * <p>Per ECMAScript spec, FinalizationRegistry targets can be:
220- * - Any object (Scriptable)
221- * - Unregistered symbols (created with Symbol(), not Symbol.for())
222- * - Registered symbols (Symbol.for()) cannot be registered as they persist globally
216+ * <p>Per ECMAScript spec, FinalizationRegistry targets can be: - Any object (Scriptable) -
217+ * Unregistered symbols (created with Symbol(), not Symbol.for()) - Registered symbols
218+ * (Symbol.for()) cannot be registered as they persist globally
223219 *
224220 * @param target the target object to validate
225221 * @return true if target is a valid object or unregistered symbol that can be registered
@@ -239,8 +235,8 @@ private static boolean isValidTarget(Object target) {
239235 /**
240236 * Check if the given value can be used as an unregister token.
241237 *
242- * <p>Per ECMAScript spec, registered symbols (created with Symbol.for()) cannot be held
243- * weakly because they persist in the global registry.
238+ * <p>Per ECMAScript spec, registered symbols (created with Symbol.for()) cannot be held weakly
239+ * because they persist in the global registry.
244240 *
245241 * @param token the token to validate
246242 * @return true if token can be used as an unregister token
0 commit comments