/hg/rhino-tests: Fixed compiler warning caused by missed generic...

ptisnovs at icedtea.classpath.org ptisnovs at icedtea.classpath.org
Thu Sep 6 06:36:52 PDT 2012


changeset a5384678025c in /hg/rhino-tests
details: http://icedtea.classpath.org/hg/rhino-tests?cmd=changeset;node=a5384678025c
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Thu Sep 06 15:39:22 2012 +0200

	Fixed compiler warning caused by missed generics info.


diffstat:

 ChangeLog                                             |  12 ++++++++++++
 src/org/RhinoTests/AbstractScriptEngineClassTest.java |  12 ++++++------
 src/org/RhinoTests/CompiledScriptClassTest.java       |   4 ++--
 src/org/RhinoTests/ScriptContextClassTest.java        |   1 +
 src/org/RhinoTests/ScriptEngineClassTest.java         |   1 +
 src/org/RhinoTests/ScriptEngineManagerClassTest.java  |   2 +-
 src/org/RhinoTests/ScriptExceptionClassTest.java      |  14 +++++++-------
 src/org/RhinoTests/SimpleBindingsClassTest.java       |   2 +-
 src/org/RhinoTests/SimpleScriptContextClassTest.java  |   1 +
 9 files changed, 32 insertions(+), 17 deletions(-)

diffs (237 lines):

diff -r 94e0142da92d -r a5384678025c ChangeLog
--- a/ChangeLog	Mon Sep 03 13:05:48 2012 +0200
+++ b/ChangeLog	Thu Sep 06 15:39:22 2012 +0200
@@ -1,3 +1,15 @@
+2012-09-06  Pavel Tisnovsky  <ptisnovs at redhat.com>
+
+	* src/org/RhinoTests/AbstractScriptEngineClassTest.java:
+	* src/org/RhinoTests/CompiledScriptClassTest.java:
+	* src/org/RhinoTests/ScriptContextClassTest.java:
+	* src/org/RhinoTests/ScriptEngineClassTest.java:
+	* src/org/RhinoTests/ScriptEngineManagerClassTest.java:
+	* src/org/RhinoTests/ScriptExceptionClassTest.java:
+	* src/org/RhinoTests/SimpleBindingsClassTest.java:
+	* src/org/RhinoTests/SimpleScriptContextClassTest.java:
+	Fixed compiler warning caused by missed generics info.
+
 2012-09-03  Pavel Tisnovsky  <ptisnovs at redhat.com>
 
 	* src/org/RhinoTests/ScriptExceptionClassTest.java:
diff -r 94e0142da92d -r a5384678025c src/org/RhinoTests/AbstractScriptEngineClassTest.java
--- a/src/org/RhinoTests/AbstractScriptEngineClassTest.java	Mon Sep 03 13:05:48 2012 +0200
+++ b/src/org/RhinoTests/AbstractScriptEngineClassTest.java	Thu Sep 06 15:39:22 2012 +0200
@@ -65,7 +65,7 @@
     /**
      * Object that represents the type of AbstractScriptEngine.
      */
