Address Checkstyle report issues as reported by Henri (http://www.generationjava.com/maven/jakarta-commons/lang/)

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/lang/trunk@137303 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary D. Gregory 2003-04-18 09:12:16 +00:00
parent d63c271a8c
commit 8ba5fec31d
3 changed files with 34 additions and 21 deletions

View File

@ -105,7 +105,7 @@
* @author Stephen Colebourne
* @author Gary Gregory
* @since 1.0
* @version $Id: CompareToBuilder.java,v 1.13 2003/03/23 17:54:16 scolebourne Exp $
* @version $Id: CompareToBuilder.java,v 1.14 2003/04/18 09:12:16 ggregory Exp $
*/
public class CompareToBuilder {
@ -242,14 +242,19 @@ public static int reflectionCompare(Object lhs, Object rhs, boolean testTransien
* @param builder the builder to append to
* @param useTransients whether to test transient fields
*/
private static void reflectionAppend(Object lhs, Object rhs, Class clazz, CompareToBuilder builder, boolean useTransients) {
private static void reflectionAppend(
Object lhs,
Object rhs,
Class clazz,
CompareToBuilder builder,
boolean useTransients) {
Field[] fields = clazz.getDeclaredFields();
Field.setAccessible(fields, true);
for (int i = 0; i < fields.length && builder.comparison == 0; i++) {
Field f = fields[i];
if ((f.getName().indexOf('$') == -1) &&
(useTransients || !Modifier.isTransient(f.getModifiers())) &&
(!Modifier.isStatic(f.getModifiers()))) {
if ((f.getName().indexOf('$') == -1)
&& (useTransients || !Modifier.isTransient(f.getModifiers()))
&& (!Modifier.isStatic(f.getModifiers()))) {
try {
builder.append(f.get(lhs), f.get(rhs));
} catch (IllegalAccessException e) {

View File

@ -108,7 +108,7 @@
* @author Stephen Colebourne
* @author Gary Gregory
* @since 1.0
* @version $Id: EqualsBuilder.java,v 1.12 2003/03/23 17:54:16 scolebourne Exp $
* @version $Id: EqualsBuilder.java,v 1.13 2003/04/18 09:12:16 ggregory Exp $
*/
public class EqualsBuilder {
/**
@ -253,14 +253,19 @@ public static boolean reflectionEquals(Object lhs, Object rhs, boolean testTrans
* @param builder the builder to append to
* @param useTransients whether to test transient fields
*/
private static void reflectionAppend(Object lhs, Object rhs, Class clazz, EqualsBuilder builder, boolean useTransients) {
private static void reflectionAppend(
Object lhs,
Object rhs,
Class clazz,
EqualsBuilder builder,
boolean useTransients) {
Field[] fields = clazz.getDeclaredFields();
Field.setAccessible(fields, true);
for (int i = 0; i < fields.length && builder.isEquals; i++) {
Field f = fields[i];
if ((f.getName().indexOf('$') == -1) &&
(useTransients || !Modifier.isTransient(f.getModifiers())) &&
(!Modifier.isStatic(f.getModifiers()))) {
if ((f.getName().indexOf('$') == -1)
&& (useTransients || !Modifier.isTransient(f.getModifiers()))
&& (!Modifier.isStatic(f.getModifiers()))) {
try {
builder.append(f.get(lhs), f.get(rhs));
} catch (IllegalAccessException e) {

View File

@ -108,7 +108,7 @@
* @author Stephen Colebourne
* @author Gary Gregory
* @since 1.0
* @version $Id: HashCodeBuilder.java,v 1.11 2003/03/23 17:54:16 scolebourne Exp $
* @version $Id: HashCodeBuilder.java,v 1.12 2003/04/18 09:12:16 ggregory Exp $
*/
public class HashCodeBuilder {
@ -263,8 +263,8 @@ public static int reflectionHashCode(
* these should be different for each class, however this is not vital.
* Prime numbers are preferred, especially for the multiplier.</p>
*
* @param initialNonZeroOddNumber
* @param multiplierNonZeroOddNumber
* @param initialNonZeroOddNumber a non-zero, odd number used as the initial value
* @param multiplierNonZeroOddNumber a non-zero, odd number used as the multiplier
* @param object the Object to create a <code>hashCode</code> for
* @param testTransients whether to include transient fields
* @return int hash code
@ -297,8 +297,8 @@ public static int reflectionHashCode(
* these should be different for each class, however this is not vital.
* Prime numbers are preferred, especially for the multiplier.</p>
*
* @param initialNonZeroOddNumber
* @param multiplierNonZeroOddNumber
* @param initialNonZeroOddNumber a non-zero, odd number used as the initial value
* @param multiplierNonZeroOddNumber a non-zero, odd number used as the multiplier
* @param object the Object to create a <code>hashCode</code> for
* @param testTransients whether to include transient fields
* @param reflectUpToClass the superclass to reflect up to (inclusive), may be null
@ -307,8 +307,11 @@ public static int reflectionHashCode(
* @throws IllegalArgumentException if the number is zero or even
*/
public static int reflectionHashCode(
int initialNonZeroOddNumber, int multiplierNonZeroOddNumber,
Object object, boolean testTransients, Class reflectUpToClass) {
int initialNonZeroOddNumber,
int multiplierNonZeroOddNumber,
Object object,
boolean testTransients,
Class reflectUpToClass) {
if (object == null) {
throw new IllegalArgumentException("The object to build a hash code for must not be null");
@ -337,9 +340,9 @@ private static void reflectionAppend(Object object, Class clazz, HashCodeBuilder
Field.setAccessible(fields, true);
for (int i = 0; i < fields.length; i++) {
Field f = fields[i];
if ((f.getName().indexOf('$') == -1) &&
(useTransients || !Modifier.isTransient(f.getModifiers())) &&
(!Modifier.isStatic(f.getModifiers()))) {
if ((f.getName().indexOf('$') == -1)
&& (useTransients || !Modifier.isTransient(f.getModifiers()))
&& (!Modifier.isStatic(f.getModifiers()))) {
try {
builder.append(f.get(object));
} catch (IllegalAccessException e) {