From 559801f6b65a6947ce71e79339269efc1d57e67a Mon Sep 17 00:00:00 2001 From: Ronald Brill Date: Wed, 8 Jan 2025 07:07:51 +0100 Subject: [PATCH] deprecate Context#emptyArgs (see #1793) --- .../java/org/mozilla/javascript/tools/debugger/Dim.java | 2 +- rhino/src/main/java/org/mozilla/javascript/Context.java | 8 ++++++-- .../src/main/java/org/mozilla/javascript/JavaMembers.java | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/rhino-tools/src/main/java/org/mozilla/javascript/tools/debugger/Dim.java b/rhino-tools/src/main/java/org/mozilla/javascript/tools/debugger/Dim.java index 7a3fe99303..a972d3e9fa 100644 --- a/rhino-tools/src/main/java/org/mozilla/javascript/tools/debugger/Dim.java +++ b/rhino-tools/src/main/java/org/mozilla/javascript/tools/debugger/Dim.java @@ -565,7 +565,7 @@ private Object getObjectPropertyImpl(Context cx, Object object, Object id) { /** Returns an array of the property names on the given script object. */ private Object[] getObjectIdsImpl(Context cx, Object object) { if (!(object instanceof Scriptable) || object == Undefined.instance) { - return Context.emptyArgs; + return ScriptRuntime.emptyArgs; } Object[] ids; diff --git a/rhino/src/main/java/org/mozilla/javascript/Context.java b/rhino/src/main/java/org/mozilla/javascript/Context.java index ab60a78daf..e397248502 100644 --- a/rhino/src/main/java/org/mozilla/javascript/Context.java +++ b/rhino/src/main/java/org/mozilla/javascript/Context.java @@ -387,8 +387,12 @@ public class Context implements Closeable { public static final String languageVersionProperty = "language version"; public static final String errorReporterProperty = "error reporter"; - /** Convenient value to use as zero-length array of objects. */ - public static final Object[] emptyArgs = ScriptRuntime.emptyArgs; + /** + * Convenient value to use as zero-length array of objects. + * + * @deprecated As of 1.8.1, use {@link ScriptRuntime#emptyArgs} instead. + */ + @Deprecated public static final Object[] emptyArgs = ScriptRuntime.emptyArgs; /** * Creates a new Context. The context will be associated with the {@link diff --git a/rhino/src/main/java/org/mozilla/javascript/JavaMembers.java b/rhino/src/main/java/org/mozilla/javascript/JavaMembers.java index 8539710351..8f02fb63d6 100644 --- a/rhino/src/main/java/org/mozilla/javascript/JavaMembers.java +++ b/rhino/src/main/java/org/mozilla/javascript/JavaMembers.java @@ -101,7 +101,7 @@ Object get(Scriptable scope, String name, Object javaObject, boolean isStatic) { if (member instanceof BeanProperty) { BeanProperty bp = (BeanProperty) member; if (bp.getter == null) return Scriptable.NOT_FOUND; - rval = bp.getter.invoke(javaObject, Context.emptyArgs); + rval = bp.getter.invoke(javaObject, ScriptRuntime.emptyArgs); type = bp.getter.method().getReturnType(); } else { Field field = (Field) member;