-    Class abstractScriptEngineClass = null;
+    Class<?> abstractScriptEngineClass = null;
 
     @Override
     protected void setUp(String[] args) {
@@ -139,7 +139,7 @@
      * Test for method javax.script.AbstractScriptEngine.getClass().getInterfaces()
      */
     protected void testGetInterfaces() {
-        List interfaces = Arrays.asList(this.abstractScriptEngineClass.getInterfaces());
+        List<Class<?>> interfaces = Arrays.asList(this.abstractScriptEngineClass.getInterfaces());
         assertTrue(interfaces.contains(ScriptEngine.class),
                 "list of implemented interfaces does not contain ScriptEngine");
     }
@@ -207,7 +207,7 @@
      * Test for method javax.script.AbstractScriptEngine.getClass().getSuperclass()
      */
     protected void testGetSuperclass() {
-        Class superClass = this.abstractScriptEngineClass.getSuperclass();
+        Class<?> superClass = this.abstractScriptEngineClass.getSuperclass();
         String superClassName = superClass.getName();
         assertEquals(superClassName, "java.lang.Object",
                 "Method AbstractScriptEngine.getClass().getSuperclass() returns wrong value " + superClassName);
@@ -217,7 +217,7 @@
      * Test for method javax.script.AbstractScriptEngine.getClass().getConstructors()
      */
     protected void testGetConstructors() {
-        Constructor[] constructors = this.abstractScriptEngineClass.getConstructors();
+        Constructor<?>[] constructors = this.abstractScriptEngineClass.getConstructors();
         assertEquals(constructors.length, 2, "only 2 constructors should be set");
         String constructorName;
         String constructorString;
@@ -239,7 +239,7 @@
      * Test for method javax.script.AbstractScriptEngine.getClass().getDeclaredConstructors()
      */
     protected void testGetDeclaredConstructors() {
-        Constructor[] constructors = this.abstractScriptEngineClass.getDeclaredConstructors();
+        Constructor<?>[] constructors = this.abstractScriptEngineClass.getDeclaredConstructors();
         assertEquals(constructors.length, 2, "only 2 constructors should be set");
         String constructorName;
         String constructorString;
@@ -386,6 +386,7 @@
     /**
      * Test for instanceof operator applied to a class javax.script.AbstractScriptEngine
      */
+    @SuppressWarnings("cast")
     protected void testInstanceOf() {
         // tested object
         Object o = new ScriptEngineManager().getEngineByName(Constants.EngineNames.ENGINE_NAME_JavaScript);
@@ -395,7 +396,6 @@
 
         // check operator instanceof against all superclasses
         assertTrue(o instanceof Object, "instanceof Object is wrongly evaluated to false");
-        assertTrue(o instanceof Object, "instanceof Object is wrongly evaluated to false");
     }
 
     /**
diff -r 94e0142da92d -r a5384678025c src/org/RhinoTests/CompiledScriptClassTest.java
--- a/src/org/RhinoTests/CompiledScriptClassTest.java	Mon Sep 03 13:05:48 2012 +0200
+++ b/src/org/RhinoTests/CompiledScriptClassTest.java	Thu Sep 06 15:39:22 2012 +0200
@@ -79,7 +79,7 @@
     /**
      * Object that represents the type of CompiledScript.
      */
-    Class compiledScriptClass = null;
+    Class<?> compiledScriptClass = null;
 
     @Override
     protected void setUp(String[] args) {
@@ -403,6 +403,7 @@
     /**
      * Test for instanceof operator applied to a class javax.script.CompiledScript
      */
+    @SuppressWarnings("cast")
     protected void testInstanceOf() throws ScriptException {
         // tested object
         Object o = getCompiledScript("6*7");
@@ -412,7 +413,6 @@
 
         // check operator instanceof against all superclasses
         assertTrue(o instanceof Object, "instanceof Object is wrongly evaluated to false");
-        assertTrue(o instanceof Object, "instanceof Object is wrongly evaluated to false");
     }
 
     /**
diff -r 94e0142da92d -r a5384678025c src/org/RhinoTests/ScriptContextClassTest.java
--- a/src/org/RhinoTests/ScriptContextClassTest.java	Mon Sep 03 13:05:48 2012 +0200
+++ b/src/org/RhinoTests/ScriptContextClassTest.java	Thu Sep 06 15:39:22 2012 +0200
@@ -347,6 +347,7 @@
     /**
      * Test for instanceof operator applied to a class javax.script.ScriptContext
      */
+    @SuppressWarnings("cast")
     protected void testInstanceOf() {
         // tested object
         Object o = new SimpleScriptContext();
diff -r 94e0142da92d -r a5384678025c src/org/RhinoTests/ScriptEngineClassTest.java
--- a/src/org/RhinoTests/ScriptEngineClassTest.java	Mon Sep 03 13:05:48 2012 +0200
+++ b/src/org/RhinoTests/ScriptEngineClassTest.java	Thu Sep 06 15:39:22 2012 +0200
@@ -357,6 +357,7 @@
     /**
      * Test for instanceof operator applied to a class javax.script.ScriptEngine
      */
+    @SuppressWarnings("cast")
     protected void testInstanceOf() {
         // tested object
         Object o = new ScriptEngineManager().getEngineByName(Constants.EngineNames.ENGINE_NAME_JavaScript);
diff -r 94e0142da92d -r a5384678025c src/org/RhinoTests/ScriptEngineManagerClassTest.java
--- a/src/org/RhinoTests/ScriptEngineManagerClassTest.java	Mon Sep 03 13:05:48 2012 +0200
+++ b/src/org/RhinoTests/ScriptEngineManagerClassTest.java	Thu Sep 06 15:39:22 2012 +0200
@@ -387,6 +387,7 @@
     /**
      * Test for instanceof operator applied to a class javax.script.ScriptEngineManager
      */
+    @SuppressWarnings("cast")
     protected void testInstanceOf() {
         // tested object
         Object o = new ScriptEngineManager();
@@ -396,7 +397,6 @@
 
         // check operator instanceof against all superclasses
         assertTrue(o instanceof Object, "instanceof Object is wrongly evaluated to false");
-        assertTrue(o instanceof Object, "instanceof Object is wrongly evaluated to false");
     }
 
     /**
diff -r 94e0142da92d -r a5384678025c src/org/RhinoTests/ScriptExceptionClassTest.java
--- a/src/org/RhinoTests/ScriptExceptionClassTest.java	Mon Sep 03 13:05:48 2012 +0200
+++ b/src/org/RhinoTests/ScriptExceptionClassTest.java	Thu Sep 06 15:39:22 2012 +0200
@@ -67,7 +67,7 @@
     /**
      * Object that represents the type of ScriptException.
      */
-    Class scriptExceptionClass = null;
+    Class<ScriptException> scriptExceptionClass = null;
 
     @Override
     protected void setUp(String[] args) {
@@ -141,7 +141,7 @@
      * Test for method javax.script.ScriptException.getClass().getInterfaces()
      */
     protected void testGetInterfaces() {
-        List interfaces = Arrays.asList(this.scriptExceptionClass.getInterfaces());
+        List<Class<?>> interfaces = Arrays.asList(this.scriptExceptionClass.getInterfaces());
         assertTrue(interfaces.isEmpty(),
                 "list of implemented interfaces should be empty");
     }
@@ -226,13 +226,13 @@
         testedConstructors.put("public javax.script.ScriptException(java.lang.String,java.lang.String,int)", "javax.script.ScriptException");
         testedConstructors.put("public javax.script.ScriptException(java.lang.String,java.lang.String,int,int)", "javax.script.ScriptException");
 
-        Constructor[] constructors = this.scriptExceptionClass.getDeclaredConstructors();
+        Constructor<?>[] constructors = this.scriptExceptionClass.getDeclaredConstructors();
         assertEquals(constructors.length, 4, "only 4 constructors should be set");
 
         // check if all constructors exists
-        for (Constructor constructor : constructors) {
-            String constructorName = constructors[0].getName();
-            String constructorString = constructors[0].toString();
+        for (Constructor<?> constructor : constructors) {
+            String constructorName = constructor.getName();
+            String constructorString = constructor.toString();
             assertTrue(testedConstructors.containsKey(constructorString), "wrong constructor.toString() " + constructorName);
             assertEquals(testedConstructors.get(constructorString), constructorName, "wrong constructor name " + constructorName);
         }
@@ -406,6 +406,7 @@
     /**
      * Test for instanceof operator applied to a class javax.script.ScriptException
      */
+    @SuppressWarnings("cast")
     protected void testInstanceOf() {
         // tested object
         Object o = new ScriptException("script exception");
@@ -417,7 +418,6 @@
         assertTrue(o instanceof Exception, "instanceof Exception is wrongly evaluated to false");
         assertTrue(o instanceof Throwable, "instanceof Throwable is wrongly evaluated to false");
         assertTrue(o instanceof Object, "instanceof Object is wrongly evaluated to false");
-        assertTrue(o instanceof Object, "instanceof Object is wrongly evaluated to false");
     }
 
     /**
diff -r 94e0142da92d -r a5384678025c src/org/RhinoTests/SimpleBindingsClassTest.java
--- a/src/org/RhinoTests/SimpleBindingsClassTest.java	Mon Sep 03 13:05:48 2012 +0200
+++ b/src/org/RhinoTests/SimpleBindingsClassTest.java	Thu Sep 06 15:39:22 2012 +0200
@@ -381,6 +381,7 @@
     /**
      * Test for instanceof operator applied to a class javax.script.SimpleBindings
      */
+    @SuppressWarnings("cast")
     protected void testInstanceOf() {
         // tested object
         Object o = new SimpleBindings();
@@ -390,7 +391,6 @@
 
         // check operator instanceof against all superclasses
         assertTrue(o instanceof Object, "instanceof Object is wrongly evaluated to false");
-        assertTrue(o instanceof Object, "instanceof Object is wrongly evaluated to false");
     }
 
     /**
diff -r 94e0142da92d -r a5384678025c src/org/RhinoTests/SimpleScriptContextClassTest.java
--- a/src/org/RhinoTests/SimpleScriptContextClassTest.java	Mon Sep 03 13:05:48 2012 +0200
+++ b/src/org/RhinoTests/SimpleScriptContextClassTest.java	Thu Sep 06 15:39:22 2012 +0200
@@ -383,6 +383,7 @@
     /**
      * Test for instanceof operator applied to a class javax.script.SimpleScriptContext
      */
+    @SuppressWarnings("cast")
     protected void testInstanceOf() {
         // tested object
         Object o = new SimpleScriptContext();



More information about the distro-pkg-dev mailing list