/hg/rhino-tests: Get rid of compiler warnings.
ptisnovs at icedtea.classpath.org
ptisnovs at icedtea.classpath.org
Thu Jun 28 07:09:48 PDT 2012
changeset e5efba84dc1c in /hg/rhino-tests
details: http://icedtea.classpath.org/hg/rhino-tests?cmd=changeset;node=e5efba84dc1c
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Thu Jun 28 16:12:12 2012 +0200
Get rid of compiler warnings.
diffstat:
ChangeLog | 10 ++++++++
Makefile | 1 +
src/org/RhinoTests/InvocableTest.java | 19 +++++++++-------
src/org/RhinoTests/JavaScriptsTest.java | 28 +++++++++++++-----------
src/org/RhinoTests/ScriptEngineFactoryTest.java | 2 +
src/org/RhinoTests/ScriptEngineManagerTest.java | 16 ++++++++-----
src/org/RhinoTests/ScriptEngineTest.java | 2 +
src/org/RhinoTests/ScriptExceptionTest.java | 2 +
8 files changed, 53 insertions(+), 27 deletions(-)
diffs (322 lines):
diff -r 2398a93312b1 -r e5efba84dc1c ChangeLog
--- a/ChangeLog Wed Jun 27 11:21:42 2012 +0200
+++ b/ChangeLog Thu Jun 28 16:12:12 2012 +0200
@@ -1,3 +1,13 @@
+2012-06-28 Pavel Tisnovsky <ptisnovs at redhat.com>
+
+ * src/org/RhinoTests/InvocableTest.java:
+ * src/org/RhinoTests/JavaScriptsTest.java:
+ * src/org/RhinoTests/ScriptEngineFactoryTest.java:
+ * src/org/RhinoTests/ScriptEngineManagerTest.java:
+ * src/org/RhinoTests/ScriptEngineTest.java:
+ * src/org/RhinoTests/ScriptExceptionTest.java:
+ Get rid of compiler warnings.
+
2012-06-27 Pavel Tisnovsky <ptisnovs at redhat.com>
* Makefile:
diff -r 2398a93312b1 -r e5efba84dc1c Makefile
--- a/Makefile Wed Jun 27 11:21:42 2012 +0200
+++ b/Makefile Thu Jun 28 16:12:12 2012 +0200
@@ -40,6 +40,7 @@
BUILD_DIR=build
SCRIPTS=scripts
OUTPUT_DIR=output
+REPORT_DIR=reports
LOGS_DIR=logs
TEMPLATE_DIR=templates
JAVAC=javac
diff -r 2398a93312b1 -r e5efba84dc1c src/org/RhinoTests/InvocableTest.java
--- a/src/org/RhinoTests/InvocableTest.java Wed Jun 27 11:21:42 2012 +0200
+++ b/src/org/RhinoTests/InvocableTest.java Thu Jun 28 16:12:12 2012 +0200
@@ -70,6 +70,8 @@
@Override
protected void tearDown() {
+ // this block could be empty
+ return;
}
/**
@@ -164,7 +166,7 @@
System.out.println("\ttesting property " + method);
Boolean result = (Boolean) this.invocableEngine.invokeFunction(
"checkObjectProperty", new java.awt.Color(0), method);
- assertTrue(result, "invalid result: " + result);
+ assertTrue(result.booleanValue(), "invalid result: " + result);
}
}
@@ -185,7 +187,7 @@
"}";
this.scriptEngine.eval(script);
Boolean result = (Boolean)this.invocableEngine.invokeFunction("checkObjectProperty", new TestClass(), "getValue");
- assertTrue(result, "invalid result: " + result);
+ assertTrue(result.booleanValue(), "invalid result: " + result);
}
/**
@@ -193,6 +195,7 @@
*
* @throws Exception thrown if this test case fails.
*/
+ @SuppressWarnings("boxing")
protected void testInvokeFunctionWhichReturnsBoolean() throws Exception {
final String script =
"function booleanTest(x, y) {" +
@@ -226,12 +229,12 @@
"}";
this.scriptEngine.eval(script);
Double result;
- result = (Double)this.invocableEngine.invokeFunction("plus", 1.2, 3.4);
- assertTrue(result == 4.6, "function returns incorrect value " + result);
- result = (Double)this.invocableEngine.invokeFunction("plus", 0, 1.1);
- assertTrue(result == 1.1, "function returns incorrect value " + result);
- result = (Double)this.invocableEngine.invokeFunction("plus", -1.234, 1.234);
- assertTrue(result == 0, "function returns incorrect value " + result);
+ result = (Double)this.invocableEngine.invokeFunction("plus", Double.valueOf(1.2), Double.valueOf(3.4));
+ assertTrue(result.doubleValue() == 4.6, "function returns incorrect value " + result);
+ result = (Double)this.invocableEngine.invokeFunction("plus", Double.valueOf(0), Double.valueOf(1.1));
+ assertTrue(result.doubleValue() == 1.1, "function returns incorrect value " + result);
+ result = (Double)this.invocableEngine.invokeFunction("plus", Double.valueOf(-1.234), Double.valueOf(1.234));
+ assertTrue(result.doubleValue() == 0, "function returns incorrect value " + result);
}
/**
diff -r 2398a93312b1 -r e5efba84dc1c src/org/RhinoTests/JavaScriptsTest.java
--- a/src/org/RhinoTests/JavaScriptsTest.java Wed Jun 27 11:21:42 2012 +0200
+++ b/src/org/RhinoTests/JavaScriptsTest.java Thu Jun 28 16:12:12 2012 +0200
@@ -70,6 +70,8 @@
@Override
protected void tearDown() {
+ // this block could be empty
+ return;
}
/**
@@ -437,7 +439,7 @@
* @throws Exception this exception is thrown when this test case failed.
*/
protected void testRunSimpleScriptReturnNull() throws Exception {
- Object result = (Object)this.scriptEngine.eval("null;");
+ Object result = this.scriptEngine.eval("null;");
assertNull(result, "null not returned as expected");
}
@@ -447,7 +449,7 @@
* @throws Exception this exception is thrown when this test case failed.
*/
protected void testRunSimpleScriptReturnUndefined() throws Exception {
- Object result = (Object)this.scriptEngine.eval("undefined;");
+ Object result = this.scriptEngine.eval("undefined;");
assertNull(result, "null not returned as expected");
}
@@ -457,7 +459,7 @@
* @throws Exception this exception is thrown when this test case failed.
*/
protected void testRunSimpleScriptReturnTypeBoolean1() throws Exception {
- Object result = (Object)this.scriptEngine.eval("!false;");
+ Object result = this.scriptEngine.eval("!false;");
assertType(result, java.lang.Boolean.class, result.getClass().getName() + " is not expected class");
}
@@ -467,7 +469,7 @@
* @throws Exception this exception is thrown when this test case failed.
*/
protected void testRunSimpleScriptReturnTypeBoolean2() throws Exception {
- Object result = (Object)this.scriptEngine.eval("!true;");
+ Object result = this.scriptEngine.eval("!true;");
assertType(result, java.lang.Boolean.class, result.getClass().getName() + " is not expected class");
}
@@ -477,7 +479,7 @@
* @throws Exception this exception is thrown when this test case failed.
*/
protected void testRunSimpleScriptReturnTypeBoolean3() throws Exception {
- Object result = (Object)this.scriptEngine.eval("true && false;");
+ Object result = this.scriptEngine.eval("true && false;");
assertType(result, java.lang.Boolean.class, result.getClass().getName() + " is not expected class");
}
@@ -487,7 +489,7 @@
* @throws Exception this exception is thrown when this test case failed.
*/
protected void testRunSimpleScriptReturnTypeBoolean4() throws Exception {
- Object result = (Object)this.scriptEngine.eval("true || false;");
+ Object result = this.scriptEngine.eval("true || false;");
assertType(result, java.lang.Boolean.class, result.getClass().getName() + " is not expected class");
}
@@ -497,7 +499,7 @@
* @throws Exception this exception is thrown when this test case failed.
*/
protected void testRunSimpleScriptReturnTypeInteger1() throws Exception {
- Object result = (Object)this.scriptEngine.eval("42;");
+ Object result = this.scriptEngine.eval("42;");
assertType(result, java.lang.Integer.class, result.getClass().getName() + " is not expected class");
}
@@ -507,7 +509,7 @@
* @throws Exception this exception is thrown when this test case failed.
*/
protected void testRunSimpleScriptReturnTypeInteger2() throws Exception {
- Object result = (Object)this.scriptEngine.eval("((42));");
+ Object result = this.scriptEngine.eval("((42));");
assertType(result, java.lang.Integer.class, result.getClass().getName() + " is not expected class");
}
@@ -517,7 +519,7 @@
* @throws Exception this exception is thrown when this test case failed.
*/
protected void testRunSimpleScriptReturnTypeInteger3() throws Exception {
- Object result = (Object)this.scriptEngine.eval("1+2;");
+ Object result = this.scriptEngine.eval("1+2;");
assertType(result, java.lang.Integer.class, result.getClass().getName() + " is not expected class");
}
@@ -527,7 +529,7 @@
* @throws Exception this exception is thrown when this test case failed.
*/
protected void testRunSimpleScriptReturnTypeDouble1() throws Exception {
- Object result = (Object)this.scriptEngine.eval("1.2+3.4;");
+ Object result = this.scriptEngine.eval("1.2+3.4;");
assertType(result, java.lang.Double.class, result.getClass().getName() + " is not expected class");
}
@@ -537,7 +539,7 @@
* @throws Exception this exception is thrown when this test case failed.
*/
protected void testRunSimpleScriptReturnTypeDouble2() throws Exception {
- Object result = (Object)this.scriptEngine.eval("1/2;");
+ Object result = this.scriptEngine.eval("1/2;");
assertType(result, java.lang.Double.class, result.getClass().getName() + " is not expected class");
}
@@ -547,7 +549,7 @@
* @throws Exception this exception is thrown when this test case failed.
*/
protected void testRunSimpleScriptReturnTypeString1() throws Exception {
- Object result = (Object)this.scriptEngine.eval("'hello' + ' ' + 'world';");
+ Object result = this.scriptEngine.eval("'hello' + ' ' + 'world';");
assertType(result, java.lang.String.class, result.getClass().getName() + " is not expected class");
}
@@ -557,7 +559,7 @@
* @throws Exception this exception is thrown when this test case failed.
*/
protected void testRunSimpleScriptReturnTypeString2() throws Exception {
- Object result = (Object)this.scriptEngine.eval("'1' + '2';");
+ Object result = this.scriptEngine.eval("'1' + '2';");
assertType(result, java.lang.String.class, result.getClass().getName() + " is not expected class");
}
diff -r 2398a93312b1 -r e5efba84dc1c src/org/RhinoTests/ScriptEngineFactoryTest.java
--- a/src/org/RhinoTests/ScriptEngineFactoryTest.java Wed Jun 27 11:21:42 2012 +0200
+++ b/src/org/RhinoTests/ScriptEngineFactoryTest.java Thu Jun 28 16:12:12 2012 +0200
@@ -62,6 +62,8 @@
@Override
protected void tearDown() {
+ // empty block
+ return;
}
/**
diff -r 2398a93312b1 -r e5efba84dc1c src/org/RhinoTests/ScriptEngineManagerTest.java
--- a/src/org/RhinoTests/ScriptEngineManagerTest.java Wed Jun 27 11:21:42 2012 +0200
+++ b/src/org/RhinoTests/ScriptEngineManagerTest.java Thu Jun 28 16:12:12 2012 +0200
@@ -60,10 +60,14 @@
@Override
protected void setUp(String[] args) {
+ // empty block
+ return;
}
@Override
protected void tearDown() {
+ // empty block
+ return;
}
/**
@@ -218,7 +222,7 @@
*/
protected void testScriptEngineManagerPutGetBoolean() throws Exception {
ScriptEngineManager manager = new ScriptEngineManager();
- manager.put("foo", false);
+ manager.put("foo", Boolean.FALSE);
Object o = manager.get("foo");
assertNotNull(o, "get(key) returns null");
assertEquals(o, Boolean.valueOf(false), "get(key) does not return correct value");
@@ -232,7 +236,7 @@
*/
protected void testScriptEngineManagerPutGetShort() throws Exception {
ScriptEngineManager manager = new ScriptEngineManager();
- manager.put("foo", (short)42);
+ manager.put("foo", Short.valueOf((short)42));
Object o = manager.get("foo");
assertNotNull(o, "get(key) returns null");
assertEquals(o, Short.valueOf((short)42), "get(key) does not return correct value");
@@ -246,7 +250,7 @@
*/
protected void testScriptEngineManagerPutGetInteger() throws Exception {
ScriptEngineManager manager = new ScriptEngineManager();
- manager.put("foo", 42);
+ manager.put("foo", Integer.valueOf(42));
Object o = manager.get("foo");
assertNotNull(o, "get(key) returns null");
assertEquals(o, Integer.valueOf(42), "get(key) does not return correct value");
@@ -260,7 +264,7 @@
*/
protected void testScriptEngineManagerPutGetLong() throws Exception {
ScriptEngineManager manager = new ScriptEngineManager();
- manager.put("foo", 42L);
+ manager.put("foo", Long.valueOf(42L));
Object o = manager.get("foo");
assertNotNull(o, "get(key) returns null");
assertEquals(o, Long.valueOf(42), "get(key) does not return correct value");
@@ -274,7 +278,7 @@
*/
protected void testScriptEngineManagerPutGetFloat() throws Exception {
ScriptEngineManager manager = new ScriptEngineManager();
- manager.put("foo", 3.14f);
+ manager.put("foo", Float.valueOf(3.14f));
Object o = manager.get("foo");
assertNotNull(o, "get(key) returns null");
assertEquals(o, Float.valueOf(3.14f), "get(key) does not return correct value");
@@ -288,7 +292,7 @@
*/
protected void testScriptEngineManagerPutGetDouble() throws Exception {
ScriptEngineManager manager = new ScriptEngineManager();
- manager.put("foo", 1.0/3);
+ manager.put("foo", Double.valueOf(1.0/3));
Object o = manager.get("foo");
assertNotNull(o, "get(key) returns null");
assertEquals(o, Double.valueOf(1.0/3), "get(key) does not return correct value");
diff -r 2398a93312b1 -r e5efba84dc1c src/org/RhinoTests/ScriptEngineTest.java
--- a/src/org/RhinoTests/ScriptEngineTest.java Wed Jun 27 11:21:42 2012 +0200
+++ b/src/org/RhinoTests/ScriptEngineTest.java Thu Jun 28 16:12:12 2012 +0200
@@ -64,6 +64,8 @@
@Override
protected void tearDown() {
+ // empty block
+ return;
}
/**
diff -r 2398a93312b1 -r e5efba84dc1c src/org/RhinoTests/ScriptExceptionTest.java
--- a/src/org/RhinoTests/ScriptExceptionTest.java Wed Jun 27 11:21:42 2012 +0200
+++ b/src/org/RhinoTests/ScriptExceptionTest.java Thu Jun 28 16:12:12 2012 +0200
@@ -68,6 +68,8 @@
@Override
protected void tearDown() {
+ // empty block
+ return;
}
/**
More information about the distro-pkg-dev
mailing list