From 519cb58d71f0941780d56abc4551540a5bb6d74e Mon Sep 17 00:00:00 2001 From: Tony Germano Date: Fri, 13 Sep 2024 00:55:25 -0400 Subject: [PATCH] Update references from deprecated to new methods. ScriptableObject.getProperty methods have been replaced by Scriptable.getProperty. Also remove redundant super interface Scriptable from classes which implement SymbolScriptable. --- .../javascript/benchmarks/MathBenchmark.java | 31 ++++++------ .../benchmarks/ObjectBenchmark.java | 20 ++++---- .../benchmarks/PropertyBenchmark.java | 9 ++-- .../javascript/benchmarks/V8Benchmark.java | 3 +- examples/src/main/java/Control.java | 3 +- examples/src/main/java/CounterTest.java | 6 +-- .../javascript/engine/RhinoScriptEngine.java | 4 +- .../javascript/tools/debugger/Dim.java | 4 +- .../javascript/tools/shell/Global.java | 22 ++++----- .../mozilla/javascript/tools/shell/Main.java | 2 +- .../mozilla/javascript/xmlimpl/XMLCtor.java | 2 +- .../mozilla/javascript/xmlimpl/XMLList.java | 3 +- .../AbstractEcmaObjectOperations.java | 4 +- .../org/mozilla/javascript/Arguments.java | 4 +- .../ArrayLikeAbstractOperations.java | 4 +- .../org/mozilla/javascript/BaseFunction.java | 4 +- .../org/mozilla/javascript/ES6Generator.java | 4 +- .../mozilla/javascript/EqualObjectGraphs.java | 6 +-- .../javascript/IdScriptableObject.java | 4 +- .../mozilla/javascript/InterfaceAdapter.java | 2 +- .../javascript/IteratorLikeIterable.java | 2 +- .../org/mozilla/javascript/JavaAdapter.java | 6 +-- .../org/mozilla/javascript/NativeArray.java | 15 +++--- .../org/mozilla/javascript/NativeDate.java | 2 +- .../org/mozilla/javascript/NativeError.java | 14 +++--- .../org/mozilla/javascript/NativeGlobal.java | 5 +- .../org/mozilla/javascript/NativeJSON.java | 8 +-- .../mozilla/javascript/NativeJavaObject.java | 2 +- .../org/mozilla/javascript/NativeObject.java | 2 +- .../org/mozilla/javascript/NativePromise.java | 2 +- .../org/mozilla/javascript/NativeString.java | 2 +- .../org/mozilla/javascript/NativeWith.java | 2 +- .../org/mozilla/javascript/ScriptRuntime.java | 49 +++++++++---------- .../org/mozilla/javascript/Scriptable.java | 4 +- .../mozilla/javascript/ScriptableObject.java | 46 +++++++++-------- .../java/org/mozilla/javascript/TopLevel.java | 4 +- .../javascript/commonjs/module/Require.java | 2 +- .../provider/ModuleSourceProviderBase.java | 2 +- .../serialize/ScriptableOutputStream.java | 3 +- .../typedarrays/NativeTypedArrayView.java | 2 +- .../org/mozilla/javascript/xml/XMLLib.java | 2 +- .../javascript/tests/Bug482203Test.java | 9 ++-- .../javascript/tests/IterableTest.java | 2 +- .../PrimitiveTypeScopeResolutionTest.java | 2 +- .../javascript/tests/WrapFactoryTest.java | 6 +-- 45 files changed, 164 insertions(+), 172 deletions(-) diff --git a/benchmarks/src/jmh/java/org/mozilla/javascript/benchmarks/MathBenchmark.java b/benchmarks/src/jmh/java/org/mozilla/javascript/benchmarks/MathBenchmark.java index 427e5a989..4c4cea652 100644 --- a/benchmarks/src/jmh/java/org/mozilla/javascript/benchmarks/MathBenchmark.java +++ b/benchmarks/src/jmh/java/org/mozilla/javascript/benchmarks/MathBenchmark.java @@ -7,7 +7,6 @@ import org.mozilla.javascript.Context; import org.mozilla.javascript.Function; import org.mozilla.javascript.ScriptRuntime; import org.mozilla.javascript.Scriptable; -import org.mozilla.javascript.ScriptableObject; import org.openjdk.jmh.annotations.*; @OutputTimeUnit(TimeUnit.NANOSECONDS) @@ -43,21 +42,21 @@ public class MathBenchmark { try (FileReader rdr = new FileReader("testsrc/benchmarks/micro/math-benchmarks.js")) { cx.evaluateReader(scope, rdr, "math-benchmarks.js", 1, null); } - addConstantInts = (Function) ScriptableObject.getProperty(scope, "addConstantInts"); - addIntAndConstant = (Function) ScriptableObject.getProperty(scope, "addIntAndConstant"); - addTwoInts = (Function) ScriptableObject.getProperty(scope, "addTwoInts"); - addConstantFloats = (Function) ScriptableObject.getProperty(scope, "addConstantFloats"); - addTwoFloats = (Function) ScriptableObject.getProperty(scope, "addTwoFloats"); - addStringsInLoop = (Function) ScriptableObject.getProperty(scope, "addStringsInLoop"); - addMixedStrings = (Function) ScriptableObject.getProperty(scope, "addMixedStrings"); - subtractInts = (Function) ScriptableObject.getProperty(scope, "subtractInts"); - subtractFloats = (Function) ScriptableObject.getProperty(scope, "subtractFloats"); - subtractTwoFloats = (Function) ScriptableObject.getProperty(scope, "subtractTwoFloats"); - bitwiseAnd = (Function) ScriptableObject.getProperty(scope, "bitwiseAnd"); - bitwiseOr = (Function) ScriptableObject.getProperty(scope, "bitwiseOr"); - bitwiseLsh = (Function) ScriptableObject.getProperty(scope, "bitwiseLsh"); - bitwiseRsh = (Function) ScriptableObject.getProperty(scope, "bitwiseRsh"); - bitwiseSignedRsh = (Function) ScriptableObject.getProperty(scope, "bitwiseSignedRsh"); + addConstantInts = (Function) Scriptable.getProperty(scope, "addConstantInts"); + addIntAndConstant = (Function) Scriptable.getProperty(scope, "addIntAndConstant"); + addTwoInts = (Function) Scriptable.getProperty(scope, "addTwoInts"); + addConstantFloats = (Function) Scriptable.getProperty(scope, "addConstantFloats"); + addTwoFloats = (Function) Scriptable.getProperty(scope, "addTwoFloats"); + addStringsInLoop = (Function) Scriptable.getProperty(scope, "addStringsInLoop"); + addMixedStrings = (Function) Scriptable.getProperty(scope, "addMixedStrings"); + subtractInts = (Function) Scriptable.getProperty(scope, "subtractInts"); + subtractFloats = (Function) Scriptable.getProperty(scope, "subtractFloats"); + subtractTwoFloats = (Function) Scriptable.getProperty(scope, "subtractTwoFloats"); + bitwiseAnd = (Function) Scriptable.getProperty(scope, "bitwiseAnd"); + bitwiseOr = (Function) Scriptable.getProperty(scope, "bitwiseOr"); + bitwiseLsh = (Function) Scriptable.getProperty(scope, "bitwiseLsh"); + bitwiseRsh = (Function) Scriptable.getProperty(scope, "bitwiseRsh"); + bitwiseSignedRsh = (Function) Scriptable.getProperty(scope, "bitwiseSignedRsh"); } @TearDown(Level.Trial) diff --git a/benchmarks/src/jmh/java/org/mozilla/javascript/benchmarks/ObjectBenchmark.java b/benchmarks/src/jmh/java/org/mozilla/javascript/benchmarks/ObjectBenchmark.java index 53ed05195..3da182d91 100644 --- a/benchmarks/src/jmh/java/org/mozilla/javascript/benchmarks/ObjectBenchmark.java +++ b/benchmarks/src/jmh/java/org/mozilla/javascript/benchmarks/ObjectBenchmark.java @@ -7,7 +7,6 @@ import java.util.concurrent.TimeUnit; import org.mozilla.javascript.Context; import org.mozilla.javascript.Function; import org.mozilla.javascript.Scriptable; -import org.mozilla.javascript.ScriptableObject; import org.mozilla.javascript.tools.shell.Global; import org.openjdk.jmh.annotations.*; @@ -72,7 +71,7 @@ public class ObjectBenchmark { @OperationsPerInvocation(1000) @SuppressWarnings("unused") public void createFields(FieldTestState state) { - Function create = (Function) ScriptableObject.getProperty(state.scope, "createObject"); + Function create = (Function) Scriptable.getProperty(state.scope, "createObject"); create.call(state.cx, state.scope, null, new Object[] {count, state.strings, state.ints}); } @@ -80,11 +79,11 @@ public class ObjectBenchmark { @OperationsPerInvocation(1000) @SuppressWarnings("unused") public void accessFields(FieldTestState state) { - Function create = (Function) ScriptableObject.getProperty(state.scope, "createObject"); + Function create = (Function) Scriptable.getProperty(state.scope, "createObject"); Object o = create.call( state.cx, state.scope, null, new Object[] {1, state.strings, state.ints}); - Function access = (Function) ScriptableObject.getProperty(state.scope, "accessObject"); + Function access = (Function) Scriptable.getProperty(state.scope, "accessObject"); access.call( state.cx, state.scope, null, new Object[] {count, o, state.strings, state.ints}); } @@ -93,11 +92,11 @@ public class ObjectBenchmark { @OperationsPerInvocation(1000) @SuppressWarnings("unused") public void iterateFields(FieldTestState state) { - Function create = (Function) ScriptableObject.getProperty(state.scope, "createObject"); + Function create = (Function) Scriptable.getProperty(state.scope, "createObject"); Object o = create.call( state.cx, state.scope, null, new Object[] {1, state.strings, state.ints}); - Function iterate = (Function) ScriptableObject.getProperty(state.scope, "iterateObject"); + Function iterate = (Function) Scriptable.getProperty(state.scope, "iterateObject"); iterate.call(state.cx, state.scope, null, new Object[] {count, o}); } @@ -105,12 +104,11 @@ public class ObjectBenchmark { @OperationsPerInvocation(1000) @SuppressWarnings("unused") public void ownKeysFields(FieldTestState state) { - Function create = (Function) ScriptableObject.getProperty(state.scope, "createObject"); + Function create = (Function) Scriptable.getProperty(state.scope, "createObject"); Object o = create.call( state.cx, state.scope, null, new Object[] {1, state.strings, state.ints}); - Function iterate = - (Function) ScriptableObject.getProperty(state.scope, "iterateOwnKeysObject"); + Function iterate = (Function) Scriptable.getProperty(state.scope, "iterateOwnKeysObject"); iterate.call(state.cx, state.scope, null, new Object[] {count, o}); } @@ -118,11 +116,11 @@ public class ObjectBenchmark { @OperationsPerInvocation(1000) @SuppressWarnings("unused") public void deleteFields(FieldTestState state) { - Function create = (Function) ScriptableObject.getProperty(state.scope, "createObject"); + Function create = (Function) Scriptable.getProperty(state.scope, "createObject"); Object o = create.call( state.cx, state.scope, null, new Object[] {1, state.strings, state.ints}); - Function delete = (Function) ScriptableObject.getProperty(state.scope, "deleteObject"); + Function delete = (Function) Scriptable.getProperty(state.scope, "deleteObject"); delete.call( state.cx, state.scope, null, new Object[] {count, o, state.strings, state.ints}); } diff --git a/benchmarks/src/jmh/java/org/mozilla/javascript/benchmarks/PropertyBenchmark.java b/benchmarks/src/jmh/java/org/mozilla/javascript/benchmarks/PropertyBenchmark.java index 329e39a15..9852b5287 100644 --- a/benchmarks/src/jmh/java/org/mozilla/javascript/benchmarks/PropertyBenchmark.java +++ b/benchmarks/src/jmh/java/org/mozilla/javascript/benchmarks/PropertyBenchmark.java @@ -7,7 +7,6 @@ import org.mozilla.javascript.Context; import org.mozilla.javascript.Function; import org.mozilla.javascript.ScriptRuntime; import org.mozilla.javascript.Scriptable; -import org.mozilla.javascript.ScriptableObject; import org.openjdk.jmh.annotations.*; @OutputTimeUnit(TimeUnit.NANOSECONDS) @@ -35,11 +34,11 @@ public class PropertyBenchmark { new FileReader("testsrc/benchmarks/micro/property-benchmarks.js")) { cx.evaluateReader(scope, rdr, "property-benchmarks.js", 1, null); } - create = (Function) ScriptableObject.getProperty(scope, "createObject"); + create = (Function) Scriptable.getProperty(scope, "createObject"); createFieldByField = - (Function) ScriptableObject.getProperty(scope, "createObjectFieldByField"); - getName = (Function) ScriptableObject.getProperty(scope, "getName"); - check = (Function) ScriptableObject.getProperty(scope, "check"); + (Function) Scriptable.getProperty(scope, "createObjectFieldByField"); + getName = (Function) Scriptable.getProperty(scope, "getName"); + check = (Function) Scriptable.getProperty(scope, "check"); object = create.call(cx, scope, null, new Object[] {"testing"}); } diff --git a/benchmarks/src/jmh/java/org/mozilla/javascript/benchmarks/V8Benchmark.java b/benchmarks/src/jmh/java/org/mozilla/javascript/benchmarks/V8Benchmark.java index 5b7f92a48..344455df5 100644 --- a/benchmarks/src/jmh/java/org/mozilla/javascript/benchmarks/V8Benchmark.java +++ b/benchmarks/src/jmh/java/org/mozilla/javascript/benchmarks/V8Benchmark.java @@ -6,7 +6,6 @@ import java.util.concurrent.TimeUnit; import org.mozilla.javascript.Callable; import org.mozilla.javascript.Context; import org.mozilla.javascript.Scriptable; -import org.mozilla.javascript.ScriptableObject; import org.openjdk.jmh.annotations.*; @OutputTimeUnit(TimeUnit.MICROSECONDS) @@ -18,7 +17,7 @@ public class V8Benchmark { Scriptable scope; Callable getFunc(String name) { - Object f = ScriptableObject.getProperty(scope, name); + Object f = Scriptable.getProperty(scope, name); if (!(f instanceof Callable)) { throw new RuntimeException("Benchmark function " + name + " not found"); } diff --git a/examples/src/main/java/Control.java b/examples/src/main/java/Control.java index 07bab0403..e5cea00e9 100644 --- a/examples/src/main/java/Control.java +++ b/examples/src/main/java/Control.java @@ -7,7 +7,6 @@ import org.mozilla.javascript.Context; import org.mozilla.javascript.Function; import org.mozilla.javascript.Scriptable; -import org.mozilla.javascript.ScriptableObject; /** * Example of controlling the JavaScript execution engine. @@ -57,7 +56,7 @@ public class Control { System.out.println("obj.b[1] == " + b.get(1, b)); // Should print {a:1, b:["x", "y"]} - Function fn = (Function) ScriptableObject.getProperty(obj, "toString"); + Function fn = (Function) Scriptable.getProperty(obj, "toString"); System.out.println(fn.call(cx, scope, obj, new Object[0])); } finally { Context.exit(); diff --git a/examples/src/main/java/CounterTest.java b/examples/src/main/java/CounterTest.java index c9e76f3c5..8731489c7 100644 --- a/examples/src/main/java/CounterTest.java +++ b/examples/src/main/java/CounterTest.java @@ -31,16 +31,16 @@ public class CounterTest { Scriptable testCounter = cx.newObject(scope, "Counter"); - Object count = ScriptableObject.getProperty(testCounter, "count"); + Object count = Scriptable.getProperty(testCounter, "count"); System.out.println("count = " + count); - count = ScriptableObject.getProperty(testCounter, "count"); + count = Scriptable.getProperty(testCounter, "count"); System.out.println("count = " + count); ScriptableObject.callMethod(testCounter, "resetCount", new Object[0]); System.out.println("resetCount"); - count = ScriptableObject.getProperty(testCounter, "count"); + count = Scriptable.getProperty(testCounter, "count"); System.out.println("count = " + count); } finally { Context.exit(); diff --git a/rhino-engine/src/main/java/org/mozilla/javascript/engine/RhinoScriptEngine.java b/rhino-engine/src/main/java/org/mozilla/javascript/engine/RhinoScriptEngine.java index d49dd44e9..184d6083f 100644 --- a/rhino-engine/src/main/java/org/mozilla/javascript/engine/RhinoScriptEngine.java +++ b/rhino-engine/src/main/java/org/mozilla/javascript/engine/RhinoScriptEngine.java @@ -188,7 +188,7 @@ public class RhinoScriptEngine extends AbstractScriptEngine implements Compilabl localThis = Context.toObject(thiz, scope); } - Object f = ScriptableObject.getProperty(localThis, name); + Object f = Scriptable.getProperty(localThis, name); if (f == Scriptable.NOT_FOUND) { throw new NoSuchMethodException(name); } @@ -306,7 +306,7 @@ public class RhinoScriptEngine extends AbstractScriptEngine implements Compilabl if (m.getDeclaringClass() == Object.class) { continue; } - Object methodObj = ScriptableObject.getProperty(scope, m.getName()); + Object methodObj = Scriptable.getProperty(scope, m.getName()); if (!(methodObj instanceof Callable)) { return true; } 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 7749dd13a..ec135f700 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 @@ -547,14 +547,14 @@ public class Dim { } else if (name.equals("__parent__")) { result = scriptable.getParentScope(); } else { - result = ScriptableObject.getProperty(scriptable, name); + result = Scriptable.getProperty(scriptable, name); if (result == ScriptableObject.NOT_FOUND) { result = Undefined.instance; } } } else { int index = ((Integer) id).intValue(); - result = ScriptableObject.getProperty(scriptable, index); + result = Scriptable.getProperty(scriptable, index); if (result == ScriptableObject.NOT_FOUND) { result = Undefined.instance; } diff --git a/rhino-tools/src/main/java/org/mozilla/javascript/tools/shell/Global.java b/rhino-tools/src/main/java/org/mozilla/javascript/tools/shell/Global.java index 4164d82f2..3c113da0e 100644 --- a/rhino-tools/src/main/java/org/mozilla/javascript/tools/shell/Global.java +++ b/rhino-tools/src/main/java/org/mozilla/javascript/tools/shell/Global.java @@ -363,16 +363,16 @@ public class Global extends ImporterTopLevel { public String[] getPrompts(Context cx) { if (ScriptableObject.hasProperty(this, "prompts")) { - Object promptsJS = ScriptableObject.getProperty(this, "prompts"); + Object promptsJS = Scriptable.getProperty(this, "prompts"); if (promptsJS instanceof Scriptable) { Scriptable s = (Scriptable) promptsJS; if (ScriptableObject.hasProperty(s, 0) && ScriptableObject.hasProperty(s, 1)) { - Object elem0 = ScriptableObject.getProperty(s, 0); + Object elem0 = Scriptable.getProperty(s, 0); if (elem0 instanceof Function) { elem0 = ((Function) elem0).call(cx, this, s, new Object[0]); } prompts[0] = Context.toString(elem0); - Object elem1 = ScriptableObject.getProperty(s, 1); + Object elem1 = Scriptable.getProperty(s, 1); if (elem1 instanceof Function) { elem1 = ((Function) elem1).call(cx, this, s, new Object[0]); } @@ -616,7 +616,7 @@ public class Global extends ImporterTopLevel { if (args[L - 1] instanceof Scriptable) { params = (Scriptable) args[L - 1]; --L; - Object envObj = ScriptableObject.getProperty(params, "env"); + Object envObj = Scriptable.getProperty(params, "env"); if (envObj != Scriptable.NOT_FOUND) { if (envObj == null) { environment = new String[0]; @@ -632,11 +632,11 @@ public class Global extends ImporterTopLevel { String key; if (keyObj instanceof String) { key = (String) keyObj; - val = ScriptableObject.getProperty(envHash, key); + val = Scriptable.getProperty(envHash, key); } else { int ikey = ((Number) keyObj).intValue(); key = Integer.toString(ikey); - val = ScriptableObject.getProperty(envHash, ikey); + val = Scriptable.getProperty(envHash, ikey); } if (val == ScriptableObject.NOT_FOUND) { val = Undefined.instance; @@ -645,16 +645,16 @@ public class Global extends ImporterTopLevel { } } } - Object wdObj = ScriptableObject.getProperty(params, "dir"); + Object wdObj = Scriptable.getProperty(params, "dir"); if (wdObj != Scriptable.NOT_FOUND) { wd = new File(ScriptRuntime.toString(wdObj)); } - Object inObj = ScriptableObject.getProperty(params, "input"); + Object inObj = Scriptable.getProperty(params, "input"); if (inObj != Scriptable.NOT_FOUND) { in = toInputStream(inObj); } - outObj = ScriptableObject.getProperty(params, "output"); + outObj = Scriptable.getProperty(params, "output"); if (outObj != Scriptable.NOT_FOUND) { out = toOutputStream(outObj); if (out == null) { @@ -662,7 +662,7 @@ public class Global extends ImporterTopLevel { out = outBytes; } } - errObj = ScriptableObject.getProperty(params, "err"); + errObj = Scriptable.getProperty(params, "err"); if (errObj != Scriptable.NOT_FOUND) { err = toOutputStream(errObj); if (err == null) { @@ -670,7 +670,7 @@ public class Global extends ImporterTopLevel { err = errBytes; } } - Object addArgsObj = ScriptableObject.getProperty(params, "args"); + Object addArgsObj = Scriptable.getProperty(params, "args"); if (addArgsObj != Scriptable.NOT_FOUND) { Scriptable s = Context.toObject(addArgsObj, getTopLevelScope(thisObj)); addArgs = cx.getElements(s); diff --git a/rhino-tools/src/main/java/org/mozilla/javascript/tools/shell/Main.java b/rhino-tools/src/main/java/org/mozilla/javascript/tools/shell/Main.java index 1393d17ef..c02ed4ab0 100644 --- a/rhino-tools/src/main/java/org/mozilla/javascript/tools/shell/Main.java +++ b/rhino-tools/src/main/java/org/mozilla/javascript/tools/shell/Main.java @@ -648,7 +648,7 @@ public class Main { Object result = unhandled.get(0); String msg = "Unhandled rejected promise: " + Context.toString(result); if (result instanceof Scriptable) { - Object stack = ScriptableObject.getProperty((Scriptable) result, "stack"); + Object stack = Scriptable.getProperty((Scriptable) result, "stack"); if (stack != null && stack != Scriptable.NOT_FOUND) { msg += '\n' + Context.toString(stack); } diff --git a/rhino-xml/src/main/java/org/mozilla/javascript/xmlimpl/XMLCtor.java b/rhino-xml/src/main/java/org/mozilla/javascript/xmlimpl/XMLCtor.java index a1e535988..1ed7a7eb4 100644 --- a/rhino-xml/src/main/java/org/mozilla/javascript/xmlimpl/XMLCtor.java +++ b/rhino-xml/src/main/java/org/mozilla/javascript/xmlimpl/XMLCtor.java @@ -43,7 +43,7 @@ class XMLCtor extends IdFunctionObject { for (int i = 1; i <= MAX_INSTANCE_ID; ++i) { int id = super.getMaxInstanceId() + i; String name = getInstanceIdName(id); - Object value = ScriptableObject.getProperty(source, name); + Object value = Scriptable.getProperty(source, name); if (value == Scriptable.NOT_FOUND) { continue; } diff --git a/rhino-xml/src/main/java/org/mozilla/javascript/xmlimpl/XMLList.java b/rhino-xml/src/main/java/org/mozilla/javascript/xmlimpl/XMLList.java index 0470a0cd6..c9fea3de3 100644 --- a/rhino-xml/src/main/java/org/mozilla/javascript/xmlimpl/XMLList.java +++ b/rhino-xml/src/main/java/org/mozilla/javascript/xmlimpl/XMLList.java @@ -12,7 +12,6 @@ import org.mozilla.javascript.Context; import org.mozilla.javascript.Function; import org.mozilla.javascript.ScriptRuntime; import org.mozilla.javascript.Scriptable; -import org.mozilla.javascript.ScriptableObject; import org.mozilla.javascript.Undefined; import org.mozilla.javascript.xml.XMLObject; @@ -772,7 +771,7 @@ class XMLList extends XMLObjectImpl implements Function { if (sobj != null) { thisObj = sobj; if (!(sobj instanceof XMLObject)) { - func = ScriptableObject.getProperty(sobj, methodName); + func = Scriptable.getProperty(sobj, methodName); } } } diff --git a/rhino/src/main/java/org/mozilla/javascript/AbstractEcmaObjectOperations.java b/rhino/src/main/java/org/mozilla/javascript/AbstractEcmaObjectOperations.java index 26633b642..e9d0e1b6a 100644 --- a/rhino/src/main/java/org/mozilla/javascript/AbstractEcmaObjectOperations.java +++ b/rhino/src/main/java/org/mozilla/javascript/AbstractEcmaObjectOperations.java @@ -189,7 +189,7 @@ public class AbstractEcmaObjectOperations { 7. If IsConstructor(S) is true, return S. 8. Throw a TypeError exception. */ - Object constructor = ScriptableObject.getProperty(s, "constructor"); + Object constructor = Scriptable.getProperty(s, "constructor"); if (constructor == Scriptable.NOT_FOUND || Undefined.isUndefined(constructor)) { return defaultConstructor; } @@ -197,7 +197,7 @@ public class AbstractEcmaObjectOperations { throw ScriptRuntime.typeErrorById( "msg.arg.not.object", ScriptRuntime.typeof(constructor)); } - Object species = ScriptableObject.getProperty((Scriptable) constructor, SymbolKey.SPECIES); + Object species = Scriptable.getProperty((Scriptable) constructor, SymbolKey.SPECIES); if (species == Scriptable.NOT_FOUND || species == null || Undefined.isUndefined(species)) { return defaultConstructor; } diff --git a/rhino/src/main/java/org/mozilla/javascript/Arguments.java b/rhino/src/main/java/org/mozilla/javascript/Arguments.java index 7674b6f18..de19365a4 100644 --- a/rhino/src/main/java/org/mozilla/javascript/Arguments.java +++ b/rhino/src/main/java/org/mozilla/javascript/Arguments.java @@ -372,12 +372,12 @@ final class Arguments extends IdScriptableObject { return; } - Object newValue = getProperty(desc, "value"); + Object newValue = Scriptable.getProperty(desc, "value"); if (newValue == NOT_FOUND) return; replaceArg(index, newValue); - if (isFalse(getProperty(desc, "writable"))) { + if (isFalse(Scriptable.getProperty(desc, "writable"))) { removeArg(index); } } diff --git a/rhino/src/main/java/org/mozilla/javascript/ArrayLikeAbstractOperations.java b/rhino/src/main/java/org/mozilla/javascript/ArrayLikeAbstractOperations.java index c35e29635..dd0e723d5 100644 --- a/rhino/src/main/java/org/mozilla/javascript/ArrayLikeAbstractOperations.java +++ b/rhino/src/main/java/org/mozilla/javascript/ArrayLikeAbstractOperations.java @@ -177,9 +177,9 @@ public class ArrayLikeAbstractOperations { // same as NativeArray::getElem, but without converting NOT_FOUND to undefined static Object getRawElem(Scriptable target, long index) { if (index > Integer.MAX_VALUE) { - return ScriptableObject.getProperty(target, Long.toString(index)); + return Scriptable.getProperty(target, Long.toString(index)); } - return ScriptableObject.getProperty(target, (int) index); + return Scriptable.getProperty(target, (int) index); } public static long toSliceIndex(double value, long length) { diff --git a/rhino/src/main/java/org/mozilla/javascript/BaseFunction.java b/rhino/src/main/java/org/mozilla/javascript/BaseFunction.java index c1faff15d..f7f77d041 100644 --- a/rhino/src/main/java/org/mozilla/javascript/BaseFunction.java +++ b/rhino/src/main/java/org/mozilla/javascript/BaseFunction.java @@ -47,7 +47,7 @@ public class BaseFunction extends IdScriptableObject implements Function { obj.exportAsJSClass(MAX_PROTOTYPE_ID, scope, sealed); // The "GeneratorFunction" name actually never appears in the global scope. // Return it here so it can be cached as a "builtin" - return ScriptableObject.getProperty(scope, GENERATOR_FUNCTION_CLASS); + return Scriptable.getProperty(scope, GENERATOR_FUNCTION_CLASS); } public BaseFunction() {} @@ -95,7 +95,7 @@ public class BaseFunction extends IdScriptableObject implements Function { */ @Override public boolean hasInstance(Scriptable instance) { - Object protoProp = ScriptableObject.getProperty(this, "prototype"); + Object protoProp = Scriptable.getProperty(this, "prototype"); if (protoProp instanceof Scriptable) { return ScriptRuntime.jsDelegatesTo(instance, (Scriptable) protoProp); } diff --git a/rhino/src/main/java/org/mozilla/javascript/ES6Generator.java b/rhino/src/main/java/org/mozilla/javascript/ES6Generator.java index e150937a8..45a5d18b8 100644 --- a/rhino/src/main/java/org/mozilla/javascript/ES6Generator.java +++ b/rhino/src/main/java/org/mozilla/javascript/ES6Generator.java @@ -141,9 +141,7 @@ public final class ES6Generator extends IdScriptableObject { delegee = null; // Return a result to the original generator return resumeLocal( - cx, - scope, - ScriptableObject.getProperty(nextResult, ES6Iterator.VALUE_PROPERTY)); + cx, scope, Scriptable.getProperty(nextResult, ES6Iterator.VALUE_PROPERTY)); } // Otherwise, we have a normal result and should continue return nextResult; diff --git a/rhino/src/main/java/org/mozilla/javascript/EqualObjectGraphs.java b/rhino/src/main/java/org/mozilla/javascript/EqualObjectGraphs.java index 559e592d8..4cfb82ba4 100644 --- a/rhino/src/main/java/org/mozilla/javascript/EqualObjectGraphs.java +++ b/rhino/src/main/java/org/mozilla/javascript/EqualObjectGraphs.java @@ -350,11 +350,11 @@ final class EqualObjectGraphs { private static Object getValue(final Scriptable s, final Object id) { if (id instanceof Symbol) { - return ScriptableObject.getProperty(s, (Symbol) id); + return Scriptable.getProperty(s, (Symbol) id); } else if (id instanceof Integer) { - return ScriptableObject.getProperty(s, (Integer) id); + return Scriptable.getProperty(s, (Integer) id); } else if (id instanceof String) { - return ScriptableObject.getProperty(s, (String) id); + return Scriptable.getProperty(s, (String) id); } else { throw new ClassCastException(); } diff --git a/rhino/src/main/java/org/mozilla/javascript/IdScriptableObject.java b/rhino/src/main/java/org/mozilla/javascript/IdScriptableObject.java index d61712381..335341a8d 100644 --- a/rhino/src/main/java/org/mozilla/javascript/IdScriptableObject.java +++ b/rhino/src/main/java/org/mozilla/javascript/IdScriptableObject.java @@ -866,7 +866,7 @@ public abstract class IdScriptableObject extends ScriptableObject implements IdF ScriptableObject current = getOwnPropertyDescriptor(cx, key); checkPropertyChange(name, current, desc); int attr = (info >>> 16); - Object value = getProperty(desc, "value"); + Object value = Scriptable.getProperty(desc, "value"); if (value != NOT_FOUND && ((attr & READONLY) == 0 || (attr & PERMANENT) == 0)) { Object currentValue = getInstanceIdValue(id); if (!sameValue(value, currentValue)) { @@ -888,7 +888,7 @@ public abstract class IdScriptableObject extends ScriptableObject implements IdF ScriptableObject current = getOwnPropertyDescriptor(cx, key); checkPropertyChange(name, current, desc); int attr = prototypeValues.getAttributes(id); - Object value = getProperty(desc, "value"); + Object value = Scriptable.getProperty(desc, "value"); if (value != NOT_FOUND && (attr & READONLY) == 0) { Object currentValue = prototypeValues.get(id); if (!sameValue(value, currentValue)) { diff --git a/rhino/src/main/java/org/mozilla/javascript/InterfaceAdapter.java b/rhino/src/main/java/org/mozilla/javascript/InterfaceAdapter.java index 513101920..e679e1b69 100644 --- a/rhino/src/main/java/org/mozilla/javascript/InterfaceAdapter.java +++ b/rhino/src/main/java/org/mozilla/javascript/InterfaceAdapter.java @@ -121,7 +121,7 @@ public class InterfaceAdapter { } else { Scriptable s = (Scriptable) target; String methodName = method.getName(); - Object value = ScriptableObject.getProperty(s, methodName); + Object value = Scriptable.getProperty(s, methodName); if (value == Scriptable.NOT_FOUND) { // We really should throw an error here, but for the sake of // compatibility with JavaAdapter we silently ignore undefined diff --git a/rhino/src/main/java/org/mozilla/javascript/IteratorLikeIterable.java b/rhino/src/main/java/org/mozilla/javascript/IteratorLikeIterable.java index ee38c1e89..7201a1ddf 100644 --- a/rhino/src/main/java/org/mozilla/javascript/IteratorLikeIterable.java +++ b/rhino/src/main/java/org/mozilla/javascript/IteratorLikeIterable.java @@ -74,7 +74,7 @@ public class IteratorLikeIterable implements Iterable, Closeable { // This will throw if "val" is not an object. // "getObjectPropNoWarn" won't, so do this as follows. Object doneval = - ScriptableObject.getProperty( + Scriptable.getProperty( ScriptableObject.ensureScriptable(val), ES6Iterator.DONE_PROPERTY); if (doneval == Scriptable.NOT_FOUND) { doneval = Undefined.instance; diff --git a/rhino/src/main/java/org/mozilla/javascript/JavaAdapter.java b/rhino/src/main/java/org/mozilla/javascript/JavaAdapter.java index c2ca06e70..1c49aa2cf 100644 --- a/rhino/src/main/java/org/mozilla/javascript/JavaAdapter.java +++ b/rhino/src/main/java/org/mozilla/javascript/JavaAdapter.java @@ -285,10 +285,10 @@ public final class JavaAdapter implements IdFunctionCall { for (int i = 0; i != ids.length; ++i) { if (!(ids[i] instanceof String)) continue; String id = (String) ids[i]; - Object value = ScriptableObject.getProperty(obj, id); + Object value = Scriptable.getProperty(obj, id); if (value instanceof Function) { Function f = (Function) value; - int length = ScriptRuntime.toInt32(ScriptableObject.getProperty(f, "length")); + int length = ScriptRuntime.toInt32(Scriptable.getProperty(f, "length")); if (length < 0) { length = 0; } @@ -508,7 +508,7 @@ public final class JavaAdapter implements IdFunctionCall { } public static Function getFunction(Scriptable obj, String functionName) { - Object x = ScriptableObject.getProperty(obj, functionName); + Object x = Scriptable.getProperty(obj, functionName); if (x == Scriptable.NOT_FOUND) { // This method used to swallow the exception from calling // an undefined method. People have come to depend on this diff --git a/rhino/src/main/java/org/mozilla/javascript/NativeArray.java b/rhino/src/main/java/org/mozilla/javascript/NativeArray.java index d0276715d..d8b00c26d 100644 --- a/rhino/src/main/java/org/mozilla/javascript/NativeArray.java +++ b/rhino/src/main/java/org/mozilla/javascript/NativeArray.java @@ -947,7 +947,7 @@ public class NativeArray extends IdScriptableObject implements List { } } - Object iteratorProp = ScriptableObject.getProperty(items, SymbolKey.ITERATOR); + Object iteratorProp = Scriptable.getProperty(items, SymbolKey.ITERATOR); if (!(items instanceof NativeArray) && (iteratorProp != Scriptable.NOT_FOUND) && !Undefined.isUndefined(iteratorProp)) { @@ -1114,7 +1114,7 @@ public class NativeArray extends IdScriptableObject implements List { return ((Number) lengthFunc.call(cx, obj, obj, ScriptRuntime.emptyArgs)).longValue(); } - Object len = ScriptableObject.getProperty(obj, "length"); + Object len = Scriptable.getProperty(obj, "length"); if (len == Scriptable.NOT_FOUND) { // toUint32(undefined) == 0 return 0; @@ -1706,7 +1706,7 @@ public class NativeArray extends IdScriptableObject implements List { // First, look for the new @@isConcatSpreadable test as per ECMAScript 6 and up if (val instanceof Scriptable) { final Object spreadable = - ScriptableObject.getProperty((Scriptable) val, SymbolKey.IS_CONCAT_SPREADABLE); + Scriptable.getProperty((Scriptable) val, SymbolKey.IS_CONCAT_SPREADABLE); if ((spreadable != Scriptable.NOT_FOUND) && !Undefined.isUndefined(spreadable)) { // If @@isConcatSpreadable was undefined, we have to fall back to testing for an // array. @@ -1871,7 +1871,7 @@ public class NativeArray extends IdScriptableObject implements List { for (int i = (int) start; i < length; i++) { Object val = na.dense[i]; if (val == NOT_FOUND && proto != null) { - val = ScriptableObject.getProperty(proto, i); + val = Scriptable.getProperty(proto, i); } if (val != NOT_FOUND && ScriptRuntime.shallowEq(val, compareTo)) { return Long.valueOf(i); @@ -1923,7 +1923,7 @@ public class NativeArray extends IdScriptableObject implements List { for (int i = (int) start; i >= 0; i--) { Object val = na.dense[i]; if (val == NOT_FOUND && proto != null) { - val = ScriptableObject.getProperty(proto, i); + val = Scriptable.getProperty(proto, i); } if (val != NOT_FOUND && ScriptRuntime.shallowEq(val, compareTo)) { return Long.valueOf(i); @@ -1949,7 +1949,8 @@ public class NativeArray extends IdScriptableObject implements List { Object compareTo = args.length > 0 ? args[0] : Undefined.instance; Scriptable o = ScriptRuntime.toObject(cx, scope, thisObj); - long len = ScriptRuntime.toLength(new Object[] {getProperty(thisObj, "length")}, 0); + long len = + ScriptRuntime.toLength(new Object[] {Scriptable.getProperty(thisObj, "length")}, 0); if (len == 0) return Boolean.FALSE; long k; @@ -1970,7 +1971,7 @@ public class NativeArray extends IdScriptableObject implements List { for (int i = (int) k; i < len; i++) { Object elementK = na.dense[i]; if (elementK == NOT_FOUND && proto != null) { - elementK = ScriptableObject.getProperty(proto, i); + elementK = Scriptable.getProperty(proto, i); } if (elementK == NOT_FOUND) { elementK = Undefined.instance; diff --git a/rhino/src/main/java/org/mozilla/javascript/NativeDate.java b/rhino/src/main/java/org/mozilla/javascript/NativeDate.java index dc7601510..65afb29bb 100644 --- a/rhino/src/main/java/org/mozilla/javascript/NativeDate.java +++ b/rhino/src/main/java/org/mozilla/javascript/NativeDate.java @@ -300,7 +300,7 @@ final class NativeDate extends IdScriptableObject { return null; } } - Object toISO = ScriptableObject.getProperty(o, toISOString); + Object toISO = Scriptable.getProperty(o, toISOString); if (toISO == NOT_FOUND) { throw ScriptRuntime.typeErrorById( "msg.function.not.found.in", diff --git a/rhino/src/main/java/org/mozilla/javascript/NativeError.java b/rhino/src/main/java/org/mozilla/javascript/NativeError.java index d0e19e109..34cdc1e81 100644 --- a/rhino/src/main/java/org/mozilla/javascript/NativeError.java +++ b/rhino/src/main/java/org/mozilla/javascript/NativeError.java @@ -117,7 +117,7 @@ final class NativeError extends IdScriptableObject { } static void installCause(NativeObject options, NativeError obj) { - Object cause = ScriptableObject.getProperty(options, "cause"); + Object cause = Scriptable.getProperty(options, "cause"); if (cause != NOT_FOUND) { ScriptableObject.putProperty(obj, "cause", cause); obj.setAttributes("cause", DONTENUM); @@ -290,14 +290,14 @@ final class NativeError extends IdScriptableObject { } private static Object js_toString(Scriptable thisObj) { - Object nameObj = ScriptableObject.getProperty(thisObj, "name"); + Object nameObj = Scriptable.getProperty(thisObj, "name"); String name; if (nameObj == NOT_FOUND || Undefined.isUndefined(nameObj)) { name = "Error"; } else { name = ScriptRuntime.toString(nameObj); } - Object msgObj = ScriptableObject.getProperty(thisObj, "message"); + Object msgObj = Scriptable.getProperty(thisObj, "message"); String msg; if (msgObj == NOT_FOUND || Undefined.isUndefined(msgObj)) { msg = ""; @@ -315,10 +315,10 @@ final class NativeError extends IdScriptableObject { private static String js_toSource(Context cx, Scriptable scope, Scriptable thisObj) { // Emulation of SpiderMonkey behavior - Object name = ScriptableObject.getProperty(thisObj, "name"); - Object message = ScriptableObject.getProperty(thisObj, "message"); - Object fileName = ScriptableObject.getProperty(thisObj, "fileName"); - Object lineNumber = ScriptableObject.getProperty(thisObj, "lineNumber"); + Object name = Scriptable.getProperty(thisObj, "name"); + Object message = Scriptable.getProperty(thisObj, "message"); + Object fileName = Scriptable.getProperty(thisObj, "fileName"); + Object lineNumber = Scriptable.getProperty(thisObj, "lineNumber"); StringBuilder sb = new StringBuilder(); sb.append("(new "); diff --git a/rhino/src/main/java/org/mozilla/javascript/NativeGlobal.java b/rhino/src/main/java/org/mozilla/javascript/NativeGlobal.java index b67256918..deb69f958 100644 --- a/rhino/src/main/java/org/mozilla/javascript/NativeGlobal.java +++ b/rhino/src/main/java/org/mozilla/javascript/NativeGlobal.java @@ -96,10 +96,9 @@ public class NativeGlobal implements Serializable, IdFunctionCall { with the 'name' property set to the name of the error. */ Scriptable nativeError = - ScriptableObject.ensureScriptable(ScriptableObject.getProperty(scope, "Error")); + ScriptableObject.ensureScriptable(Scriptable.getProperty(scope, "Error")); Scriptable nativeErrorProto = - ScriptableObject.ensureScriptable( - ScriptableObject.getProperty(nativeError, "prototype")); + ScriptableObject.ensureScriptable(Scriptable.getProperty(nativeError, "prototype")); for (TopLevel.NativeErrors error : TopLevel.NativeErrors.values()) { if (error == TopLevel.NativeErrors.Error) { diff --git a/rhino/src/main/java/org/mozilla/javascript/NativeJSON.java b/rhino/src/main/java/org/mozilla/javascript/NativeJSON.java index 1711c33e6..6ced55c60 100644 --- a/rhino/src/main/java/org/mozilla/javascript/NativeJSON.java +++ b/rhino/src/main/java/org/mozilla/javascript/NativeJSON.java @@ -255,14 +255,14 @@ public final class NativeJSON extends ScriptableObject { int keyInt = 0; if (key instanceof String) { keyString = (String) key; - value = getProperty(holder, keyString); + value = Scriptable.getProperty(holder, keyString); } else { keyInt = ((Number) key).intValue(); - value = getProperty(holder, keyInt); + value = Scriptable.getProperty(holder, keyInt); } if (value instanceof Scriptable && hasProperty((Scriptable) value, "toJSON")) { - Object toJSON = getProperty((Scriptable) value, "toJSON"); + Object toJSON = Scriptable.getProperty((Scriptable) value, "toJSON"); if (toJSON instanceof Callable) { value = callMethod( @@ -276,7 +276,7 @@ public final class NativeJSON extends ScriptableObject { } else if (value instanceof BigInteger) { Scriptable bigInt = ScriptRuntime.toObject(state.cx, state.scope, value); if (hasProperty(bigInt, "toJSON")) { - Object toJSON = getProperty(bigInt, "toJSON"); + Object toJSON = Scriptable.getProperty(bigInt, "toJSON"); if (toJSON instanceof Callable) { value = callMethod( diff --git a/rhino/src/main/java/org/mozilla/javascript/NativeJavaObject.java b/rhino/src/main/java/org/mozilla/javascript/NativeJavaObject.java index 033737b68..df91ec2a4 100644 --- a/rhino/src/main/java/org/mozilla/javascript/NativeJavaObject.java +++ b/rhino/src/main/java/org/mozilla/javascript/NativeJavaObject.java @@ -31,7 +31,7 @@ import java.util.Objects; * @see NativeJavaPackage * @see NativeJavaClass */ -public class NativeJavaObject implements Scriptable, SymbolScriptable, Wrapper, Serializable { +public class NativeJavaObject implements SymbolScriptable, Wrapper, Serializable { private static final long serialVersionUID = -6948590651130498591L; diff --git a/rhino/src/main/java/org/mozilla/javascript/NativeObject.java b/rhino/src/main/java/org/mozilla/javascript/NativeObject.java index ce316bbe2..f24db5e81 100644 --- a/rhino/src/main/java/org/mozilla/javascript/NativeObject.java +++ b/rhino/src/main/java/org/mozilla/javascript/NativeObject.java @@ -174,7 +174,7 @@ public class NativeObject extends IdScriptableObject implements Map { if (thisObj == null) { throw ScriptRuntime.notFunctionError(null); } - Object toString = ScriptableObject.getProperty(thisObj, "toString"); + Object toString = Scriptable.getProperty(thisObj, "toString"); if (!(toString instanceof Callable)) { throw ScriptRuntime.notFunctionError(toString); } diff --git a/rhino/src/main/java/org/mozilla/javascript/NativePromise.java b/rhino/src/main/java/org/mozilla/javascript/NativePromise.java index 0e1208e2a..ac09bafd4 100644 --- a/rhino/src/main/java/org/mozilla/javascript/NativePromise.java +++ b/rhino/src/main/java/org/mozilla/javascript/NativePromise.java @@ -616,7 +616,7 @@ public class NativePromise extends ScriptableObject { } Scriptable sresolution = ScriptableObject.ensureScriptable(resolution); - Object thenObj = ScriptableObject.getProperty(sresolution, "then"); + Object thenObj = Scriptable.getProperty(sresolution, "then"); if (!(thenObj instanceof Callable)) { return promise.fulfillPromise(cx, scope, resolution); } diff --git a/rhino/src/main/java/org/mozilla/javascript/NativeString.java b/rhino/src/main/java/org/mozilla/javascript/NativeString.java index 75288c137..94dd9a3b8 100644 --- a/rhino/src/main/java/org/mozilla/javascript/NativeString.java +++ b/rhino/src/main/java/org/mozilla/javascript/NativeString.java @@ -474,7 +474,7 @@ final class NativeString extends IdScriptableObject { Scriptable arg0 = (Scriptable) args[0]; if (reProxy.isRegExp(arg0)) { if (ScriptableObject.isTrue( - ScriptableObject.getProperty(arg0, SymbolKey.MATCH))) { + Scriptable.getProperty(arg0, SymbolKey.MATCH))) { throw ScriptRuntime.typeErrorById( "msg.first.arg.not.regexp", String.class.getSimpleName(), diff --git a/rhino/src/main/java/org/mozilla/javascript/NativeWith.java b/rhino/src/main/java/org/mozilla/javascript/NativeWith.java index aa6734206..3b924fd26 100644 --- a/rhino/src/main/java/org/mozilla/javascript/NativeWith.java +++ b/rhino/src/main/java/org/mozilla/javascript/NativeWith.java @@ -12,7 +12,7 @@ import java.io.Serializable; * This class implements the object lookup required for the with statement. It simply * delegates every action to its prototype except for operations on its parent. */ -public class NativeWith implements Scriptable, SymbolScriptable, IdFunctionCall, Serializable { +public class NativeWith implements SymbolScriptable, IdFunctionCall, Serializable { private static final long serialVersionUID = 1L; static void init(Scriptable scope, boolean sealed) { diff --git a/rhino/src/main/java/org/mozilla/javascript/ScriptRuntime.java b/rhino/src/main/java/org/mozilla/javascript/ScriptRuntime.java index 337f7e0bb..5ca9af749 100644 --- a/rhino/src/main/java/org/mozilla/javascript/ScriptRuntime.java +++ b/rhino/src/main/java/org/mozilla/javascript/ScriptRuntime.java @@ -1125,7 +1125,7 @@ public class ScriptRuntime { // Wrapped Java objects won't have "toSource" and will report // errors for get()s of nonexistent name, so use has() first if (ScriptableObject.hasProperty(obj, "toSource")) { - Object v = ScriptableObject.getProperty(obj, "toSource"); + Object v = Scriptable.getProperty(obj, "toSource"); if (v instanceof Function) { Function f = (Function) v; return toString(f.call(cx, scope, obj, emptyArgs)); @@ -1471,7 +1471,7 @@ public class ScriptRuntime { for (; ; ) { Scriptable parent = scope.getParentScope(); if (parent == null) { - nsObject = ScriptableObject.getProperty(scope, DEFAULT_NS_TAG); + nsObject = Scriptable.getProperty(scope, DEFAULT_NS_TAG); if (nsObject == Scriptable.NOT_FOUND) { return null; } @@ -1488,11 +1488,11 @@ public class ScriptRuntime { public static Object getTopLevelProp(Scriptable scope, String id) { scope = ScriptableObject.getTopLevelScope(scope); - return ScriptableObject.getProperty(scope, id); + return Scriptable.getProperty(scope, id); } public static Function getExistingCtor(Context cx, Scriptable scope, String constructorName) { - Object ctorVal = ScriptableObject.getProperty(scope, constructorName); + Object ctorVal = Scriptable.getProperty(scope, constructorName); if (ctorVal instanceof Function) { return (Function) ctorVal; } @@ -1698,14 +1698,14 @@ public class ScriptRuntime { if (obj instanceof XMLObject) { result = ((XMLObject) obj).get(cx, elem); } else if (isSymbol(elem)) { - result = ScriptableObject.getProperty(obj, (Symbol) elem); + result = Scriptable.getProperty(obj, (Symbol) elem); } else { StringIdOrIndex s = toStringIdOrIndex(elem); if (s.stringId == null) { int index = s.index; - result = ScriptableObject.getProperty(obj, index); + result = Scriptable.getProperty(obj, index); } else { - result = ScriptableObject.getProperty(obj, s.stringId); + result = Scriptable.getProperty(obj, s.stringId); } } @@ -1741,7 +1741,7 @@ public class ScriptRuntime { public static Object getObjectProp(Scriptable obj, String property, Context cx) { - Object result = ScriptableObject.getProperty(obj, property); + Object result = Scriptable.getProperty(obj, property); if (result == Scriptable.NOT_FOUND) { if (cx.hasFeature(Context.FEATURE_STRICT_MODE)) { Context.reportWarning( @@ -1765,7 +1765,7 @@ public class ScriptRuntime { if (sobj == null) { throw undefReadError(obj, property); } - Object result = ScriptableObject.getProperty(sobj, property); + Object result = Scriptable.getProperty(sobj, property); if (result == Scriptable.NOT_FOUND) { return Undefined.instance; } @@ -1798,7 +1798,7 @@ public class ScriptRuntime { } public static Object getObjectIndex(Scriptable obj, int index, Context cx) { - Object result = ScriptableObject.getProperty(obj, index); + Object result = Scriptable.getProperty(obj, index); if (result == Scriptable.NOT_FOUND) { result = Undefined.instance; } @@ -2054,7 +2054,7 @@ public class ScriptRuntime { firstXMLObject = xmlObj; } } else { - result = ScriptableObject.getProperty(withObj, name); + result = Scriptable.getProperty(withObj, name); if (result != Scriptable.NOT_FOUND) { // function this should be the target object of with thisObj = withObj; @@ -2076,7 +2076,7 @@ public class ScriptRuntime { } else { // Can happen if Rhino embedding decided that nested // scopes are useful for what ever reasons. - result = ScriptableObject.getProperty(scope, name); + result = Scriptable.getProperty(scope, name); if (result != Scriptable.NOT_FOUND) { thisObj = scope; break; @@ -2116,7 +2116,7 @@ public class ScriptRuntime { if (cx.useDynamicScope) { scope = checkDynamicScope(cx.topCallScope, scope); } - return ScriptableObject.getProperty(scope, name); + return Scriptable.getProperty(scope, name); } /** @@ -2263,7 +2263,7 @@ public class ScriptRuntime { public static Scriptable toIterator( Context cx, Scriptable scope, Scriptable obj, boolean keyOnly) { if (ScriptableObject.hasProperty(obj, NativeIterator.ITERATOR_PROPERTY_NAME)) { - Object v = ScriptableObject.getProperty(obj, NativeIterator.ITERATOR_PROPERTY_NAME); + Object v = Scriptable.getProperty(obj, NativeIterator.ITERATOR_PROPERTY_NAME); if (!(v instanceof Callable)) { throw typeErrorById("msg.invalid.iterator"); } @@ -2343,7 +2343,7 @@ public class ScriptRuntime { throw typeErrorById("msg.not.iterable", toString(x.obj)); } - Object iterator = ScriptableObject.getProperty(x.obj, SymbolKey.ITERATOR); + Object iterator = Scriptable.getProperty(x.obj, SymbolKey.ITERATOR); if (!(iterator instanceof Callable)) { throw typeErrorById("msg.not.iterable", toString(x.obj)); } @@ -2374,7 +2374,7 @@ public class ScriptRuntime { if (x.enumType == ENUMERATE_VALUES_IN_ORDER) { return enumNextInOrder(x, cx); } - Object v = ScriptableObject.getProperty(x.iterator, "next"); + Object v = Scriptable.getProperty(x.iterator, "next"); if (!(v instanceof Callable)) return Boolean.FALSE; Callable f = (Callable) v; try { @@ -2416,7 +2416,7 @@ public class ScriptRuntime { } private static Boolean enumNextInOrder(IdEnumeration enumObj, Context cx) { - Object v = ScriptableObject.getProperty(enumObj.iterator, ES6Iterator.NEXT_METHOD); + Object v = Scriptable.getProperty(enumObj.iterator, ES6Iterator.NEXT_METHOD); if (!(v instanceof Callable)) { throw notFunctionError(enumObj.iterator, ES6Iterator.NEXT_METHOD); } @@ -2424,12 +2424,11 @@ public class ScriptRuntime { Scriptable scope = enumObj.iterator.getParentScope(); Object r = f.call(cx, scope, enumObj.iterator, emptyArgs); Scriptable iteratorResult = toObject(cx, scope, r); - Object done = ScriptableObject.getProperty(iteratorResult, ES6Iterator.DONE_PROPERTY); + Object done = Scriptable.getProperty(iteratorResult, ES6Iterator.DONE_PROPERTY); if (done != Scriptable.NOT_FOUND && toBoolean(done)) { return Boolean.FALSE; } - enumObj.currentId = - ScriptableObject.getProperty(iteratorResult, ES6Iterator.VALUE_PROPERTY); + enumObj.currentId = Scriptable.getProperty(iteratorResult, ES6Iterator.VALUE_PROPERTY); return Boolean.TRUE; } @@ -2593,7 +2592,7 @@ public class ScriptRuntime { if (thisObj == null) { throw undefCallError(obj, String.valueOf(elem)); } - value = ScriptableObject.getProperty(thisObj, (Symbol) elem); + value = Scriptable.getProperty(thisObj, (Symbol) elem); } else { StringIdOrIndex s = toStringIdOrIndex(elem); @@ -2606,7 +2605,7 @@ public class ScriptRuntime { throw undefCallError(obj, String.valueOf(elem)); } - value = ScriptableObject.getProperty(thisObj, s.index); + value = Scriptable.getProperty(thisObj, s.index); } if (!(value instanceof Callable)) { @@ -2649,9 +2648,9 @@ public class ScriptRuntime { throw undefCallError(obj, property); } - Object value = ScriptableObject.getProperty(thisObj, property); + Object value = Scriptable.getProperty(thisObj, property); if (!(value instanceof Callable)) { - Object noSuchMethod = ScriptableObject.getProperty(thisObj, "__noSuchMethod__"); + Object noSuchMethod = Scriptable.getProperty(thisObj, "__noSuchMethod__"); if (noSuchMethod instanceof Callable) value = new NoSuchMethodShim((Callable) noSuchMethod, property); } @@ -4640,7 +4639,7 @@ public class ScriptRuntime { } Object[] result = new Object[len]; for (int i = 0; i < len; i++) { - Object elem = ScriptableObject.getProperty(object, i); + Object elem = Scriptable.getProperty(object, i); result[i] = (elem == Scriptable.NOT_FOUND) ? Undefined.instance : elem; } return result; diff --git a/rhino/src/main/java/org/mozilla/javascript/Scriptable.java b/rhino/src/main/java/org/mozilla/javascript/Scriptable.java index 686684198..9c33c6493 100644 --- a/rhino/src/main/java/org/mozilla/javascript/Scriptable.java +++ b/rhino/src/main/java/org/mozilla/javascript/Scriptable.java @@ -106,7 +106,7 @@ public interface Scriptable { * @param start the object in which the lookup began * @return true if and only if the named property is found in the object * @see org.mozilla.javascript.Scriptable#get(String, Scriptable) - * @see org.mozilla.javascript.ScriptableObject#getProperty(Scriptable, String) + * @see org.mozilla.javascript.Scriptable#getProperty(Scriptable, String) */ boolean has(String name, Scriptable start); @@ -123,7 +123,7 @@ public interface Scriptable { * @param start the object in which the lookup began * @return true if and only if the indexed property is found in the object * @see org.mozilla.javascript.Scriptable#get(int, Scriptable) - * @see org.mozilla.javascript.ScriptableObject#getProperty(Scriptable, int) + * @see org.mozilla.javascript.Scriptable#getProperty(Scriptable, int) */ boolean has(int index, Scriptable start); diff --git a/rhino/src/main/java/org/mozilla/javascript/ScriptableObject.java b/rhino/src/main/java/org/mozilla/javascript/ScriptableObject.java index e9b89d250..1a748948a 100644 --- a/rhino/src/main/java/org/mozilla/javascript/ScriptableObject.java +++ b/rhino/src/main/java/org/mozilla/javascript/ScriptableObject.java @@ -52,7 +52,7 @@ import org.mozilla.javascript.debug.DebuggableObject; * @author Norris Boyd */ public abstract class ScriptableObject - implements Scriptable, SymbolScriptable, Serializable, DebuggableObject, ConstProperties { + implements SymbolScriptable, Serializable, DebuggableObject, ConstProperties { private static final long serialVersionUID = 2829861078851942586L; @@ -789,7 +789,7 @@ public abstract class ScriptableObject } else { methodName = "valueOf"; } - Object v = getProperty(object, methodName); + Object v = Scriptable.getProperty(object, methodName); if (!(v instanceof Function)) continue; Function fun = (Function) v; if (cx == null) { @@ -1056,7 +1056,7 @@ public abstract class ScriptableObject String className = proto.getClassName(); // check for possible redefinition - Object existing = getProperty(getTopLevelScope(scope), className); + Object existing = Scriptable.getProperty(getTopLevelScope(scope), className); if (existing instanceof BaseFunction) { Object existingProto = ((BaseFunction) existing).getPrototypeProperty(); if (existingProto != null && clazz.equals(existingProto.getClass())) { @@ -1640,11 +1640,11 @@ public abstract class ScriptableObject fslot = new AccessorSlot(slot); slot = fslot; } - Object getter = getProperty(desc, "get"); + Object getter = Scriptable.getProperty(desc, "get"); if (getter != NOT_FOUND) { fslot.getter = new AccessorSlot.FunctionGetter(getter); } - Object setter = getProperty(desc, "set"); + Object setter = Scriptable.getProperty(desc, "set"); if (setter != NOT_FOUND) { fslot.setter = new AccessorSlot.FunctionSetter(setter); } @@ -1654,7 +1654,7 @@ public abstract class ScriptableObject // Replace a non-base slot with a regular slot slot = new Slot(slot); } - Object value = getProperty(desc, "value"); + Object value = Scriptable.getProperty(desc, "value"); if (value != NOT_FOUND) { slot.value = value; } else if (existing == null) { @@ -1749,11 +1749,11 @@ public abstract class ScriptableObject } protected void checkPropertyDefinition(ScriptableObject desc) { - Object getter = getProperty(desc, "get"); + Object getter = Scriptable.getProperty(desc, "get"); if (getter != NOT_FOUND && getter != Undefined.instance && !(getter instanceof Callable)) { throw ScriptRuntime.notFunctionError(getter); } - Object setter = getProperty(desc, "set"); + Object setter = Scriptable.getProperty(desc, "set"); if (setter != NOT_FOUND && setter != Undefined.instance && !(setter instanceof Callable)) { throw ScriptRuntime.notFunctionError(setter); } @@ -1767,10 +1767,10 @@ public abstract class ScriptableObject if (!isExtensible()) throw ScriptRuntime.typeErrorById("msg.not.extensible"); } else { if (isFalse(current.get("configurable", current))) { - if (isTrue(getProperty(desc, "configurable"))) + if (isTrue(Scriptable.getProperty(desc, "configurable"))) throw ScriptRuntime.typeErrorById("msg.change.configurable.false.to.true", id); if (isTrue(current.get("enumerable", current)) - != isTrue(getProperty(desc, "enumerable"))) + != isTrue(Scriptable.getProperty(desc, "enumerable"))) throw ScriptRuntime.typeErrorById( "msg.change.enumerable.with.configurable.false", id); boolean isData = isDataDescriptor(desc); @@ -1779,21 +1779,25 @@ public abstract class ScriptableObject // no further validation required for generic descriptor } else if (isData && isDataDescriptor(current)) { if (isFalse(current.get("writable", current))) { - if (isTrue(getProperty(desc, "writable"))) + if (isTrue(Scriptable.getProperty(desc, "writable"))) throw ScriptRuntime.typeErrorById( "msg.change.writable.false.to.true.with.configurable.false", id); - if (!sameValue(getProperty(desc, "value"), current.get("value", current))) + if (!sameValue( + Scriptable.getProperty(desc, "value"), + current.get("value", current))) throw ScriptRuntime.typeErrorById( "msg.change.value.with.writable.false", id); } } else if (isAccessor && isAccessorDescriptor(current)) { - if (!sameValue(getProperty(desc, "set"), current.get("set", current))) + if (!sameValue( + Scriptable.getProperty(desc, "set"), current.get("set", current))) throw ScriptRuntime.typeErrorById( "msg.change.setter.with.configurable.false", id); - if (!sameValue(getProperty(desc, "get"), current.get("get", current))) + if (!sameValue( + Scriptable.getProperty(desc, "get"), current.get("get", current))) throw ScriptRuntime.typeErrorById( "msg.change.getter.with.configurable.false", id); } else { @@ -1845,7 +1849,7 @@ public abstract class ScriptableObject } protected int applyDescriptorToAttributeBitset(int attributes, ScriptableObject desc) { - Object enumerable = getProperty(desc, "enumerable"); + Object enumerable = Scriptable.getProperty(desc, "enumerable"); if (enumerable != NOT_FOUND) { attributes = ScriptRuntime.toBoolean(enumerable) @@ -1853,7 +1857,7 @@ public abstract class ScriptableObject : attributes | DONTENUM; } - Object writable = getProperty(desc, "writable"); + Object writable = Scriptable.getProperty(desc, "writable"); if (writable != NOT_FOUND) { attributes = ScriptRuntime.toBoolean(writable) @@ -1861,7 +1865,7 @@ public abstract class ScriptableObject : attributes | READONLY; } - Object configurable = getProperty(desc, "configurable"); + Object configurable = Scriptable.getProperty(desc, "configurable"); if (configurable != NOT_FOUND) { attributes = ScriptRuntime.toBoolean(configurable) @@ -1990,7 +1994,7 @@ public abstract class ScriptableObject */ public static Scriptable getClassPrototype(Scriptable scope, String className) { scope = getTopLevelScope(scope); - Object ctor = getProperty(scope, className); + Object ctor = Scriptable.getProperty(scope, className); Object proto; if (ctor instanceof BaseFunction) { proto = ((BaseFunction) ctor).getPrototypeProperty(); @@ -2154,7 +2158,7 @@ public abstract class ScriptableObject * @since 1.7R3 */ public static T getTypedProperty(Scriptable s, int index, Class type) { - Object val = getProperty(s, index); + Object val = Scriptable.getProperty(s, index); if (val == Scriptable.NOT_FOUND) { val = null; } @@ -2194,7 +2198,7 @@ public abstract class ScriptableObject * @since 1.7R3 */ public static T getTypedProperty(Scriptable s, String name, Class type) { - Object val = getProperty(s, name); + Object val = Scriptable.getProperty(s, name); if (val == Scriptable.NOT_FOUND) { val = null; } @@ -2432,7 +2436,7 @@ public abstract class ScriptableObject * @param args the arguments for the call */ public static Object callMethod(Context cx, Scriptable obj, String methodName, Object[] args) { - Object funObj = getProperty(obj, methodName); + Object funObj = Scriptable.getProperty(obj, methodName); if (!(funObj instanceof Function)) { throw ScriptRuntime.notFunctionError(obj, methodName); } diff --git a/rhino/src/main/java/org/mozilla/javascript/TopLevel.java b/rhino/src/main/java/org/mozilla/javascript/TopLevel.java index 6a4505b1c..4032a661a 100644 --- a/rhino/src/main/java/org/mozilla/javascript/TopLevel.java +++ b/rhino/src/main/java/org/mozilla/javascript/TopLevel.java @@ -101,7 +101,7 @@ public class TopLevel extends IdScriptableObject { public void cacheBuiltins(Scriptable scope, boolean sealed) { ctors = new EnumMap<>(Builtins.class); for (Builtins builtin : Builtins.values()) { - Object value = ScriptableObject.getProperty(this, builtin.name()); + Object value = Scriptable.getProperty(this, builtin.name()); if (value instanceof BaseFunction) { ctors.put(builtin, (BaseFunction) value); } else if (builtin == Builtins.GeneratorFunction) { @@ -114,7 +114,7 @@ public class TopLevel extends IdScriptableObject { } errors = new EnumMap<>(NativeErrors.class); for (NativeErrors error : NativeErrors.values()) { - Object value = ScriptableObject.getProperty(this, error.name()); + Object value = Scriptable.getProperty(this, error.name()); if (value instanceof BaseFunction) { errors.put(error, (BaseFunction) value); } diff --git a/rhino/src/main/java/org/mozilla/javascript/commonjs/module/Require.java b/rhino/src/main/java/org/mozilla/javascript/commonjs/module/Require.java index 740a88cc6..483719da4 100644 --- a/rhino/src/main/java/org/mozilla/javascript/commonjs/module/Require.java +++ b/rhino/src/main/java/org/mozilla/javascript/commonjs/module/Require.java @@ -329,7 +329,7 @@ public class Require extends BaseFunction { moduleScript.getScript().exec(cx, executionScope); executeOptionalScript(postExec, cx, executionScope); return ScriptRuntime.toObject( - cx, nativeScope, ScriptableObject.getProperty(moduleObject, "exports")); + cx, nativeScope, Scriptable.getProperty(moduleObject, "exports")); } private static void executeOptionalScript( diff --git a/rhino/src/main/java/org/mozilla/javascript/commonjs/module/provider/ModuleSourceProviderBase.java b/rhino/src/main/java/org/mozilla/javascript/commonjs/module/provider/ModuleSourceProviderBase.java index f3f9982ee..d54e50b79 100644 --- a/rhino/src/main/java/org/mozilla/javascript/commonjs/module/provider/ModuleSourceProviderBase.java +++ b/rhino/src/main/java/org/mozilla/javascript/commonjs/module/provider/ModuleSourceProviderBase.java @@ -56,7 +56,7 @@ public abstract class ModuleSourceProviderBase implements ModuleSourceProvider, private ModuleSource loadFromPathArray(String moduleId, Scriptable paths, Object validator) throws IOException { - final long llength = ScriptRuntime.toUint32(ScriptableObject.getProperty(paths, "length")); + final long llength = ScriptRuntime.toUint32(Scriptable.getProperty(paths, "length")); // Yeah, I'll ignore entries beyond Integer.MAX_VALUE; so sue me. int ilength = llength > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int) llength; diff --git a/rhino/src/main/java/org/mozilla/javascript/serialize/ScriptableOutputStream.java b/rhino/src/main/java/org/mozilla/javascript/serialize/ScriptableOutputStream.java index 76c7aaf74..87fc155c0 100644 --- a/rhino/src/main/java/org/mozilla/javascript/serialize/ScriptableOutputStream.java +++ b/rhino/src/main/java/org/mozilla/javascript/serialize/ScriptableOutputStream.java @@ -14,7 +14,6 @@ import java.util.HashMap; import java.util.Map; import java.util.StringTokenizer; import org.mozilla.javascript.Scriptable; -import org.mozilla.javascript.ScriptableObject; import org.mozilla.javascript.UniqueTag; /** @@ -150,7 +149,7 @@ public class ScriptableOutputStream extends ObjectOutputStream { Object result = scope; while (st.hasMoreTokens()) { String s = st.nextToken(); - result = ScriptableObject.getProperty((Scriptable) result, s); + result = Scriptable.getProperty((Scriptable) result, s); if (result == null || !(result instanceof Scriptable)) break; } return result; diff --git a/rhino/src/main/java/org/mozilla/javascript/typedarrays/NativeTypedArrayView.java b/rhino/src/main/java/org/mozilla/javascript/typedarrays/NativeTypedArrayView.java index b4feb33de..2be31c053 100644 --- a/rhino/src/main/java/org/mozilla/javascript/typedarrays/NativeTypedArrayView.java +++ b/rhino/src/main/java/org/mozilla/javascript/typedarrays/NativeTypedArrayView.java @@ -614,7 +614,7 @@ public abstract class NativeTypedArrayView extends NativeArrayBufferView return Undefined.instance; } - return getProperty(thisObj, (int) k); + return Scriptable.getProperty(thisObj, (int) k); } private Scriptable typedArraySpeciesCreate( diff --git a/rhino/src/main/java/org/mozilla/javascript/xml/XMLLib.java b/rhino/src/main/java/org/mozilla/javascript/xml/XMLLib.java index ff1116c6c..ce7a5c3f1 100644 --- a/rhino/src/main/java/org/mozilla/javascript/xml/XMLLib.java +++ b/rhino/src/main/java/org/mozilla/javascript/xml/XMLLib.java @@ -46,7 +46,7 @@ public abstract class XMLLib { // Ensure lazily initialization of real XML library instance // which is done on first access to XML property - ScriptableObject.getProperty(so, "XML"); + Scriptable.getProperty(so, "XML"); return (XMLLib) so.getAssociatedValue(XML_LIB_KEY); } diff --git a/rhino/src/test/java/org/mozilla/javascript/tests/Bug482203Test.java b/rhino/src/test/java/org/mozilla/javascript/tests/Bug482203Test.java index 658c09bca..edd8e0f0b 100644 --- a/rhino/src/test/java/org/mozilla/javascript/tests/Bug482203Test.java +++ b/rhino/src/test/java/org/mozilla/javascript/tests/Bug482203Test.java @@ -12,7 +12,6 @@ import org.mozilla.javascript.Callable; import org.mozilla.javascript.Context; import org.mozilla.javascript.Script; import org.mozilla.javascript.Scriptable; -import org.mozilla.javascript.ScriptableObject; public class Bug482203Test { @@ -27,7 +26,7 @@ public class Bug482203Test { script.exec(cx, scope); int counter = 0; for (; ; ) { - Object cont = ScriptableObject.getProperty(scope, "c"); + Object cont = Scriptable.getProperty(scope, "c"); if (cont == null) { break; } @@ -35,7 +34,7 @@ public class Bug482203Test { ((Callable) cont).call(cx, scope, scope, new Object[] {null}); } assertEquals(counter, 5); - assertEquals(Double.valueOf(3), ScriptableObject.getProperty(scope, "result")); + assertEquals(Double.valueOf(3), Scriptable.getProperty(scope, "result")); } } @@ -50,7 +49,7 @@ public class Bug482203Test { cx.executeScriptWithContinuations(script, scope); int counter = 0; for (; ; ) { - Object cont = ScriptableObject.getProperty(scope, "c"); + Object cont = Scriptable.getProperty(scope, "c"); if (cont == null) { break; } @@ -58,7 +57,7 @@ public class Bug482203Test { cx.resumeContinuation(cont, scope, null); } assertEquals(counter, 5); - assertEquals(Double.valueOf(3), ScriptableObject.getProperty(scope, "result")); + assertEquals(Double.valueOf(3), Scriptable.getProperty(scope, "result")); } } } diff --git a/rhino/src/test/java/org/mozilla/javascript/tests/IterableTest.java b/rhino/src/test/java/org/mozilla/javascript/tests/IterableTest.java index 5e3d8ad4b..f54ea3b73 100644 --- a/rhino/src/test/java/org/mozilla/javascript/tests/IterableTest.java +++ b/rhino/src/test/java/org/mozilla/javascript/tests/IterableTest.java @@ -72,7 +72,7 @@ public class IterableTest { @Override public Object get(Symbol key, Scriptable start) { if (SymbolKey.ITERATOR.equals(key)) { - return ScriptableObject.getProperty( + return Scriptable.getProperty( ScriptableObject.getArrayPrototype(scope), SymbolKey.ITERATOR); } throw new IllegalStateException(); diff --git a/rhino/src/test/java/org/mozilla/javascript/tests/PrimitiveTypeScopeResolutionTest.java b/rhino/src/test/java/org/mozilla/javascript/tests/PrimitiveTypeScopeResolutionTest.java index 6cb252397..a764c0514 100644 --- a/rhino/src/test/java/org/mozilla/javascript/tests/PrimitiveTypeScopeResolutionTest.java +++ b/rhino/src/test/java/org/mozilla/javascript/tests/PrimitiveTypeScopeResolutionTest.java @@ -102,7 +102,7 @@ public class PrimitiveTypeScopeResolutionTest { } public Object readPropFoo(final Scriptable s) { - return ScriptableObject.getProperty(s, "foo"); + return Scriptable.getProperty(s, "foo"); } } diff --git a/rhino/src/test/java/org/mozilla/javascript/tests/WrapFactoryTest.java b/rhino/src/test/java/org/mozilla/javascript/tests/WrapFactoryTest.java index 6390dd1f8..a6389d27e 100644 --- a/rhino/src/test/java/org/mozilla/javascript/tests/WrapFactoryTest.java +++ b/rhino/src/test/java/org/mozilla/javascript/tests/WrapFactoryTest.java @@ -79,9 +79,9 @@ public class WrapFactoryTest { cx.evaluateString(scope, script, "", 1, null); // evaluate result - assertEquals(result, ScriptableObject.getProperty(scope, "result")); - assertEquals(mapResult, ScriptableObject.getProperty(scope, "mapResult")); - assertEquals(getResult, ScriptableObject.getProperty(scope, "getResult")); + assertEquals(result, Scriptable.getProperty(scope, "result")); + assertEquals(mapResult, Scriptable.getProperty(scope, "mapResult")); + assertEquals(getResult, Scriptable.getProperty(scope, "getResult")); } } }