From 1909e147eef504b349518a1e78d89beb28df4a31 Mon Sep 17 00:00:00 2001 From: Gintas Grigelionis Date: Fri, 11 May 2018 11:38:21 +0200 Subject: [PATCH] Checkstyle: indentation/whitespace (cf master) --- .../apache/tools/ant/taskdefs/MacroDef.java | 2 +- .../taskdefs/optional/junit/Enumerations.java | 177 +++++++++--------- .../org/apache/tools/ant/BuildFileRule.java | 2 +- 3 files changed, 89 insertions(+), 92 deletions(-) diff --git a/src/main/org/apache/tools/ant/taskdefs/MacroDef.java b/src/main/org/apache/tools/ant/taskdefs/MacroDef.java index 95757b6df..937cdd1e1 100644 --- a/src/main/org/apache/tools/ant/taskdefs/MacroDef.java +++ b/src/main/org/apache/tools/ant/taskdefs/MacroDef.java @@ -670,7 +670,7 @@ public class MacroDef extends AntlibDefinition { */ public boolean equals(Object obj) { if (obj == this) { - return true; + return true; } if (obj == null || !obj.getClass().equals(getClass())) { return false; diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/Enumerations.java b/src/main/org/apache/tools/ant/taskdefs/optional/junit/Enumerations.java index 327547efc..c6a014dcd 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/Enumerations.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/Enumerations.java @@ -28,77 +28,76 @@ import java.util.NoSuchElementException; */ public final class Enumerations { - private Enumerations() { - } + private Enumerations() { + } - /** - * creates an enumeration from an array of objects. - * @param array the array of object to enumerate. - * @return the enumeration over the array of objects. - */ - public static Enumeration fromArray(Object[] array) { - return new ArrayEnumeration(array); - } + /** + * creates an enumeration from an array of objects. + * @param array the array of object to enumerate. + * @return the enumeration over the array of objects. + */ + public static Enumeration fromArray(Object[] array) { + return new ArrayEnumeration(array); + } - /** - * creates an enumeration from an array of enumeration. The created enumeration - * will sequentially enumerate over all elements of each enumeration and skip - * null enumeration elements in the array. - * @param enums the array of enumerations. - * @return the enumeration over the array of enumerations. - */ - public static Enumeration fromCompound(Enumeration[] enums) { - return new CompoundEnumeration(enums); - } + /** + * creates an enumeration from an array of enumeration. The created enumeration + * will sequentially enumerate over all elements of each enumeration and skip + * null enumeration elements in the array. + * @param enums the array of enumerations. + * @return the enumeration over the array of enumerations. + */ + public static Enumeration fromCompound(Enumeration[] enums) { + return new CompoundEnumeration(enums); + } } - /** * Convenient enumeration over an array of objects. */ class ArrayEnumeration implements Enumeration { - /** object array */ - private Object[] array; + /** object array */ + private Object[] array; - /** current index */ - private int pos; + /** current index */ + private int pos; - /** - * Initialize a new enumeration that wraps an array. - * @param array the array of object to enumerate. - */ - public ArrayEnumeration(Object[] array) { - this.array = array; - this.pos = 0; - } - /** - * Tests if this enumeration contains more elements. - * - * @return true if and only if this enumeration object - * contains at least one more element to provide; - * false otherwise. - */ - public boolean hasMoreElements() { - return (pos < array.length); - } + /** + * Initialize a new enumeration that wraps an array. + * @param array the array of object to enumerate. + */ + public ArrayEnumeration(Object[] array) { + this.array = array; + this.pos = 0; + } + /** + * Tests if this enumeration contains more elements. + * + * @return true if and only if this enumeration object + * contains at least one more element to provide; + * false otherwise. + */ + public boolean hasMoreElements() { + return (pos < array.length); + } - /** - * Returns the next element of this enumeration if this enumeration - * object has at least one more element to provide. - * - * @return the next element of this enumeration. - * @throws NoSuchElementException if no more elements exist. - */ - public Object nextElement() throws NoSuchElementException { - if (hasMoreElements()) { - Object o = array[pos]; - pos++; - return o; - } - throw new NoSuchElementException(); + /** + * Returns the next element of this enumeration if this enumeration + * object has at least one more element to provide. + * + * @return the next element of this enumeration. + * @throws NoSuchElementException if no more elements exist. + */ + public Object nextElement() throws NoSuchElementException { + if (hasMoreElements()) { + Object o = array[pos]; + pos++; + return o; } + throw new NoSuchElementException(); + } } /** * Convenient enumeration over an array of enumeration. For example: @@ -130,48 +129,46 @@ class ArrayEnumeration implements Enumeration { * } * */ - class CompoundEnumeration implements Enumeration { +class CompoundEnumeration implements Enumeration { - /** enumeration array */ - private Enumeration[] enumArray; + /** enumeration array */ + private Enumeration[] enumArray; - /** index in the enums array */ - private int index = 0; + /** index in the enums array */ + private int index = 0; public CompoundEnumeration(Enumeration[] enumarray) { - this.enumArray = enumarray; + this.enumArray = enumarray; } - /** - * Tests if this enumeration contains more elements. - * - * @return true if and only if this enumeration object - * contains at least one more element to provide; - * false otherwise. - */ + /** + * Tests if this enumeration contains more elements. + * + * @return true if and only if this enumeration object + * contains at least one more element to provide; + * false otherwise. + */ public boolean hasMoreElements() { - while (index < enumArray.length) { - if (enumArray[index] != null && enumArray[index].hasMoreElements()) { - return true; - } - index++; - } - return false; + while (index < enumArray.length) { + if (enumArray[index] != null && enumArray[index].hasMoreElements()) { + return true; + } + index++; + } + return false; } - /** - * Returns the next element of this enumeration if this enumeration - * object has at least one more element to provide. - * - * @return the next element of this enumeration. - * @throws NoSuchElementException if no more elements exist. - */ + /** + * Returns the next element of this enumeration if this enumeration + * object has at least one more element to provide. + * + * @return the next element of this enumeration. + * @throws NoSuchElementException if no more elements exist. + */ public Object nextElement() throws NoSuchElementException { - if (hasMoreElements()) { - return enumArray[index].nextElement(); - } - throw new NoSuchElementException(); + if (hasMoreElements()) { + return enumArray[index].nextElement(); + } + throw new NoSuchElementException(); } } - - diff --git a/src/tests/junit/org/apache/tools/ant/BuildFileRule.java b/src/tests/junit/org/apache/tools/ant/BuildFileRule.java index c5a71c75a..a4441098a 100644 --- a/src/tests/junit/org/apache/tools/ant/BuildFileRule.java +++ b/src/tests/junit/org/apache/tools/ant/BuildFileRule.java @@ -170,7 +170,7 @@ public class BuildFileRule extends ExternalResource { * * @param targetName the target in the currently configured build file to run. */ - public void executeTarget(String targetName) { + public void executeTarget(String targetName) { outputBuffer = new StringBuffer(); PrintStream out = new PrintStream(new AntOutputStream(outputBuffer)); errorBuffer = new StringBuffer();