commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r753655 - /commons/proper/lang/trunk/src/test/org/apache/commons/lang/builder/ToStringBuilderTest.java
Date Sat, 14 Mar 2009 13:40:37 GMT
Author: sebb
Date: Sat Mar 14 13:40:37 2009
New Revision: 753655

URL: http://svn.apache.org/viewvc?rev=753655&view=rev
Log:
Fix various Eclipse warnings (casts, unused vars, @Override)

Modified:
    commons/proper/lang/trunk/src/test/org/apache/commons/lang/builder/ToStringBuilderTest.java

Modified: commons/proper/lang/trunk/src/test/org/apache/commons/lang/builder/ToStringBuilderTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/org/apache/commons/lang/builder/ToStringBuilderTest.java?rev=753655&r1=753654&r2=753655&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/org/apache/commons/lang/builder/ToStringBuilderTest.java
(original)
+++ commons/proper/lang/trunk/src/test/org/apache/commons/lang/builder/ToStringBuilderTest.java
Sat Mar 14 13:40:37 2009
@@ -52,10 +52,12 @@
         return suite;
     }
 
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
     }
 
+    @Override
     protected void tearDown() throws Exception {
         super.tearDown();
     }
@@ -357,13 +359,11 @@
     }
 
     static class ReflectionTestFixtureA {
-        private char a='a';
+        @SuppressWarnings("unused")
         private transient char transientA='t';
     }
 
     static class ReflectionTestFixtureB extends ReflectionTestFixtureA {
-        private char b='b';
-        private transient char transientB='t';
     }
 
     public void testInnerClassReflection() {
@@ -374,10 +374,12 @@
     static class Outer {
         Inner inner = new Inner();
         class Inner {
+            @Override
             public String toString() {
                 return ToStringBuilder.reflectionToString(this);
             }
         }
+        @Override
         public String toString() {
             return ToStringBuilder.reflectionToString(this);
         }
@@ -404,7 +406,7 @@
         Object[] objects = new Object[1];
         Object[] objectsLevel2 = new Object[1];
         objects[0] = objectsLevel2;
-        objectsLevel2[0] = (Object) objects;
+        objectsLevel2[0] = objects;
         assertEquals(
             this.toBaseString(objects) + "[{{" + this.toBaseString(objects) + "}}]",
             ToStringBuilder.reflectionToString(objects));
@@ -442,6 +444,7 @@
     static class ReflectionTestCycleA {
         ReflectionTestCycleB b;
 
+        @Override
         public String toString() {
             return ToStringBuilder.reflectionToString(this);
         }
@@ -453,6 +456,7 @@
     static class ReflectionTestCycleB {
         ReflectionTestCycleA a;
 
+        @Override
         public String toString() {
             return ToStringBuilder.reflectionToString(this);
         }
@@ -471,35 +475,33 @@
             this.o = o;
         }
 
+        @Override
         public String toString() {
             return ToStringBuilder.reflectionToString(this);
         }
     }
 
     private static class SelfInstanceVarReflectionTestFixture {
-        private SelfInstanceVarReflectionTestFixture typeIsSelf;
-
         public SelfInstanceVarReflectionTestFixture() {
-            this.typeIsSelf = this;
         }
 
+        @Override
         public String toString() {
             return ToStringBuilder.reflectionToString(this);
         }
       }
     
     private static class SelfInstanceTwoVarsReflectionTestFixture {
-        private SelfInstanceTwoVarsReflectionTestFixture typeIsSelf;
         private String otherType = "The Other Type";
 
         public SelfInstanceTwoVarsReflectionTestFixture() {
-            this.typeIsSelf = this;
         }
         
         public String getOtherType(){
             return this.otherType;
         }
 
+        @Override
         public String toString() {
             return ToStringBuilder.reflectionToString(this);
         }
@@ -570,7 +572,7 @@
     public void testReflectionArrayAndObjectCycle() throws Exception {
         Object[] objects = new Object[1];
         SimpleReflectionTestFixture simple = new SimpleReflectionTestFixture(objects);
-        objects[0] = (Object) simple;
+        objects[0] = simple;
         assertEquals(
             this.toBaseString(objects)
                 + "[{"
@@ -639,6 +641,7 @@
         assertEquals(baseStr + "[a=3,b=4]", new ToStringBuilder(base).append("a", 3L).append("b",
4L).toString());
     }
 
+    @SuppressWarnings("cast") // cast is not really needed, keep for consistency
     public void testInt() {
         assertEquals(baseStr + "[3]", new ToStringBuilder(base).append((int) 3).toString());
         assertEquals(baseStr + "[a=3]", new ToStringBuilder(base).append("a", (int) 3).toString());
@@ -850,6 +853,7 @@
     static class ObjectCycle {
         Object obj;
        
+        @Override
         public String toString() {
             return new ToStringBuilder(this).append(obj).toString();
         }
@@ -978,6 +982,7 @@
      */
     class MultiLineTestObject {
         Integer i = new Integer(31337);
+        @Override
         public String toString() {
             return new ToStringBuilder(this).append("testInt", i).toString();
         }



Mime
View raw message