Skip to content

Commit 6e9456a

Browse files
committed
Apply Spotless formatting
1 parent d75af05 commit 6e9456a

File tree

3 files changed

+14
-21
lines changed

3 files changed

+14
-21
lines changed

rhino/src/main/java/org/mozilla/javascript/NativeFinalizationRegistry.java

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
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
*/
2625
public 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

rhino/src/main/java/org/mozilla/javascript/NativeWeakRef.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,7 @@ static Object init(Context cx, Scriptable scope, boolean sealed) {
5151
private static Scriptable jsConstructor(Context cx, Scriptable scope, Object[] args) {
5252
if (args.length < 1) {
5353
throw ScriptRuntime.typeErrorById(
54-
"msg.method.missing.parameter",
55-
CLASS_NAME,
56-
"1",
57-
String.valueOf(args.length));
54+
"msg.method.missing.parameter", CLASS_NAME, "1", String.valueOf(args.length));
5855
}
5956

6057
Object target = args[0];
@@ -87,10 +84,9 @@ private static Object js_deref(
8784
/**
8885
* Check if the given object can be used as a WeakRef target.
8986
*
90-
* <p>Per ECMAScript spec, WeakRef targets can be:
91-
* - Any object (Scriptable)
92-
* - Unregistered symbols (created with Symbol(), not Symbol.for())
93-
* - Registered symbols (Symbol.for()) cannot be held weakly as they persist globally
87+
* <p>Per ECMAScript spec, WeakRef targets can be: - Any object (Scriptable) - Unregistered
88+
* symbols (created with Symbol(), not Symbol.for()) - Registered symbols (Symbol.for()) cannot
89+
* be held weakly as they persist globally
9490
*
9591
* @param target the target object to validate
9692
* @return true if target is a valid object or unregistered symbol that can be weakly referenced

rhino/src/main/java/org/mozilla/javascript/ScriptRuntime.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,8 @@ public static ScriptableObject initSafeStandardObjects(
277277
new LazilyLoadedCtor(scope, "WeakMap", sealed, true, NativeWeakMap::init);
278278
new LazilyLoadedCtor(scope, "WeakSet", sealed, true, NativeWeakSet::init);
279279
new LazilyLoadedCtor(scope, "WeakRef", sealed, true, NativeWeakRef::init);
280-
new LazilyLoadedCtor(scope, "FinalizationRegistry", sealed, true, NativeFinalizationRegistry::init);
280+
new LazilyLoadedCtor(
281+
scope, "FinalizationRegistry", sealed, true, NativeFinalizationRegistry::init);
281282
new LazilyLoadedCtor(scope, "BigInt", sealed, true, NativeBigInt::init);
282283
new LazilyLoadedCtor(scope, "Proxy", sealed, true, NativeProxy::init);
283284
new LazilyLoadedCtor(scope, "Reflect", sealed, true, NativeReflect::init);

0 commit comments

Comments
 (0)