Removed deprecated wrapper class constructors (new Byte, ..., new Integer, new Double...)
Replaced with valueOf() in order to silence many warnings from modern versions of the JDK
This commit is contained in:
@@ -479,7 +479,7 @@ public class FuncState extends Constants {
|
||||
return ((Integer) h.get(v)).intValue();
|
||||
}
|
||||
final int idx = this.nk;
|
||||
this.h.put(v, new Integer(idx));
|
||||
this.h.put(v, Integer.valueOf(idx));
|
||||
final Prototype f = this.f;
|
||||
if (f.k == null || nk + 1 >= f.k.length)
|
||||
f.k = realloc( f.k, nk*2 + 1 );
|
||||
|
||||
@@ -170,7 +170,7 @@ public class LexState extends Constants {
|
||||
static {
|
||||
for ( int i=0; i<NUM_RESERVED; i++ ) {
|
||||
LuaString ts = (LuaString) LuaValue.valueOf( luaX_tokens[i] );
|
||||
RESERVED.put(ts, new Integer(FIRST_RESERVED+i));
|
||||
RESERVED.put(ts, Integer.valueOf(FIRST_RESERVED+i));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -174,13 +174,13 @@ public class CoerceLuaToJava {
|
||||
|
||||
public Object coerce(LuaValue value) {
|
||||
switch ( targetType ) {
|
||||
case TARGET_TYPE_BYTE: return new Byte( (byte) value.toint() );
|
||||
case TARGET_TYPE_CHAR: return new Character( (char) value.toint() );
|
||||
case TARGET_TYPE_SHORT: return new Short( (short) value.toint() );
|
||||
case TARGET_TYPE_INT: return new Integer( (int) value.toint() );
|
||||
case TARGET_TYPE_LONG: return new Long( (long) value.todouble() );
|
||||
case TARGET_TYPE_FLOAT: return new Float( (float) value.todouble() );
|
||||
case TARGET_TYPE_DOUBLE: return new Double( (double) value.todouble() );
|
||||
case TARGET_TYPE_BYTE: return Byte.valueOf( (byte) value.toint() );
|
||||
case TARGET_TYPE_CHAR: return Character.valueOf( (char) value.toint() );
|
||||
case TARGET_TYPE_SHORT: return Short.valueOf( (short) value.toint() );
|
||||
case TARGET_TYPE_INT: return Integer.valueOf( (int) value.toint() );
|
||||
case TARGET_TYPE_LONG: return Long.valueOf( (long) value.todouble() );
|
||||
case TARGET_TYPE_FLOAT: return Float.valueOf( (float) value.todouble() );
|
||||
case TARGET_TYPE_DOUBLE: return Double.valueOf( (double) value.todouble() );
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
@@ -308,7 +308,7 @@ public class CoerceLuaToJava {
|
||||
public Object coerce(LuaValue value) {
|
||||
switch ( value.type() ) {
|
||||
case LuaValue.TNUMBER:
|
||||
return value.isint()? (Object)new Integer(value.toint()): (Object)new Double(value.todouble());
|
||||
return value.isint()? (Object) Integer.valueOf(value.toint()): (Object) Double.valueOf(value.todouble());
|
||||
case LuaValue.TBOOLEAN:
|
||||
return value.toboolean()? Boolean.TRUE: Boolean.FALSE;
|
||||
case LuaValue.TSTRING:
|
||||
|
||||
@@ -244,8 +244,8 @@ public class LuaScriptEngine extends AbstractScriptEngine implements ScriptEngin
|
||||
case LuaValue.TSTRING: return luajValue.tojstring();
|
||||
case LuaValue.TUSERDATA: return luajValue.checkuserdata(Object.class);
|
||||
case LuaValue.TNUMBER: return luajValue.isinttype()?
|
||||
(Object) new Integer(luajValue.toint()):
|
||||
(Object) new Double(luajValue.todouble());
|
||||
(Object) Integer.valueOf(luajValue.toint()):
|
||||
(Object) Double.valueOf(luajValue.todouble());
|
||||
default: return luajValue;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user