Skip to content

Commit

Permalink
deprecate Context#emptyArgs (see #1793)
Browse files Browse the repository at this point in the history
  • Loading branch information
rbri committed Jan 8, 2025
1 parent 3b3b5e2 commit 559801f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 6 additions & 2 deletions rhino/src/main/java/org/mozilla/javascript/Context.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 559801f

Please sign in to comment.