More warnings fixed.

git-svn-id: svn://10.0.0.236/trunk@248540 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
nboyd%atg.com
2008-03-25 14:32:28 +00:00
parent cb5a8c5385
commit d5ed769a56
26 changed files with 92 additions and 20 deletions

View File

@@ -3011,6 +3011,7 @@ final class FieldOrMethodRef
this.type = type;
}
@Override
public boolean equals(Object obj)
{
if (!(obj instanceof FieldOrMethodRef)) { return false; }
@@ -3020,6 +3021,7 @@ final class FieldOrMethodRef
&& type.equals(x.type);
}
@Override
public int hashCode()
{
if (hashCode == -1) {

View File

@@ -67,6 +67,7 @@ public class DefiningClassLoader extends ClassLoader
resolveClass(cl);
}
@Override
public Class<?> loadClass(String name, boolean resolve)
throws ClassNotFoundException
{

View File

@@ -250,6 +250,7 @@ public class FunctionObject extends BaseFunction
* (number of parameters of the method, or 1 if the method is a "varargs"
* form).
*/
@Override
public int getArity() {
return parmsLength < 0 ? 1 : parmsLength;
}
@@ -257,10 +258,12 @@ public class FunctionObject extends BaseFunction
/**
* Return the same value as {@link #getArity()}.
*/
@Override
public int getLength() {
return getArity();
}
@Override
public String getFunctionName()
{
return (functionName == null) ? "" : functionName;
@@ -399,6 +402,7 @@ public class FunctionObject extends BaseFunction
* @see org.mozilla.javascript.Function#call(
* Context, Scriptable, Scriptable, Object[])
*/
@Override
public Object call(Context cx, Scriptable scope, Scriptable thisObj,
Object[] args)
{
@@ -500,6 +504,7 @@ public class FunctionObject extends BaseFunction
* Return null to indicate that the call method should be used to create
* new objects.
*/
@Override
public Scriptable createObject(Context cx, Scriptable scope) {
if (member.isCtor() || parmsLength == VARARGS_CTOR) {
return null;

View File

@@ -71,6 +71,7 @@ public final class JavaAdapter implements IdFunctionCall
this.names = names;
}
@Override
public boolean equals(Object obj)
{
if (!(obj instanceof JavaAdapterSignature))
@@ -97,6 +98,7 @@ public final class JavaAdapter implements IdFunctionCall
return true;
}
@Override
public int hashCode()
{
return superClass.hashCode()

View File

@@ -333,7 +333,7 @@ class JavaMembers
{
Map<MethodSignature,Method> map = new HashMap<MethodSignature,Method>();
discoverAccessibleMethods(clazz, map, includeProtected, includePrivate);
return (Method[])map.values().toArray(new Method[map.size()]);
return map.values().toArray(new Method[map.size()]);
}
private static void discoverAccessibleMethods(Class<?> clazz,
@@ -423,6 +423,7 @@ class JavaMembers
this(method.getName(), method.getParameterTypes());
}
@Override
public boolean equals(Object o)
{
if(o instanceof MethodSignature)
@@ -433,6 +434,7 @@ class JavaMembers
return false;
}
@Override
public int hashCode()
{
return name.hashCode() ^ args.length;
@@ -896,6 +898,7 @@ class FieldAndMethods extends NativeJavaMethod
setPrototype(ScriptableObject.getFunctionPrototype(scope));
}
@Override
public Object getDefaultValue(Class<?> hint)
{
if (hint == ScriptRuntime.FunctionClass)

View File

@@ -73,6 +73,7 @@ public class JavaScriptException extends RhinoException
this.value = value;
}
@Override
public String details()
{
try {

View File

@@ -403,6 +403,7 @@ public class Kit
this.key2 = key2;
}
@Override
public boolean equals(Object anotherObj)
{
if (!(anotherObj instanceof ComplexKey))
@@ -411,6 +412,7 @@ public class Kit
return key1.equals(another.key1) && key2.equals(another.key2);
}
@Override
public int hashCode()
{
if (hash == 0) {

View File

@@ -147,6 +147,7 @@ final class MemberBox implements Serializable
return sb.toString();
}
@Override
public String toString()
{
return memberObject.toString();

View File

@@ -100,6 +100,7 @@ public class NativeArray extends IdScriptableObject
length = array.length;
}
@Override
public String getClassName()
{
return "Array";
@@ -109,11 +110,13 @@ public class NativeArray extends IdScriptableObject
Id_length = 1,
MAX_INSTANCE_ID = 1;
@Override
protected int getMaxInstanceId()
{
return MAX_INSTANCE_ID;
}
@Override
protected int findInstanceIdInfo(String s)
{
if (s.equals("length")) {
@@ -122,12 +125,14 @@ public class NativeArray extends IdScriptableObject
return super.findInstanceIdInfo(s);
}
@Override
protected String getInstanceIdName(int id)
{
if (id == Id_length) { return "length"; }
return super.getInstanceIdName(id);
}
@Override
protected Object getInstanceIdValue(int id)
{
if (id == Id_length) {
@@ -136,6 +141,7 @@ public class NativeArray extends IdScriptableObject
return super.getInstanceIdValue(id);
}
@Override
protected void setInstanceIdValue(int id, Object value)
{
if (id == Id_length) {
@@ -144,6 +150,7 @@ public class NativeArray extends IdScriptableObject
super.setInstanceIdValue(id, value);
}
@Override
protected void fillConstructorProperties(IdFunctionObject ctor)
{
addIdFunctionProperty(ctor, ARRAY_TAG, ConstructorId_join,
@@ -183,6 +190,7 @@ public class NativeArray extends IdScriptableObject
super.fillConstructorProperties(ctor);
}
@Override
protected void initPrototypeId(int id)
{
String s;
@@ -214,6 +222,7 @@ public class NativeArray extends IdScriptableObject
initPrototypeMethod(ARRAY_TAG, id, s, arity);
}
@Override
public Object execIdCall(IdFunctionObject f, Context cx, Scriptable scope,
Scriptable thisObj, Object[] args)
{
@@ -316,6 +325,7 @@ public class NativeArray extends IdScriptableObject
}
}
@Override
public Object get(int index, Scriptable start)
{
if (!denseOnly && isGetterOrSetter(null, index, false))
@@ -325,6 +335,7 @@ public class NativeArray extends IdScriptableObject
return super.get(index, start);
}
@Override
public boolean has(int index, Scriptable start)
{
if (!denseOnly && isGetterOrSetter(null, index, false))
@@ -352,6 +363,7 @@ public class NativeArray extends IdScriptableObject
return -1;
}
@Override
public void put(String id, Scriptable start, Object value)
{
super.put(id, start, value);
@@ -382,6 +394,7 @@ public class NativeArray extends IdScriptableObject
return true;
}
@Override
public void put(int index, Scriptable start, Object value)
{
if (start == this && !isSealed() && dense != null && 0 <= index &&
@@ -412,6 +425,7 @@ public class NativeArray extends IdScriptableObject
}
}
@Override
public void delete(int index)
{
if (dense != null && 0 <= index && index < dense.length &&
@@ -423,6 +437,7 @@ public class NativeArray extends IdScriptableObject
}
}
@Override
public Object[] getIds()
{
Object[] superIds = super.getIds();
@@ -454,6 +469,7 @@ public class NativeArray extends IdScriptableObject
return ids;
}
@Override
public Object getDefaultValue(Class<?> hint)
{
if (hint == ScriptRuntime.NumberClass) {
@@ -1599,6 +1615,7 @@ public class NativeArray extends IdScriptableObject
// #string_id_map#
@Override
protected int findPrototypeId(String s)
{
int id;

View File

@@ -78,6 +78,7 @@ public class NativeJavaClass extends NativeJavaObject implements Function
initMembers();
}
@Override
protected void initMembers() {
Class<?> cl = (Class<?>)javaObject;
members = JavaMembers.lookupClass(parent, cl, cl, false);
@@ -85,14 +86,17 @@ public class NativeJavaClass extends NativeJavaObject implements Function
= members.getFieldAndMethodsObjects(this, cl, true);
}
@Override
public String getClassName() {
return "JavaClass";
}
@Override
public boolean has(String name, Scriptable start) {
return members.has(name, true) || javaClassPropertyName.equals(name);
}
@Override
public Object get(String name, Scriptable start) {
// When used as a constructor, ScriptRuntime.newObject() asks
// for our prototype to create an object of the correct type.
@@ -131,10 +135,12 @@ public class NativeJavaClass extends NativeJavaObject implements Function
throw members.reportMemberNotFound(name);
}
@Override
public void put(String name, Scriptable start, Object value) {
members.put(this, name, javaObject, value, true);
}
@Override
public Object[] getIds() {
return members.getIds(true);
}
@@ -143,6 +149,7 @@ public class NativeJavaClass extends NativeJavaObject implements Function
return (Class<?>) super.unwrap();
}
@Override
public Object getDefaultValue(Class<?> hint) {
if (hint == null || hint == ScriptRuntime.StringClass)
return this.toString();
@@ -277,6 +284,7 @@ public class NativeJavaClass extends NativeJavaObject implements Function
return cx.getWrapFactory().wrapNewObject(cx, topLevel, instance);
}
@Override
public String toString() {
return "[JavaClass " + getClassObject().getName() + "]";
}
@@ -289,6 +297,7 @@ public class NativeJavaClass extends NativeJavaObject implements Function
* name conflicts between java.lang.Class's methods and the
* static methods exposed by a JavaNativeClass.
*/
@Override
public boolean hasInstance(Scriptable value) {
if (value instanceof Wrapper &&

View File

@@ -65,18 +65,21 @@ public class NativeJavaConstructor extends BaseFunction
this.ctor = ctor;
}
@Override
public Object call(Context cx, Scriptable scope, Scriptable thisObj,
Object[] args)
{
return NativeJavaClass.constructSpecific(cx, scope, args, ctor);
}
@Override
public String getFunctionName()
{
String sig = JavaMembers.liveConnectSignature(ctor.argTypes);
return "<init>".concat(sig);
}
@Override
public String toString()
{
return "[JavaConstructor " + ctor.getName() + "]";

View File

@@ -74,6 +74,7 @@ public class NativeJavaMethod extends BaseFunction
this(new MemberBox(method), name);
}
@Override
public String getFunctionName()
{
return functionName;
@@ -117,6 +118,7 @@ public class NativeJavaMethod extends BaseFunction
return sig.toString();
}
@Override
String decompile(int indent, int flags)
{
StringBuffer sb = new StringBuffer();
@@ -132,6 +134,7 @@ public class NativeJavaMethod extends BaseFunction
return sb.toString();
}
@Override
public String toString()
{
StringBuffer sb = new StringBuffer();
@@ -146,6 +149,7 @@ public class NativeJavaMethod extends BaseFunction
return sb.toString();
}
@Override
public Object call(Context cx, Scriptable scope, Scriptable thisObj,
Object[] args)
{

View File

@@ -81,30 +81,37 @@ public class NativeJavaPackage extends ScriptableObject
Context.getCurrentContext().getApplicationClassLoader());
}
@Override
public String getClassName() {
return "JavaPackage";
}
@Override
public boolean has(String id, Scriptable start) {
return true;
}
@Override
public boolean has(int index, Scriptable start) {
return false;
}
@Override
public void put(String id, Scriptable start, Object value) {
// Can't add properties to Java packages. Sorry.
}
@Override
public void put(int index, Scriptable start, Object value) {
throw Context.reportRuntimeError0("msg.pkg.int");
}
@Override
public Object get(String id, Scriptable start) {
return getPkgProperty(id, start, true);
}
@Override
public Object get(int index, Scriptable start) {
return NOT_FOUND;
}
@@ -174,14 +181,17 @@ public class NativeJavaPackage extends ScriptableObject
return newValue;
}
@Override
public Object getDefaultValue(Class<?> ignored) {
return toString();
}
@Override
public String toString() {
return "[JavaPackage " + packageName + "]";
}
@Override
public boolean equals(Object obj) {
if(obj instanceof NativeJavaPackage) {
NativeJavaPackage njp = (NativeJavaPackage)obj;
@@ -190,6 +200,7 @@ public class NativeJavaPackage extends ScriptableObject
return false;
}
@Override
public int hashCode() {
return packageName.hashCode() ^ (classLoader == null ? 0 : classLoader.hashCode());
}

View File

@@ -1358,8 +1358,6 @@ public class Parser
* statement.
* @param inFor true if we are currently in the midst of the init
* clause of a for.
* @param inStatement true if called in a statement (as opposed to an
* expression) context
* @param declType A token value: either VAR, CONST, or LET depending on
* context.
* @return The parsed statement

View File

@@ -72,6 +72,7 @@ public class PolicySecurityController extends SecurityController
callers =
new WeakHashMap<CodeSource,Map<ClassLoader,SoftReference<SecureCaller>>>();
@Override
public Class<?> getStaticSecurityDomainClassInternal() {
return CodeSource.class;
}
@@ -98,6 +99,7 @@ public class PolicySecurityController extends SecurityController
}
}
@Override
public GeneratedClassLoader createClassLoader(final ClassLoader parent,
final Object securityDomain)
{
@@ -111,6 +113,7 @@ public class PolicySecurityController extends SecurityController
});
}
@Override
public Object getDynamicSecurityDomain(Object securityDomain)
{
// No separate notion of dynamic security domain - just return what was
@@ -118,6 +121,7 @@ public class PolicySecurityController extends SecurityController
return securityDomain;
}
@Override
public Object callWithDomain(final Object securityDomain, final Context cx,
Callable callable, Scriptable scope, Scriptable thisObj,
Object[] args)
@@ -143,7 +147,7 @@ public class PolicySecurityController extends SecurityController
synchronized (classLoaderMap) {
SoftReference<SecureCaller> ref = classLoaderMap.get(classLoader);
if (ref != null) {
caller = (SecureCaller)ref.get();
caller = ref.get();
} else {
caller = null;
}

View File

@@ -176,7 +176,7 @@ public class ScriptOrFnNode extends Node.Scope {
// symbol table. Can't just work from symbolTable map since
// we need to retain duplicate parameters.
for (int i=0; i < symbols.size(); i++) {
Symbol symbol = (Symbol) symbols.get(i);
Symbol symbol = symbols.get(i);
if (symbol.containingTable == this) {
newSymbols.add(symbol);
}
@@ -187,7 +187,7 @@ public class ScriptOrFnNode extends Node.Scope {
variableNames = new String[symbols.size()];
isConsts = new boolean[symbols.size()];
for (int i=0; i < symbols.size(); i++) {
Symbol symbol = (Symbol) symbols.get(i);
Symbol symbol = symbols.get(i);
variableNames[i] = symbol.name;
isConsts[i] = symbol.declType == Token.CONST;
symbol.index = i;

View File

@@ -98,7 +98,7 @@ public abstract class SecureCaller
{
SoftReference<SecureCaller> ref = classLoaderMap.get(classLoader);
if (ref != null) {
caller = (SecureCaller)ref.get();
caller = ref.get();
} else {
caller = null;
}

View File

@@ -81,6 +81,7 @@ class SpecialRef extends Ref
return new SpecialRef(target, type, name);
}
@Override
public Object get(Context cx)
{
switch (type) {
@@ -95,6 +96,7 @@ class SpecialRef extends Ref
}
}
@Override
public Object set(Context cx, Object value)
{
switch (type) {
@@ -132,6 +134,7 @@ class SpecialRef extends Ref
}
}
@Override
public boolean has(Context cx)
{
if (type == SPECIAL_NONE) {
@@ -140,6 +143,7 @@ class SpecialRef extends Ref
return true;
}
@Override
public boolean delete(Context cx)
{
if (type == SPECIAL_NONE) {

View File

@@ -71,6 +71,7 @@ public class Synchronizer extends Delegator {
/**
* @see org.mozilla.javascript.Function#call
*/
@Override
public Object call(Context cx, Scriptable scope, Scriptable thisObj,
Object[] args)
{

View File

@@ -199,8 +199,7 @@ class Block
|| (blockEndNodeType == Token.IFEQ)
|| (blockEndNodeType == Token.GOTO) ) {
Node target = ((Node.Jump)blockEndNode).target;
FatBlock branchTargetBlock
= (FatBlock)(theTargetBlocks.get(target));
FatBlock branchTargetBlock = theTargetBlocks.get(target);
target.putProp(Node.TARGETBLOCK_PROP,
branchTargetBlock.realBlock);
fb.addSuccessor(branchTargetBlock);

View File

@@ -1805,8 +1805,8 @@ class BodyCodegen
if (liveLocals != null) {
ArrayList<Node> nodes = ((FunctionNode)scriptOrFn).getResumptionPoints();
for (int i = 0; i < nodes.size(); i++) {
Node node = (Node) nodes.get(i);
int[] live = (int [])liveLocals.get(node);
Node node = nodes.get(i);
int[] live = liveLocals.get(node);
if (live != null) {
cfw.markTableSwitchCase(generatorSwitch,
getNextGeneratorState(node));
@@ -1827,8 +1827,7 @@ class BodyCodegen
if (finallys != null) {
for (Node n: finallys.keySet()) {
if (n.getType() == Token.FINALLY) {
FinallyReturnPoint ret =
(FinallyReturnPoint)finallys.get(n);
FinallyReturnPoint ret = finallys.get(n);
// the finally will jump here
cfw.markLabel(ret.tableLabel, (short)1);
@@ -1841,7 +1840,7 @@ class BodyCodegen
// generate gotos back to the JSR location
cfw.markTableSwitchCase(startSwitch, c);
cfw.add(ByteCode.GOTO,
((Integer)ret.jsrPoints.get(i)).intValue());
ret.jsrPoints.get(i).intValue());
c++;
}
}
@@ -2160,8 +2159,7 @@ class BodyCodegen
cfw.addALoad(finallyRegister);
cfw.add(ByteCode.CHECKCAST, "java/lang/Integer");
generateIntegerUnwrap();
FinallyReturnPoint ret =
(FinallyReturnPoint)finallys.get(node);
FinallyReturnPoint ret = finallys.get(node);
ret.tableLabel = cfw.acquireLabel();
cfw.add(ByteCode.GOTO, ret.tableLabel);
} else {
@@ -3095,8 +3093,7 @@ class BodyCodegen
}
private void addGotoWithReturn(Node target) {
FinallyReturnPoint ret =
(FinallyReturnPoint)finallys.get(target);
FinallyReturnPoint ret = finallys.get(target);
cfw.addLoadConstant(ret.jsrPoints.size());
addGoto(target, ByteCode.GOTO);
int retLabel = cfw.acquireLabel();

View File

@@ -89,6 +89,7 @@ class DataFlowBitSet {
itsBits[i] |= b.itsBits[i];
}
@Override
public String toString()
{
StringBuffer sb = new StringBuffer();

View File

@@ -56,11 +56,13 @@ class OptTransformer extends NodeTransformer {
this.directCallTargets = directCallTargets;
}
@Override
protected void visitNew(Node node, ScriptOrFnNode tree) {
detectDirectCall(node, tree);
super.visitNew(node, tree);
}
@Override
protected void visitCall(Node node, ScriptOrFnNode tree) {
detectDirectCall(node, tree);
super.visitCall(node, tree);
@@ -106,7 +108,7 @@ class OptTransformer extends NodeTransformer {
}
if (targetName != null) {
OptFunctionNode ofn;
ofn = (OptFunctionNode)possibleDirectCalls.get(targetName);
ofn = possibleDirectCalls.get(targetName);
if (ofn != null
&& argCount == ofn.fnode.getParamCount()
&& !ofn.fnode.requiresActivation())

View File

@@ -75,6 +75,7 @@ public class ScriptableInputStream extends ObjectInputStream {
}
}
@Override
protected Class<?> resolveClass(ObjectStreamClass desc)
throws IOException, ClassNotFoundException
{
@@ -89,6 +90,7 @@ public class ScriptableInputStream extends ObjectInputStream {
return super.resolveClass(desc);
}
@Override
protected Object resolveObject(Object obj)
throws IOException
{

View File

@@ -195,9 +195,11 @@ public class ScriptableOutputStream extends ObjectOutputStream {
private String name;
}
@Override
protected Object replaceObject(Object obj) throws IOException
{
String name = (String) table.get(obj);
if (false) throw new IOException(); // suppress warning
String name = table.get(obj);
if (name == null)
return obj;
return new PendingLookup(name);

View File

@@ -56,6 +56,7 @@ public abstract class XMLLib
public static abstract class Factory {
public static Factory create(final String className) {
return new Factory() {
@Override
public String getImplementationClassName() {
return className;
}