Few Native* classes are made package private and final. They had been public only for implementation reasons.

This commit is contained in:
igor%mir2.org 2002-01-29 18:40:13 +00:00
parent f28551787a
commit 7ca511bab3
8 changed files with 25 additions and 38 deletions

View File

@ -62,7 +62,7 @@ public class NativeArray extends IdScriptable {
* always gets at least an object back, even when Array == null.
*/
public static void init(Context cx, Scriptable scope, boolean sealed) {
static void init(Context cx, Scriptable scope, boolean sealed) {
NativeArray obj = new NativeArray();
obj.prototypeFlag = true;
obj.addAsPrototype(MAX_PROTOTYPE_ID, cx, scope, sealed);
@ -71,7 +71,7 @@ public class NativeArray extends IdScriptable {
/**
* Zero-parameter constructor: just used to create Array.prototype
*/
public NativeArray() {
private NativeArray() {
dense = null;
this.length = 0;
}

View File

@ -42,21 +42,15 @@ package org.mozilla.javascript;
* See ECMA 15.6.
* @author Norris Boyd
*/
public class NativeBoolean extends IdScriptable {
final class NativeBoolean extends IdScriptable {
public static void init(Context cx, Scriptable scope, boolean sealed) {
NativeBoolean obj = new NativeBoolean();
static void init(Context cx, Scriptable scope, boolean sealed) {
NativeBoolean obj = new NativeBoolean(false);
obj.prototypeFlag = true;
obj.addAsPrototype(MAX_PROTOTYPE_ID, cx, scope, sealed);
}
/**
* Zero-parameter constructor: just used to create Boolean.prototype
*/
public NativeBoolean() {
}
public NativeBoolean(boolean b) {
private NativeBoolean(boolean b) {
booleanValue = b;
}

View File

@ -48,9 +48,9 @@ import java.text.SimpleDateFormat;
* See ECMA 15.9.
* @author Mike McCabe
*/
public class NativeDate extends IdScriptable {
final class NativeDate extends IdScriptable {
public static void init(Context cx, Scriptable scope, boolean sealed) {
static void init(Context cx, Scriptable scope, boolean sealed) {
NativeDate obj = new NativeDate();
obj.prototypeFlag = true;
@ -60,7 +60,7 @@ public class NativeDate extends IdScriptable {
obj.addAsPrototype(MAX_PROTOTYPE_ID, cx, scope, sealed);
}
public NativeDate() {
private NativeDate() {
if (thisTimeZone == null) {
// j.u.TimeZone is synchronized, so setting class statics from it
// should be OK.

View File

@ -43,9 +43,9 @@ package org.mozilla.javascript;
*
* ECMA 15.11
*/
public class NativeError extends IdScriptable {
final class NativeError extends IdScriptable {
public static void init(Context cx, Scriptable scope, boolean sealed) {
static void init(Context cx, Scriptable scope, boolean sealed) {
NativeError obj = new NativeError();
obj.prototypeFlag = true;
obj.messageValue = "";

View File

@ -42,9 +42,9 @@ package org.mozilla.javascript;
* @author Norris Boyd
*/
public class NativeMath extends IdScriptable
final class NativeMath extends IdScriptable
{
public static void init(Context cx, Scriptable scope, boolean sealed) {
static void init(Context cx, Scriptable scope, boolean sealed) {
NativeMath obj = new NativeMath();
obj.setSealFunctionsFlag(sealed);
obj.setFunctionParametrs(cx);

View File

@ -44,11 +44,11 @@ package org.mozilla.javascript;
*
* @author Norris Boyd
*/
public class NativeNumber extends IdScriptable {
final class NativeNumber extends IdScriptable {
private static final int MAX_PRECISION = 100;
public static void init(Context cx, Scriptable scope, boolean sealed) {
static void init(Context cx, Scriptable scope, boolean sealed) {
NativeNumber obj = new NativeNumber();
obj.prototypeFlag = true;
obj.addAsPrototype(MAX_PROTOTYPE_ID, cx, scope, sealed);
@ -57,11 +57,11 @@ public class NativeNumber extends IdScriptable {
/**
* Zero-parameter constructor: just used to create Number.prototype
*/
public NativeNumber() {
private NativeNumber() {
doubleValue = defaultValue;
}
public NativeNumber(double number) {
private NativeNumber(double number) {
doubleValue = number;
}

View File

@ -52,22 +52,15 @@ import java.util.Vector;
* @author Mike McCabe
* @author Norris Boyd
*/
public class NativeString extends IdScriptable {
final class NativeString extends IdScriptable {
public static void init(Context cx, Scriptable scope, boolean sealed) {
NativeString obj = new NativeString();
static void init(Context cx, Scriptable scope, boolean sealed) {
NativeString obj = new NativeString(defaultValue);
obj.prototypeFlag = true;
obj.addAsPrototype(MAX_PROTOTYPE_ID, cx, scope, sealed);
}
/**
* Zero-parameter constructor: just used to create String.prototype
*/
public NativeString() {
string = defaultValue;
}
public NativeString(String s) {
private NativeString(String s) {
string = s;
}

View File

@ -43,9 +43,9 @@ import java.lang.reflect.Method;
* It simply delegates every action to its prototype except
* for operations on its parent.
*/
public class NativeWith implements Scriptable, IdFunctionMaster {
public final class NativeWith implements Scriptable, IdFunctionMaster {
public static void init(Context cx, Scriptable scope, boolean sealed) {
static void init(Context cx, Scriptable scope, boolean sealed) {
NativeWith obj = new NativeWith();
obj.prototypeFlag = true;
@ -60,10 +60,10 @@ public class NativeWith implements Scriptable, IdFunctionMaster {
ScriptableObject.DONTENUM);
}
public NativeWith() {
private NativeWith() {
}
public NativeWith(Scriptable parent, Scriptable prototype) {
NativeWith(Scriptable parent, Scriptable prototype) {
this.parent = parent;
this.prototype = prototype;
}