Fix various Eclipse warnings (casts, unused vars)

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@753654 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2009-03-14 13:37:21 +00:00
parent 6315813381
commit 8328a95adb
1 changed files with 14 additions and 0 deletions

View File

@ -36,6 +36,7 @@ public class HashCodeBuilderTest extends TestCase {
static class ReflectionTestCycleA { static class ReflectionTestCycleA {
ReflectionTestCycleB b; ReflectionTestCycleB b;
@Override
public int hashCode() { public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this); return HashCodeBuilder.reflectionHashCode(this);
} }
@ -47,6 +48,7 @@ public class HashCodeBuilderTest extends TestCase {
static class ReflectionTestCycleB { static class ReflectionTestCycleB {
ReflectionTestCycleA a; ReflectionTestCycleA a;
@Override
public int hashCode() { public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this); return HashCodeBuilder.reflectionHashCode(this);
} }
@ -66,10 +68,12 @@ public class HashCodeBuilderTest extends TestCase {
return suite; return suite;
} }
@Override
protected void setUp() throws Exception { protected void setUp() throws Exception {
super.setUp(); super.setUp();
} }
@Override
protected void tearDown() throws Exception { protected void tearDown() throws Exception {
super.tearDown(); super.tearDown();
} }
@ -103,6 +107,7 @@ public class HashCodeBuilderTest extends TestCase {
this.a = a; this.a = a;
} }
@Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (o == this) { if (o == this) {
return true; return true;
@ -126,6 +131,7 @@ public class HashCodeBuilderTest extends TestCase {
static class TestSubObject extends TestObject { static class TestSubObject extends TestObject {
private int b; private int b;
@SuppressWarnings("unused")
transient private int t; transient private int t;
public TestSubObject() { public TestSubObject() {
@ -138,6 +144,7 @@ public class HashCodeBuilderTest extends TestCase {
this.t = t; this.t = t;
} }
@Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (o == this) { if (o == this) {
return true; return true;
@ -222,12 +229,14 @@ public class HashCodeBuilderTest extends TestCase {
assertEquals(17 * 37 + obj.hashCode(), new HashCodeBuilder(17, 37).append(obj).toHashCode()); assertEquals(17 * 37 + obj.hashCode(), new HashCodeBuilder(17, 37).append(obj).toHashCode());
} }
@SuppressWarnings("cast") // cast is not really needed, keep for consistency
public void testLong() { public void testLong() {
assertEquals(17 * 37, new HashCodeBuilder(17, 37).append((long) 0L).toHashCode()); assertEquals(17 * 37, new HashCodeBuilder(17, 37).append((long) 0L).toHashCode());
assertEquals(17 * 37 + (int) (123456789L ^ (123456789L >> 32)), new HashCodeBuilder(17, 37).append( assertEquals(17 * 37 + (int) (123456789L ^ (123456789L >> 32)), new HashCodeBuilder(17, 37).append(
(long) 123456789L).toHashCode()); (long) 123456789L).toHashCode());
} }
@SuppressWarnings("cast") // cast is not really needed, keep for consistency
public void testInt() { public void testInt() {
assertEquals(17 * 37, new HashCodeBuilder(17, 37).append((int) 0).toHashCode()); assertEquals(17 * 37, new HashCodeBuilder(17, 37).append((int) 0).toHashCode());
assertEquals(17 * 37 + 123456, new HashCodeBuilder(17, 37).append((int) 123456).toHashCode()); assertEquals(17 * 37 + 123456, new HashCodeBuilder(17, 37).append((int) 123456).toHashCode());
@ -248,6 +257,7 @@ public class HashCodeBuilderTest extends TestCase {
assertEquals(17 * 37 + 123, new HashCodeBuilder(17, 37).append((byte) 123).toHashCode()); assertEquals(17 * 37 + 123, new HashCodeBuilder(17, 37).append((byte) 123).toHashCode());
} }
@SuppressWarnings("cast") // cast is not really needed, keep for consistency
public void testDouble() { public void testDouble() {
assertEquals(17 * 37, new HashCodeBuilder(17, 37).append((double) 0d).toHashCode()); assertEquals(17 * 37, new HashCodeBuilder(17, 37).append((double) 0d).toHashCode());
double d = 1234567.89; double d = 1234567.89;
@ -255,6 +265,7 @@ public class HashCodeBuilderTest extends TestCase {
assertEquals(17 * 37 + (int) (l ^ (l >> 32)), new HashCodeBuilder(17, 37).append(d).toHashCode()); assertEquals(17 * 37 + (int) (l ^ (l >> 32)), new HashCodeBuilder(17, 37).append(d).toHashCode());
} }
@SuppressWarnings("cast") // cast is not really needed, keep for consistency
public void testFloat() { public void testFloat() {
assertEquals(17 * 37, new HashCodeBuilder(17, 37).append((float) 0f).toHashCode()); assertEquals(17 * 37, new HashCodeBuilder(17, 37).append((float) 0f).toHashCode());
float f = 1234.89f; float f = 1234.89f;
@ -490,10 +501,13 @@ public class HashCodeBuilderTest extends TestCase {
} }
static class TestObjectWithMultipleFields { static class TestObjectWithMultipleFields {
@SuppressWarnings("unused")
private int one = 0; private int one = 0;
@SuppressWarnings("unused")
private int two = 0; private int two = 0;
@SuppressWarnings("unused")
private int three = 0; private int three = 0;
public TestObjectWithMultipleFields(int one, int two, int three) { public TestObjectWithMultipleFields(int one, int two, int three) {