Introduction of org.mozilla.javascript.Kit to contain generic support utilities.

This commit is contained in:
igor%mir2.org 2003-10-21 13:43:22 +00:00
Родитель 6aac95c7d1
Коммит 7ca1f5cb7d
31 изменённых файлов: 376 добавлений и 231 удалений

Просмотреть файл

@ -88,7 +88,7 @@ class Arguments extends IdScriptable {
if (sharedWithActivation(index)) {
String argName = activation.funObj.argNames[index];
value = activation.get(argName, activation);
if (value == NOT_FOUND) Context.codeBug();
if (value == NOT_FOUND) Kit.codeBug();
}
return value;
}

Просмотреть файл

@ -45,11 +45,11 @@ public abstract class ClassNameHelper {
public static ClassNameHelper get(Context cx) {
ClassNameHelper helper = savedNameHelper;
if (helper == null && !helperNotAvailable) {
Class nameHelperClass = ScriptRuntime.classOrNull(
Class nameHelperClass = Kit.classOrNull(
"org.mozilla.javascript.optimizer.OptClassNameHelper");
// nameHelperClass == null if running lite
if (nameHelperClass != null) {
helper = (ClassNameHelper)ScriptRuntime.newInstanceOrNull(
helper = (ClassNameHelper)Kit.newInstanceOrNull(
nameHelperClass);
}
if (helper != null) {

Просмотреть файл

@ -158,7 +158,7 @@ public class Context {
} else {
if (cx == null)
cx = new Context();
if (cx.enterCount != 0) Context.codeBug();
if (cx.enterCount != 0) Kit.codeBug();
Object[] array = contextListeners;
if (array != null) {
@ -202,7 +202,7 @@ public class Context {
throw new IllegalStateException(
"Calling Context.exit without previous Context.enter");
}
if (Context.check && cx.enterCount < 1) Context.codeBug();
if (Context.check && cx.enterCount < 1) Kit.codeBug();
--cx.enterCount;
if (cx.enterCount == 0) {
released = true;
@ -1768,7 +1768,7 @@ public class Context {
// If Context was subclussed, cxClass != Context.class
Class cxClass = this.getClass();
// Check that Context or its suclass is accesible from this loader
Class x = ScriptRuntime.classOrNull(loader, cxClass.getName());
Class x = Kit.classOrNull(loader, cxClass.getName());
if (x != cxClass) {
// The check covers the case when x == null =>
// threadLoader does not know about Rhino or the case
@ -1904,7 +1904,7 @@ public class Context {
throws IOException
{
// One of sourceReader or sourceString has to be null
if (!(sourceReader == null ^ sourceString == null)) Context.codeBug();
if (!(sourceReader == null ^ sourceString == null)) Kit.codeBug();
Interpreter compiler = createCompiler();
@ -1954,20 +1954,20 @@ public class Context {
encodedSource);
if (debugger != null) {
if (sourceString == null) Context.codeBug();
if (sourceString == null) Kit.codeBug();
compiler.notifyDebuggerCompilationDone(this, result, sourceString);
}
return ts.errorCount == 0 ? result : null;
}
private static Class codegenClass = ScriptRuntime.classOrNull(
private static Class codegenClass = Kit.classOrNull(
"org.mozilla.javascript.optimizer.Codegen");
private Interpreter createCompiler() {
Interpreter result = null;
if (optimizationLevel >= 0 && codegenClass != null) {
result = (Interpreter)ScriptRuntime.newInstanceOrNull(codegenClass);
result = (Interpreter)Kit.newInstanceOrNull(codegenClass);
}
if (result == null) {
result = new Interpreter();
@ -2032,10 +2032,10 @@ public class Context {
RegExpProxy getRegExpProxy() {
if (regExpProxy == null) {
Class cl = ScriptRuntime.classOrNull(
Class cl = Kit.classOrNull(
"org.mozilla.javascript.regexp.RegExpImpl");
if (cl != null) {
regExpProxy = (RegExpProxy)ScriptRuntime.newInstanceOrNull(cl);
regExpProxy = (RegExpProxy)Kit.newInstanceOrNull(cl);
}
}
return regExpProxy;
@ -2100,18 +2100,6 @@ public class Context {
activationNames.remove(name);
}
/**
* Throws RuntimeException to indicate failed assertion.
* The function never returns and its return type is RuntimeException
* only to be able to write <tt>throw Context.codeBug()</tt> if plain
* <tt>Context.codeBug()</tt> triggers unreachable code error.
*/
public static RuntimeException codeBug()
throws RuntimeException
{
throw new RuntimeException("FAILED ASSERTION");
}
static final boolean check = true;
private static Hashtable threadContexts = new Hashtable(11);
@ -2120,7 +2108,7 @@ public class Context {
private static Method threadLocalSet;
static {
Class cl = ScriptRuntime.classOrNull("java.lang.ThreadLocal");
Class cl = Kit.classOrNull("java.lang.ThreadLocal");
if (cl != null) {
try {
threadLocalGet = cl.getMethod("get", null);
@ -2139,7 +2127,7 @@ public class Context {
// Don't use "Thread.class": that performs the lookup
// in the class initializer, which doesn't allow us to
// catch possible security exceptions.
Class threadClass = ScriptRuntime.classOrNull("java.lang.Thread");
Class threadClass = Kit.classOrNull("java.lang.Thread");
if (threadClass != null) {
try {
method_getContextClassLoader =

Просмотреть файл

@ -181,7 +181,7 @@ public class Decompiler
else {
// we can ignore negative values, bc they're already prefixed
// by NEG
if (lbits < 0) Context.codeBug();
if (lbits < 0) Kit.codeBug();
// will it fit in a char?
// this gives a short encoding for integer values up to 2^16.
@ -234,7 +234,7 @@ public class Decompiler
private void increaseSourceCapacity(int minimalCapacity)
{
// Call this only when capacity increase is must
if (minimalCapacity <= sourceBuffer.length) Context.codeBug();
if (minimalCapacity <= sourceBuffer.length) Kit.codeBug();
int newCapacity = sourceBuffer.length * 2;
if (newCapacity < minimalCapacity) {
newCapacity = minimalCapacity;
@ -246,7 +246,7 @@ public class Decompiler
private String sourceToString(int offset)
{
if (offset < 0 || sourceTop < offset) Context.codeBug();
if (offset < 0 || sourceTop < offset) Kit.codeBug();
return new String(sourceBuffer, offset, sourceTop - offset);
}

Просмотреть файл

@ -123,7 +123,7 @@ public class GlobalScope extends ScriptableObject
static void embed(ScriptableObject top)
{
if (top instanceof GlobalScope) Context.codeBug();
if (top instanceof GlobalScope) Kit.codeBug();
GlobalScope global = new GlobalScope();
top.defineProperty("__globalScope", global,
ScriptableObject.PERMANENT

Просмотреть файл

@ -870,7 +870,7 @@ public class IRFactory {
case Token.NUMBER:
return Node.newNumber(newTemp.getDouble());
default:
throw Context.codeBug();
throw Kit.codeBug();
}
}
@ -879,7 +879,7 @@ public class IRFactory {
}
public Node createUseLocal(Node newLocal) {
if (Token.NEWLOCAL != newLocal.getType()) Context.codeBug();
if (Token.NEWLOCAL != newLocal.getType()) Kit.codeBug();
Node result = new Node(Token.USELOCAL);
result.putProp(Node.LOCAL_PROP, newLocal);
return result;

Просмотреть файл

@ -400,7 +400,7 @@ public abstract class IdScriptable extends ScriptableObject
protected final void setMaxId(int maxId)
{
// maxId can only go up
if (maxId < this.maxId) Context.codeBug();
if (maxId < this.maxId) Kit.codeBug();
this.maxId = maxId;
}

Просмотреть файл

@ -186,7 +186,7 @@ final class ImporterFunctions extends JIFunction
if (id == Id_importClass) {
initNameArity("importClass", 1);
} else {
if (id != Id_importPackage) Context.codeBug();
if (id != Id_importPackage) Kit.codeBug();
initNameArity("importPackage", 1);
}
defineAsProperty(importer);
@ -205,7 +205,7 @@ final class ImporterFunctions extends JIFunction
if (id == Id_importClass) {
importer.importClass(cx, thisObj, args);
} else {
if (id != Id_importPackage) Context.codeBug();
if (id != Id_importPackage) Kit.codeBug();
importer.importPackage(cx, thisObj, args);
}
return Undefined.instance;

Просмотреть файл

@ -206,7 +206,7 @@ public class Interpreter
for (iter.start(); !iter.done(); iter.next()) {
String str = (String)iter.getKey();
int index = iter.getValue();
if (itsData.itsStringTable[index] != null) Context.codeBug();
if (itsData.itsStringTable[index] != null) Kit.codeBug();
itsData.itsStringTable[index] = str;
}
}
@ -832,7 +832,7 @@ public class Interpreter
boolean generated = false;
if (child == catchTarget) {
if (tryEnd >= 0) Context.codeBug();
if (tryEnd >= 0) Kit.codeBug();
tryEnd = iCodeTop;
catchStart = iCodeTop;
@ -1061,7 +1061,7 @@ public class Interpreter
private void resolveForwardGoto(int jumpStart, int iCodeTop)
{
if (jumpStart + 3 > iCodeTop) Context.codeBug();
if (jumpStart + 3 > iCodeTop) Kit.codeBug();
int offset = iCodeTop - jumpStart;
// +1 to write after jump icode
recordJumpOffset(jumpStart + 1, offset);
@ -1091,14 +1091,14 @@ public class Interpreter
if (!(Token.FIRST_BYTECODE_TOKEN <= token
&& token <= Token.LAST_BYTECODE_TOKEN))
{
Context.codeBug();
Kit.codeBug();
}
return addByte(token, iCodeTop);
}
private int addIcode(int icode, int iCodeTop)
{
if (!(BASE_ICODE < icode && icode <= Icode_END)) Context.codeBug();
if (!(BASE_ICODE < icode && icode <= Icode_END)) Kit.codeBug();
return addByte(icode, iCodeTop);
}
@ -1115,7 +1115,7 @@ public class Interpreter
private int addIndex(int index, int iCodeTop)
{
if (index < 0) Context.codeBug();
if (index < 0) Kit.codeBug();
if (index > 0xFFFF) {
throw Context.reportRuntimeError0("msg.too.big.index");
}
@ -1177,7 +1177,7 @@ public class Interpreter
int top = itsExceptionTableTop;
int[] table = itsData.itsExceptionTable;
if (table == null) {
if (top != 0) Context.codeBug();
if (top != 0) Kit.codeBug();
table = new int[EXCEPTION_SLOT_SIZE * 2];
itsData.itsExceptionTable = table;
} else if (table.length == top) {
@ -1196,7 +1196,7 @@ public class Interpreter
private byte[] increaseICodeCapasity(int iCodeTop, int extraSize) {
int capacity = itsData.itsICode.length;
if (iCodeTop + extraSize <= capacity) Context.codeBug();
if (iCodeTop + extraSize <= capacity) Kit.codeBug();
capacity *= 2;
if (iCodeTop + extraSize > capacity) {
capacity = iCodeTop + extraSize;
@ -1236,7 +1236,7 @@ public class Interpreter
if (start <= pc && pc < end) {
if (best < 0 || bestStart <= start) {
// Check handlers are nested
if (best >= 0 && bestEnd < end) Context.codeBug();
if (best >= 0 && bestEnd < end) Kit.codeBug();
best = i;
bestStart = start;
bestEnd = end;
@ -1307,7 +1307,7 @@ public class Interpreter
int icodeLength = icodeTokenLength(token);
switch (token) {
default:
if (icodeLength != 1) Context.codeBug();
if (icodeLength != 1) Kit.codeBug();
out.println(tname);
break;
@ -1405,7 +1405,7 @@ public class Interpreter
break;
}
}
if (old_pc + icodeLength != pc) Context.codeBug();
if (old_pc + icodeLength != pc) Kit.codeBug();
}
int[] table = idata.itsExceptionTable;
@ -1566,7 +1566,7 @@ public class Interpreter
return 1 + 2;
default:
Context.codeBug(); // Bad icodeToken
Kit.codeBug(); // Bad icodeToken
return 0;
}
}
@ -1581,7 +1581,7 @@ public class Interpreter
int icodeToken = iCode[pc] & 0xff;
int icodeLength = icodeTokenLength(icodeToken);
if (icodeToken == Icode_LINE) {
if (icodeLength != 3) Context.codeBug();
if (icodeLength != 3) Kit.codeBug();
int line = getShort(iCode, pc + 1);
presentLines.put(line, 0);
}
@ -1610,7 +1610,7 @@ public class Interpreter
private static Scriptable[] wrapRegExps(Context cx, Scriptable scope,
InterpreterData idata)
{
if (idata.itsRegExpLiterals == null) Context.codeBug();
if (idata.itsRegExpLiterals == null) Kit.codeBug();
RegExpProxy rep = ScriptRuntime.checkRegExpProxy(cx);
int N = idata.itsRegExpLiterals.length;
@ -1664,7 +1664,7 @@ public class Interpreter
int maxFrameArray = idata.itsMaxFrameArray;
if (maxFrameArray != STACK_SHFT + idata.itsMaxStack)
Context.codeBug();
Kit.codeBug();
Object[] stack = new Object[maxFrameArray];
double[] sDbl = new double[maxFrameArray];
@ -1718,7 +1718,7 @@ public class Interpreter
if (idata.itsNestedFunctions != null) {
if (idata.itsFunctionType != 0 && !idata.itsNeedsActivation)
Context.codeBug();
Kit.codeBug();
for (int i = 0; i < idata.itsNestedFunctions.length; i++) {
InterpreterData fdata = idata.itsNestedFunctions[i];
if (fdata.itsFunctionType == FunctionNode.FUNCTION_STATEMENT) {
@ -1779,7 +1779,7 @@ public class Interpreter
// loop, not in the loop catch block itself to deal withnexceptions
// from observeInstructionCount. A special bytecode is used only to
// simplify logic.
if (javaException == null) Context.codeBug();
if (javaException == null) Kit.codeBug();
int pcNew = -1;
boolean doCatch = false;
@ -1839,7 +1839,7 @@ public class Interpreter
int tryWithDepth = idata.itsExceptionTable[
handlerOffset + EXCEPTION_WITH_DEPTH_SLOT];
while (tryWithDepth != withDepth) {
if (scope == null) Context.codeBug();
if (scope == null) Kit.codeBug();
scope = ScriptRuntime.leaveWith(scope);
--withDepth;
}
@ -3008,7 +3008,7 @@ public class Interpreter
String name = f.argNames[slot];
Object val = activation.get(name, activation);
// Activation parameter or var is permanent
if (val == Scriptable.NOT_FOUND) Context.codeBug();
if (val == Scriptable.NOT_FOUND) Kit.codeBug();
return val;
}
@ -3031,7 +3031,7 @@ public class Interpreter
throws JavaScriptException
{
if (cx.interpreterSecurityDomain == idata.securityDomain)
Context.codeBug();
Kit.codeBug();
Script code = new Script() {
public Object exec(Context cx, Scriptable scope)
@ -3056,7 +3056,7 @@ public class Interpreter
private static int getJavaCatchPC(byte[] iCode)
{
int pc = iCode.length - 1;
if ((iCode[pc] & 0xFF) != Icode_CATCH) Context.codeBug();
if ((iCode[pc] & 0xFF) != Icode_CATCH) Kit.codeBug();
return pc;
}

Просмотреть файл

@ -59,14 +59,14 @@ public abstract class Invoker {
if (implClass == null)
return null;
Invoker master = (Invoker)ScriptRuntime.newInstanceOrNull(implClass);
Invoker master = (Invoker)Kit.newInstanceOrNull(implClass);
if (master == null)
implClass = null;
return master;
}
private static Class implClass = ScriptRuntime.classOrNull(
private static Class implClass = Kit.classOrNull(
"org.mozilla.javascript.optimizer.InvokerImpl");
}

Просмотреть файл

@ -326,7 +326,7 @@ class JavaMembers
if (value instanceof ObjArray) {
overloadedMethods = (ObjArray)value;
} else {
if (!(value instanceof Method)) Context.codeBug();
if (!(value instanceof Method)) Kit.codeBug();
// value should be instance of Method as reflectMethods is
// called when staticMembers and members are empty
overloadedMethods = new ObjArray();
@ -376,7 +376,7 @@ class JavaMembers
}
} else {
// "unknown member type"
Context.codeBug();
Kit.codeBug();
}
}
}
@ -484,7 +484,7 @@ class JavaMembers
} else {
ObjArray overloadedMethods = (ObjArray)value;
int N = overloadedMethods.size();
if (N < 2) Context.codeBug();
if (N < 2) Kit.codeBug();
methods = new MemberBox[N];
for (int i = 0; i != N; ++i) {
Method method = (Method)overloadedMethods.get(i);
@ -559,7 +559,7 @@ class JavaMembers
return method;
}
} else {
if (pass != 2) Context.codeBug();
if (pass != 2) Kit.codeBug();
if (params[0].isAssignableFrom(type)) {
return method;
}

Просмотреть файл

@ -0,0 +1,222 @@
/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is collection of utilities useful for Rhino code.
*
* The Initial Developer of the Original Code is
* RUnit Software AS.
* Portions created by the Initial Developer are Copyright (C) 2003
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Igor Bukanov, igor@fastmail.fm
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
package org.mozilla.javascript;
import java.lang.reflect.*;
/**
* Collection of utilities
*/
public class Kit
{
static Class classOrNull(String className)
{
try {
return Class.forName(className);
} catch (ClassNotFoundException ex) {
} catch (SecurityException ex) {
} catch (LinkageError ex) {
} catch (IllegalArgumentException e) {
// Can be thrown if name has characters that a class name
// can not contain
}
return null;
}
static Class classOrNull(ClassLoader loader, String className)
{
try {
return loader.loadClass(className);
} catch (ClassNotFoundException ex) {
} catch (SecurityException ex) {
} catch (LinkageError ex) {
} catch (IllegalArgumentException e) {
// Can be thrown if name has characters that a class name
// can not contain
}
return null;
}
static Object newInstanceOrNull(Class cl)
{
try {
return cl.newInstance();
} catch (SecurityException x) {
} catch (LinkageError ex) {
} catch (InstantiationException x) {
} catch (IllegalAccessException x) {
}
return null;
}
/**
* Split string into array of strings using semicolon as string terminator
* (; after the last string is required).
*/
public static String[] semicolonSplit(String s)
{
int count = 0;
for (int cursor = 0; ;) {
int next = s.indexOf(';', cursor) + 1;
if (next <= 0) {
// check for missing ;
if (cursor + 1 < s.length())
throw new IllegalArgumentException();
break;
}
++count;
cursor = next + 1;
}
String[] array = new String[count];
count = 0;
for (int cursor = 0; ;) {
int next = s.indexOf(';', cursor);
if (next < 0) { break; }
array[count] = s.substring(cursor, next);
++count;
cursor = next + 1;
}
return array;
}
public static Object addListener(Object bag, Object listener)
{
if (listener == null) throw new IllegalArgumentException();
if (listener instanceof Object[]) throw new IllegalArgumentException();
if (bag == null) {
bag = listener;
} else if (!(bag instanceof Object[])) {
bag = new Object[] { bag, listener };
} else {
Object[] array = (Object[])bag;
int L = array.length;
// bag has at least 2 elements if it is array
if (L < 2) throw new IllegalArgumentException();
Object[] tmp = new Object[L + 1];
System.arraycopy(array, 0, tmp, 0, L);
tmp[L] = listener;
bag = tmp;
}
return bag;
}
public static Object removeListener(Object bag, Object listener)
{
if (listener == null) throw new IllegalArgumentException();
if (listener instanceof Object[]) throw new IllegalArgumentException();
if (bag == listener) {
bag = null;
} else if (bag instanceof Object[]) {
Object[] array = (Object[])bag;
int L = array.length;
// bag has at least 2 elements if it is array
if (L < 2) throw new IllegalArgumentException();
if (L == 2) {
if (array[1] == listener) {
bag = array[0];
} else if (array[0] == listener) {
bag = array[1];
}
} else {
int i = L;
do {
--i;
if (array[i] == listener) {
Object[] tmp = new Object[L - 1];
System.arraycopy(array, 0, tmp, 0, i);
System.arraycopy(array, i + 1, tmp, i, L - (i + 1));
bag = tmp;
break;
}
} while (i != 0);
}
}
return bag;
}
public static Object getListener(Object bag, int index)
{
if (index == 0) {
if (bag == null)
return null;
if (!(bag instanceof Object[]))
return bag;
Object[] array = (Object[])bag;
// bag has at least 2 elements if it is array
if (array.length < 2) throw new IllegalArgumentException();
return array[0];
} else if (index == 1) {
if (!(bag instanceof Object[])) {
if (bag == null) throw new IllegalArgumentException();
return null;
}
Object[] array = (Object[])bag;
// the array access will check for index on its own
return array[1];
} else {
// bag has to array
Object[] array = (Object[])bag;
int L = array.length;
if (L < 2) throw new IllegalArgumentException();
if (index == L)
return null;
return array[index];
}
}
/**
* Throws RuntimeException to indicate failed assertion.
* The function never returns and its return type is RuntimeException
* only to be able to write <tt>throw Kit.codeBug()</tt> if plain
* <tt>Kit.codeBug()</tt> triggers unreachable code error.
*/
public static RuntimeException codeBug()
throws RuntimeException
{
throw new RuntimeException("FAILED ASSERTION");
}
}

Просмотреть файл

@ -78,7 +78,7 @@ public final class LazilyLoadedCtor {
// java.util.PropertyPermission
// org.mozilla.javascript.JavaAdapter read
Class cl = ScriptRuntime.classOrNull(className);
Class cl = Kit.classOrNull(className);
if (cl == null) {
removeOnError = true;
} else {

Просмотреть файл

@ -640,9 +640,9 @@ public class NativeArray extends IdScriptable {
{
if (check) {
if (cmp == null) {
if (cmpBuf != null) Context.codeBug();
if (cmpBuf != null) Kit.codeBug();
} else {
if (cmpBuf == null || cmpBuf.length != 2) Context.codeBug();
if (cmpBuf == null || cmpBuf.length != 2) Kit.codeBug();
}
}
@ -688,7 +688,7 @@ public class NativeArray extends IdScriptable {
Object cmp, Object[] cmpBuf)
throws JavaScriptException
{
if (check && length <= 1) Context.codeBug();
if (check && length <= 1) Kit.codeBug();
// Build heap
for (int i = length / 2; i != 0;) {
@ -743,7 +743,7 @@ public class NativeArray extends IdScriptable {
Object cmp, Object[] cmpBuf)
throws JavaScriptException
{
if (check && length <= 1) Context.codeBug();
if (check && length <= 1) Kit.codeBug();
// Build heap
for (long i = length / 2; i != 0;) {

Просмотреть файл

@ -914,7 +914,7 @@ final class NativeDate extends IdScriptable {
case 8 /* mdt */: tzoffset = 6 * 60; break;
case 9 /* pst */: tzoffset = 8 * 60; break;
case 10 /* pdt */:tzoffset = 7 * 60; break;
default: Context.codeBug();
default: Kit.codeBug();
}
}
}
@ -1128,7 +1128,7 @@ final class NativeDate extends IdScriptable {
private static void append0PaddedUint(StringBuffer sb, int i, int minWidth)
{
if (i < 0) Context.codeBug();
if (i < 0) Kit.codeBug();
int scale = 1;
--minWidth;
if (i >= 10) {
@ -1213,7 +1213,7 @@ final class NativeDate extends IdScriptable {
break;
default:
Context.codeBug();
Kit.codeBug();
maxargs = 0;
}
@ -1319,7 +1319,7 @@ final class NativeDate extends IdScriptable {
break;
default:
Context.codeBug();
Kit.codeBug();
maxargs = 0;
}

Просмотреть файл

@ -71,7 +71,7 @@ public class NativeGlobal implements Serializable, IdFunctionMaster
case Id_parseInt: name = "parseInt"; break;
case Id_unescape: name = "unescape"; break;
default:
Context.codeBug(); name = null;
Kit.codeBug(); name = null;
}
IdFunction.define(scope, name, obj, id,
ScriptableObject.DONTENUM, sealed);
@ -87,7 +87,7 @@ public class NativeGlobal implements Serializable, IdFunctionMaster
Undefined.instance,
ScriptableObject.DONTENUM);
String[] errorMethods = ScriptRuntime.splitSC(""
String[] errorMethods = Kit.semicolonSplit(""
+"ConversionError;"
+"EvalError;"
+"RangeError;"
@ -575,7 +575,7 @@ public class NativeGlobal implements Serializable, IdFunctionMaster
}
private static char toHexChar(int i) {
if (i >> 4 != 0) Context.codeBug();
if (i >> 4 != 0) Kit.codeBug();
return (char)((i < 10) ? i + '0' : i - 10 + 'a');
}

Просмотреть файл

@ -266,9 +266,9 @@ public class NativeJavaClass extends NativeJavaObject implements Function {
// via system class loader which can be different from the
// loader that brought Rhino classes that Class.forName() would
// use, but ClassLoader.getSystemClassLoader() is Java 2 only
return ScriptRuntime.classOrNull(nestedClassName);
return Kit.classOrNull(nestedClassName);
} else {
return ScriptRuntime.classOrNull(loader, nestedClassName);
return Kit.classOrNull(loader, nestedClassName);
}
}

Просмотреть файл

@ -295,7 +295,7 @@ public class NativeJavaMethod extends BaseFunction
} else if (preference == PREFERENCE_SECOND_ARG) {
if (debug) printDebug("Rejecting ", member, args);
} else {
if (preference != PREFERENCE_EQUAL) Context.codeBug();
if (preference != PREFERENCE_EQUAL) Kit.codeBug();
MemberBox best = methodsOrCtors[bestFit];
if (best.isStatic()
&& best.getDeclaringClass().isAssignableFrom(

Просмотреть файл

@ -112,7 +112,7 @@ public class NativeJavaTopPackage
top.setPrototype(getObjectPrototype(scope));
top.setParentScope(scope);
String[] names = ScriptRuntime.splitSC(commonPackages);
String[] names = Kit.semicolonSplit(commonPackages);
for (int i = 0; i != names.length; ++i) {
top.forcePackage(names[i]);
}

Просмотреть файл

@ -94,7 +94,7 @@ public class Node implements Cloneable {
if (!(type == Token.BREAK || type == Token.CONTINUE
|| type == Token.LABEL))
{
Context.codeBug();
Kit.codeBug();
}
return label;
}
@ -104,36 +104,36 @@ public class Node implements Cloneable {
if (!(type == Token.BREAK || type == Token.CONTINUE
|| type == Token.LABEL))
{
Context.codeBug();
Kit.codeBug();
}
if (label == null) Context.codeBug();
if (this.label != null) Context.codeBug(); //only once
if (label == null) Kit.codeBug();
if (this.label != null) Kit.codeBug(); //only once
this.label = label;
}
public final Target getFinally()
{
if (!(type == Token.TRY)) Context.codeBug();
if (!(type == Token.TRY)) Kit.codeBug();
return target2;
}
public final void setFinally(Target finallyTarget)
{
if (!(type == Token.TRY)) Context.codeBug();
if (finallyTarget == null) Context.codeBug();
if (target2 != null) Context.codeBug(); //only once
if (!(type == Token.TRY)) Kit.codeBug();
if (finallyTarget == null) Kit.codeBug();
if (target2 != null) Kit.codeBug(); //only once
target2 = finallyTarget;
}
public final Target getContinue()
{
if (!(type == Token.LABEL || type == Token.LOOP)) Context.codeBug(); return target2;
if (!(type == Token.LABEL || type == Token.LOOP)) Kit.codeBug(); return target2;
}
public final void setContinue(Target continueTarget)
{
if (!(type == Token.LABEL || type == Token.LOOP)) Context.codeBug(); if (continueTarget == null) Context.codeBug();
if (target2 != null) Context.codeBug(); //only once
if (!(type == Token.LABEL || type == Token.LOOP)) Kit.codeBug(); if (continueTarget == null) Kit.codeBug();
if (target2 != null) Kit.codeBug(); //only once
target2 = continueTarget;
}
@ -431,7 +431,7 @@ public class Node implements Cloneable {
case SPECIALCALL_PROP: return "specialcall";
default: Context.codeBug();
default: Kit.codeBug();
}
}
return null;
@ -493,7 +493,7 @@ public class Node implements Cloneable {
public int getExistingIntProp(int propType)
{
PropListItem item = lookupProperty(propType);
if (item == null) { Context.codeBug(); }
if (item == null) { Kit.codeBug(); }
return item.intValue;
}

Просмотреть файл

@ -81,7 +81,7 @@ public class ObjToIntMap implements Serializable {
}
public void next() {
if (remaining == -1) Context.codeBug();
if (remaining == -1) Kit.codeBug();
if (remaining == 0) {
remaining = -1;
cursor = -1;
@ -122,13 +122,13 @@ public class ObjToIntMap implements Serializable {
}
public ObjToIntMap(int keyCountHint) {
if (keyCountHint < 0) Context.codeBug();
if (keyCountHint < 0) Kit.codeBug();
// Table grow when number of stored keys >= 3/4 of max capacity
int minimalCapacity = keyCountHint * 4 / 3;
int i;
for (i = 2; (1 << i) < minimalCapacity; ++i) { }
power = i;
if (check && power < 2) Context.codeBug();
if (check && power < 2) Kit.codeBug();
}
public boolean isEmpty() {
@ -169,7 +169,7 @@ public class ObjToIntMap implements Serializable {
return values[index];
}
// Key must exist
Context.codeBug();
Kit.codeBug();
return 0;
}
@ -273,7 +273,7 @@ public class ObjToIntMap implements Serializable {
int n = 0;
for (;;) {
if (check) {
if (n >= occupiedCount) Context.codeBug();
if (n >= occupiedCount) Kit.codeBug();
++n;
}
index = (index + step) & mask;
@ -295,8 +295,8 @@ public class ObjToIntMap implements Serializable {
// Insert key that is not present to table without deleted entries
// and enough free space
private int insertNewKey(Object key, int hash) {
if (check && occupiedCount != keyCount) Context.codeBug();
if (check && keyCount == 1 << power) Context.codeBug();
if (check && occupiedCount != keyCount) Kit.codeBug();
if (check && keyCount == 1 << power) Kit.codeBug();
int fraction = hash * A;
int index = fraction >>> (32 - power);
int N = 1 << power;
@ -305,9 +305,9 @@ public class ObjToIntMap implements Serializable {
int step = tableLookupStep(fraction, mask, power);
int firstIndex = index;
do {
if (check && keys[index] == DELETED) Context.codeBug();
if (check && keys[index] == DELETED) Kit.codeBug();
index = (index + step) & mask;
if (check && firstIndex == index) Context.codeBug();
if (check && firstIndex == index) Kit.codeBug();
} while (keys[index] != null);
}
keys[index] = key;
@ -320,8 +320,8 @@ public class ObjToIntMap implements Serializable {
private void rehashTable() {
if (keys == null) {
if (check && keyCount != 0) Context.codeBug();
if (check && occupiedCount != 0) Context.codeBug();
if (check && keyCount != 0) Kit.codeBug();
if (check && occupiedCount != 0) Kit.codeBug();
int N = 1 << power;
keys = new Object[N];
values = new int[2 * N];
@ -379,7 +379,7 @@ public class ObjToIntMap implements Serializable {
int n = 0;
for (;;) {
if (check) {
if (n >= occupiedCount) Context.codeBug();
if (n >= occupiedCount) Kit.codeBug();
++n;
}
index = (index + step) & mask;
@ -400,7 +400,7 @@ public class ObjToIntMap implements Serializable {
}
// Inserting of new key
if (check && keys != null && keys[index] != null)
Context.codeBug();
Kit.codeBug();
if (firstDeleted >= 0) {
index = firstDeleted;
}
@ -639,7 +639,7 @@ public class ObjToIntMap implements Serializable {
}
private static void check(boolean condition) {
if (!condition) Context.codeBug();
if (!condition) Kit.codeBug();
}
private static Object[] testPool;

Просмотреть файл

@ -60,7 +60,7 @@ public class ScriptOrFnNode extends Node {
public final void setBaseLineno(int lineno) {
// One time action
if (lineno < 0 || baseLineno >= 0) Context.codeBug();
if (lineno < 0 || baseLineno >= 0) Kit.codeBug();
baseLineno = lineno;
}
@ -68,7 +68,7 @@ public class ScriptOrFnNode extends Node {
public final void setEndLineno(int lineno) {
// One time action
if (lineno < 0 || endLineno >= 0) Context.codeBug();
if (lineno < 0 || endLineno >= 0) Kit.codeBug();
endLineno = lineno;
}
@ -82,7 +82,7 @@ public class ScriptOrFnNode extends Node {
}
public final int addFunction(FunctionNode fnNode) {
if (fnNode == null) Context.codeBug();
if (fnNode == null) Kit.codeBug();
if (functions == null) { functions = new ObjArray(); }
functions.add(fnNode);
return functions.size() - 1;
@ -102,7 +102,7 @@ public class ScriptOrFnNode extends Node {
}
public final int addRegexp(String string, String flags) {
if (string == null) Context.codeBug();
if (string == null) Kit.codeBug();
if (regexps == null) { regexps = new ObjArray(); }
regexps.add(string);
regexps.add(flags);
@ -141,7 +141,7 @@ public class ScriptOrFnNode extends Node {
public final void addParam(String name) {
// Check addparam is not called after addLocal
if (varStart != itsVariables.size()) Context.codeBug();
if (varStart != itsVariables.size()) Kit.codeBug();
// Allow non-unique parameter names: use the last occurrence
int index = varStart++;
itsVariables.add(name);

Просмотреть файл

@ -67,30 +67,29 @@ public class ScriptRuntime {
*/
public final static Class
BooleanClass = classOrNull("java.lang.Boolean"),
ByteClass = classOrNull("java.lang.Byte"),
CharacterClass = classOrNull("java.lang.Character"),
ClassClass = classOrNull("java.lang.Class"),
DoubleClass = classOrNull("java.lang.Double"),
FloatClass = classOrNull("java.lang.Float"),
IntegerClass = classOrNull("java.lang.Integer"),
LongClass = classOrNull("java.lang.Long"),
NumberClass = classOrNull("java.lang.Number"),
ObjectClass = classOrNull("java.lang.Object"),
ShortClass = classOrNull("java.lang.Short"),
StringClass = classOrNull("java.lang.String"),
BooleanClass = Kit.classOrNull("java.lang.Boolean"),
ByteClass = Kit.classOrNull("java.lang.Byte"),
CharacterClass = Kit.classOrNull("java.lang.Character"),
ClassClass = Kit.classOrNull("java.lang.Class"),
DoubleClass = Kit.classOrNull("java.lang.Double"),
FloatClass = Kit.classOrNull("java.lang.Float"),
IntegerClass = Kit.classOrNull("java.lang.Integer"),
LongClass = Kit.classOrNull("java.lang.Long"),
NumberClass = Kit.classOrNull("java.lang.Number"),
ObjectClass = Kit.classOrNull("java.lang.Object"),
ShortClass = Kit.classOrNull("java.lang.Short"),
StringClass = Kit.classOrNull("java.lang.String"),
SerializableClass = classOrNull("java.io.Serializable"),
SerializableClass = Kit.classOrNull("java.io.Serializable"),
DateClass = classOrNull("java.util.Date");
DateClass = Kit.classOrNull("java.util.Date");
public final static Class
ContextClass = classOrNull("org.mozilla.javascript.Context"),
FunctionClass = classOrNull("org.mozilla.javascript.Function"),
ScriptableClass = classOrNull("org.mozilla.javascript.Scriptable"),
ScriptableObjectClass = classOrNull(
"org.mozilla.javascript.ScriptableObject"),
UndefinedClass = classOrNull("org.mozilla.javascript.Undefined");
ContextClass = Kit.classOrNull("org.mozilla.javascript.Context"),
FunctionClass = Kit.classOrNull("org.mozilla.javascript.Function"),
ScriptableClass = Kit.classOrNull("org.mozilla.javascript.Scriptable"),
ScriptableObjectClass = Kit.classOrNull("org.mozilla.javascript.ScriptableObject"),
UndefinedClass = Kit.classOrNull("org.mozilla.javascript.Undefined");
/**
* Convert the value to a boolean.
@ -783,7 +782,7 @@ public class ScriptRuntime {
return errorObject;
} else if (!evaluatorException) {
Context.codeBug();
Kit.codeBug();
}
return cx.getWrapFactory().wrap(cx, scope, t, null);
@ -1325,7 +1324,7 @@ public class ScriptRuntime {
return NativeWith.newWithSpecial(cx, scope, args);
}
} else {
Context.codeBug();
Kit.codeBug();
}
if (isNew) {
@ -1893,7 +1892,7 @@ public class ScriptRuntime {
private static ScriptableObject getGlobal(Context cx) {
final String GLOBAL_CLASS = "org.mozilla.javascript.tools.shell.Global";
Class globalClass = classOrNull(GLOBAL_CLASS);
Class globalClass = Kit.classOrNull(GLOBAL_CLASS);
if (globalClass != null) {
try {
Class[] parm = { ScriptRuntime.ContextClass };
@ -2156,46 +2155,6 @@ public class ScriptRuntime {
cx.currentActivation = activation;
}
static Class classOrNull(String className)
{
try {
return Class.forName(className);
} catch (ClassNotFoundException ex) {
} catch (SecurityException ex) {
} catch (LinkageError ex) {
} catch (IllegalArgumentException e) {
// Can be thrown if name has characters that a class name
// can not contain
}
return null;
}
static Class classOrNull(ClassLoader loader, String className)
{
try {
return loader.loadClass(className);
} catch (ClassNotFoundException ex) {
} catch (SecurityException ex) {
} catch (LinkageError ex) {
} catch (IllegalArgumentException e) {
// Can be thrown if name has characters that a class name
// can not contain
}
return null;
}
static Object newInstanceOrNull(Class cl)
{
try {
return cl.newInstance();
} catch (SecurityException x) {
} catch (LinkageError ex) {
} catch (InstantiationException x) {
} catch (IllegalAccessException x) {
}
return null;
}
static boolean hasProp(Scriptable start, String name) {
Scriptable m = start;
do {
@ -2228,30 +2187,6 @@ public class ScriptRuntime {
return Context.reportRuntimeError1(msg, val.getClass().getName());
}
/**
* Split string into array of strings using semicolon as string terminator
* (; after the last string is required).
*/
static String[] splitSC(String s)
{
int count = 0;
for (int cursor = 0; ;) {
cursor = s.indexOf(';', cursor) + 1;
if (cursor <= 0) { break; }
++count;
}
String[] array = new String[count];
count = 0;
for (int cursor = 0; ;) {
int next = s.indexOf(';', cursor);
if (next < 0) { break; }
array[count] = s.substring(cursor, next);
++count;
cursor = next + 1;
}
return array;
}
public static final Object[] emptyArgs = new Object[0];
public static final String[] emptyStrings = new String[0];

Просмотреть файл

@ -290,7 +290,7 @@ public abstract class ScriptableObject implements Scriptable, Serializable,
setterThis = start;
args = new Object[] { actualArg };
} else {
if (start != this) Context.codeBug();
if (start != this) Kit.codeBug();
setterThis = slot.delegateTo;
args = new Object[] { this, actualArg };
}
@ -1593,7 +1593,7 @@ public abstract class ScriptableObject implements Scriptable, Serializable,
if (++i == array.length)
i = 0;
} while (i != start);
if (Context.check && !sawRemoved) Context.codeBug();
if (Context.check && !sawRemoved) Kit.codeBug();
// Table could be full, but with some REMOVED elements.
// Call to addSlot will use a slot currently taken by
// a REMOVED.
@ -1647,7 +1647,7 @@ public abstract class ScriptableObject implements Scriptable, Serializable,
i = 0;
} while (i != start);
// Unreachable code
if (Context.check) Context.codeBug();
if (Context.check) Kit.codeBug();
return null;
}
@ -1742,7 +1742,7 @@ public abstract class ScriptableObject implements Scriptable, Serializable,
}
Slot[] s = slots;
if (s == null) {
if (N != 0) Context.codeBug();
if (N != 0) Kit.codeBug();
out.writeInt(0);
} else {
out.writeInt(s.length);

Просмотреть файл

@ -279,12 +279,12 @@ public class TokenStream {
this.lineno = lineno;
this.flags = 0;
if (sourceReader != null) {
if (sourceString != null) Context.codeBug();
if (sourceString != null) Kit.codeBug();
this.sourceReader = sourceReader;
this.sourceBuffer = new char[512];
this.sourceEnd = 0;
} else {
if (sourceString == null) Context.codeBug();
if (sourceString == null) Kit.codeBug();
this.sourceString = sourceString;
this.sourceEnd = sourceString.length();
}
@ -362,7 +362,7 @@ public class TokenStream {
public final void ungetToken(int tt) {
// Can not unread more then one token
if (this.pushbackToken != Token.EOF && tt != Token.ERROR)
Context.codeBug();
Kit.codeBug();
this.pushbackToken = tt;
tokenno--;
}
@ -1031,7 +1031,7 @@ public class TokenStream {
private void ungetChar(int c) {
// can not unread past across line boundary
if (ungetCursor != 0 && ungetBuffer[ungetCursor - 1] == '\n')
Context.codeBug();
Kit.codeBug();
ungetBuffer[ungetCursor++] = c;
}
@ -1161,7 +1161,7 @@ public class TokenStream {
}
private boolean fillSourceBuffer() throws IOException {
if (sourceString != null) Context.codeBug();
if (sourceString != null) Kit.codeBug();
if (sourceEnd == sourceBuffer.length) {
if (lineStart != 0) {
System.arraycopy(sourceBuffer, lineStart, sourceBuffer, 0,

Просмотреть файл

@ -60,13 +60,13 @@ public class UintMap implements Serializable {
}
public UintMap(int initialCapacity) {
if (initialCapacity < 0) Context.codeBug();
if (initialCapacity < 0) Kit.codeBug();
// Table grow when number of stored keys >= 3/4 of max capacity
int minimalCapacity = initialCapacity * 4 / 3;
int i;
for (i = 2; (1 << i) < minimalCapacity; ++i) { }
power = i;
if (check && power < 2) Context.codeBug();
if (check && power < 2) Kit.codeBug();
}
public boolean isEmpty() {
@ -78,7 +78,7 @@ public class UintMap implements Serializable {
}
public boolean has(int key) {
if (key < 0) Context.codeBug();
if (key < 0) Kit.codeBug();
return 0 <= findIndex(key);
}
@ -87,7 +87,7 @@ public class UintMap implements Serializable {
* @return key object value or null if key is absent
*/
public Object getObject(int key) {
if (key < 0) Context.codeBug();
if (key < 0) Kit.codeBug();
if (values != null) {
int index = findIndex(key);
if (0 <= index) {
@ -102,7 +102,7 @@ public class UintMap implements Serializable {
* @return key integer value or defaultValue if key is absent
*/
public int getInt(int key, int defaultValue) {
if (key < 0) Context.codeBug();
if (key < 0) Kit.codeBug();
int index = findIndex(key);
if (0 <= index) {
if (ivaluesShift != 0) {
@ -120,7 +120,7 @@ public class UintMap implements Serializable {
* @throws RuntimeException if key does not exist
*/
public int getExistingInt(int key) {
if (key < 0) Context.codeBug();
if (key < 0) Kit.codeBug();
int index = findIndex(key);
if (0 <= index) {
if (ivaluesShift != 0) {
@ -129,7 +129,7 @@ public class UintMap implements Serializable {
return 0;
}
// Key must exist
Context.codeBug();
Kit.codeBug();
return 0;
}
@ -138,7 +138,7 @@ public class UintMap implements Serializable {
* If key does not exist, also set its int value to 0.
*/
public void put(int key, Object value) {
if (key < 0) Context.codeBug();
if (key < 0) Kit.codeBug();
int index = ensureIndex(key, false);
if (values == null) {
values = new Object[1 << power];
@ -151,7 +151,7 @@ public class UintMap implements Serializable {
* If key does not exist, also set its object value to null.
*/
public void put(int key, int value) {
if (key < 0) Context.codeBug();
if (key < 0) Kit.codeBug();
int index = ensureIndex(key, true);
if (ivaluesShift == 0) {
int N = 1 << power;
@ -167,7 +167,7 @@ public class UintMap implements Serializable {
}
public void remove(int key) {
if (key < 0) Context.codeBug();
if (key < 0) Kit.codeBug();
int index = findIndex(key);
if (0 <= index) {
keys[index] = DELETED;
@ -234,7 +234,7 @@ public class UintMap implements Serializable {
int n = 0;
do {
if (check) {
if (n >= occupiedCount) Context.codeBug();
if (n >= occupiedCount) Kit.codeBug();
++n;
}
index = (index + step) & mask;
@ -249,8 +249,8 @@ public class UintMap implements Serializable {
// Insert key that is not present to table without deleted entries
// and enough free space
private int insertNewKey(int key) {
if (check && occupiedCount != keyCount) Context.codeBug();
if (check && keyCount == 1 << power) Context.codeBug();
if (check && occupiedCount != keyCount) Kit.codeBug();
if (check && keyCount == 1 << power) Kit.codeBug();
int[] keys = this.keys;
int fraction = key * A;
int index = fraction >>> (32 - power);
@ -259,9 +259,9 @@ public class UintMap implements Serializable {
int step = tableLookupStep(fraction, mask, power);
int firstIndex = index;
do {
if (check && keys[index] == DELETED) Context.codeBug();
if (check && keys[index] == DELETED) Kit.codeBug();
index = (index + step) & mask;
if (check && firstIndex == index) Context.codeBug();
if (check && firstIndex == index) Kit.codeBug();
} while (keys[index] != EMPTY);
}
keys[index] = key;
@ -330,7 +330,7 @@ public class UintMap implements Serializable {
int n = 0;
do {
if (check) {
if (n >= occupiedCount) Context.codeBug();
if (n >= occupiedCount) Kit.codeBug();
++n;
}
index = (index + step) & mask;
@ -344,7 +344,7 @@ public class UintMap implements Serializable {
}
// Inserting of new key
if (check && keys != null && keys[index] != EMPTY)
Context.codeBug();
Kit.codeBug();
if (firstDeleted >= 0) {
index = firstDeleted;
}
@ -628,7 +628,7 @@ public class UintMap implements Serializable {
}
private static void check(boolean condition) {
if (!condition) Context.codeBug();
if (!condition) Kit.codeBug();
}
private static Object writeAndRead(Object obj) {

Просмотреть файл

@ -51,7 +51,7 @@ public final class UniqueTag implements Serializable
public Object readResolve() {
if (_tagId == ID_NOT_FOUND) { return NOT_FOUND; }
else if (_tagId == ID_NULL_VALUE) { return NULL_VALUE; }
Context.codeBug();
Kit.codeBug();
return null;
}
@ -60,7 +60,7 @@ public final class UniqueTag implements Serializable
String name;
if (_tagId == ID_NOT_FOUND) { name = "NOT_FOUND"; }
else if (_tagId == ID_NULL_VALUE) { name = "NULL_VALUE"; }
else { Context.codeBug(); name = null; }
else { Kit.codeBug(); name = null; }
return super.toString()+": "+name;
}

Просмотреть файл

@ -59,7 +59,7 @@ public class WrappedException extends EvaluatorException
static {
// Are we running on a JDK 1.4 or later system?
try {
Class ThrowableClass = ScriptRuntime.classOrNull(
Class ThrowableClass = Kit.classOrNull(
"java.lang.Throwable");
initCauseMethod = ThrowableClass.getMethod("initCause",
new Class[]{ThrowableClass});

Просмотреть файл

@ -944,7 +944,7 @@ public class Codegen extends Interpreter {
private int addNumberConstant(double num)
{
// NaN is provided via ScriptRuntime.NaNobj
if (num != num) Context.codeBug();
if (num != num) Kit.codeBug();
int N = itsConstantListSize;
if (N == 0) {
itsConstantList = new double[128];
@ -2645,7 +2645,7 @@ class BodyCodegen
} else if (exceptionType == WRAPPED_EXCEPTION) {
exceptionName = "org/mozilla/javascript/WrappedException";
} else {
if (exceptionType != ECMAERROR_EXCEPTION) Context.codeBug();
if (exceptionType != ECMAERROR_EXCEPTION) Kit.codeBug();
exceptionName = "org/mozilla/javascript/EcmaError";
}

Просмотреть файл

@ -67,7 +67,7 @@ class OptFunctionNode extends FunctionNode {
void setDirectTargetIndex(int directTargetIndex) {
// One time action
if (directTargetIndex < 0 || this.directTargetIndex >= 0)
Context.codeBug();
Kit.codeBug();
this.directTargetIndex = directTargetIndex;
}

Просмотреть файл

@ -189,7 +189,7 @@ public class Main {
}
if (arg.equals("-sealedlib")) {
// Should already be processed
if (!sealedStdLib) Context.codeBug();
if (!sealedStdLib) Kit.codeBug();
continue;
}
usage(arg);