From b819343483d33cc529b785935cea9bfc2fc080e5 Mon Sep 17 00:00:00 2001 From: "Gary D. Gregory" Date: Thu, 5 Apr 2012 17:53:39 +0000 Subject: [PATCH] Add missing @Override. git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1309977 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/commons/lang3/CharRange.java | 4 ++ .../java/org/apache/commons/lang3/Range.java | 1 + .../lang3/builder/CompareToBuilder.java | 1 + .../commons/lang3/builder/EqualsBuilder.java | 1 + .../lang3/builder/HashCodeBuilder.java | 1 + .../lang3/builder/ToStringBuilder.java | 1 + .../lang3/concurrent/AtomicInitializer.java | 1 + .../concurrent/AtomicSafeInitializer.java | 1 + .../concurrent/BackgroundInitializer.java | 2 + .../lang3/concurrent/BasicThreadFactory.java | 2 + .../lang3/concurrent/ConcurrentUtils.java | 5 +++ .../lang3/concurrent/ConstantInitializer.java | 1 + .../lang3/concurrent/LazyInitializer.java | 1 + .../lang3/concurrent/TimedSemaphore.java | 1 + .../lang3/event/EventListenerSupport.java | 1 + .../commons/lang3/event/EventUtils.java | 1 + .../lang3/exception/ContextedException.java | 7 +++ .../exception/ContextedRuntimeException.java | 7 +++ .../exception/DefaultExceptionContext.java | 7 +++ .../apache/commons/lang3/math/Fraction.java | 1 + .../commons/lang3/mutable/MutableBoolean.java | 3 ++ .../commons/lang3/mutable/MutableByte.java | 3 ++ .../commons/lang3/mutable/MutableDouble.java | 3 ++ .../commons/lang3/mutable/MutableFloat.java | 3 ++ .../commons/lang3/mutable/MutableInt.java | 3 ++ .../commons/lang3/mutable/MutableLong.java | 3 ++ .../commons/lang3/mutable/MutableObject.java | 2 + .../commons/lang3/mutable/MutableShort.java | 3 ++ .../apache/commons/lang3/text/StrBuilder.java | 6 +++ .../commons/lang3/text/StrTokenizer.java | 9 ++++ .../apache/commons/lang3/time/DateUtils.java | 3 ++ .../commons/lang3/time/FastDateFormat.java | 11 +++++ .../commons/lang3/time/FastDateParser.java | 23 ++++++++++ .../commons/lang3/time/FastDatePrinter.java | 44 +++++++++++++++++++ .../commons/lang3/tuple/ImmutablePair.java | 1 + .../commons/lang3/tuple/MutablePair.java | 1 + .../org/apache/commons/lang3/tuple/Pair.java | 3 ++ .../apache/commons/lang3/tuple/Triple.java | 1 + .../commons/lang3/AnnotationUtilsTest.java | 1 + .../apache/commons/lang3/ArrayUtilsTest.java | 3 ++ .../apache/commons/lang3/ObjectUtilsTest.java | 4 ++ .../org/apache/commons/lang3/RangeTest.java | 3 ++ .../lang3/StringUtilsEqualsIndexOfTest.java | 4 ++ .../lang3/builder/CompareToBuilderTest.java | 1 + ...lectionToStringBuilderConcurrencyTest.java | 2 + ...ngBuilderMutateInspectConcurrencyTest.java | 2 + .../builder/ToStringStyleConcurrencyTest.java | 1 + .../CallableBackgroundInitializerTest.java | 1 + .../lang3/event/EventListenerSupportTest.java | 3 ++ .../commons/lang3/event/EventUtilsTest.java | 2 + .../lang3/reflect/MethodUtilsTest.java | 2 + .../lang3/text/ExtendedMessageFormatTest.java | 3 ++ .../lang3/time/FastDateFormatTest.java | 1 + 53 files changed, 205 insertions(+) diff --git a/src/main/java/org/apache/commons/lang3/CharRange.java b/src/main/java/org/apache/commons/lang3/CharRange.java index aa8e6d341..079b8b9a2 100644 --- a/src/main/java/org/apache/commons/lang3/CharRange.java +++ b/src/main/java/org/apache/commons/lang3/CharRange.java @@ -257,6 +257,7 @@ final class CharRange implements Iterable, Serializable { * @return an iterator to the chars represented by this range * @since 2.5 */ + @Override public Iterator iterator() { return new CharacterIterator(this); } @@ -325,6 +326,7 @@ final class CharRange implements Iterable, Serializable { * * @return {@code true} if the iterator has yet to reach the character date */ + @Override public boolean hasNext() { return hasNext; } @@ -334,6 +336,7 @@ final class CharRange implements Iterable, Serializable { * * @return {@code Character} for the next character */ + @Override public Character next() { if (hasNext == false) { throw new NoSuchElementException(); @@ -349,6 +352,7 @@ final class CharRange implements Iterable, Serializable { * @throws UnsupportedOperationException * @see java.util.Iterator#remove() */ + @Override public void remove() { throw new UnsupportedOperationException(); } diff --git a/src/main/java/org/apache/commons/lang3/Range.java b/src/main/java/org/apache/commons/lang3/Range.java index 471024ebe..4fa0dfebd 100644 --- a/src/main/java/org/apache/commons/lang3/Range.java +++ b/src/main/java/org/apache/commons/lang3/Range.java @@ -485,6 +485,7 @@ public final class Range implements Serializable { * @param obj2 right hand side of comparison * @return negative, 0, positive comparison value */ + @Override public int compare(Object obj1, Object obj2) { return ((Comparable) obj1).compareTo(obj2); } diff --git a/src/main/java/org/apache/commons/lang3/builder/CompareToBuilder.java b/src/main/java/org/apache/commons/lang3/builder/CompareToBuilder.java index 268f175a2..930a13e56 100644 --- a/src/main/java/org/apache/commons/lang3/builder/CompareToBuilder.java +++ b/src/main/java/org/apache/commons/lang3/builder/CompareToBuilder.java @@ -1013,6 +1013,7 @@ public class CompareToBuilder implements Builder { * @see #toComparison() * @since 3.0 */ + @Override public Integer build() { return Integer.valueOf(toComparison()); } diff --git a/src/main/java/org/apache/commons/lang3/builder/EqualsBuilder.java b/src/main/java/org/apache/commons/lang3/builder/EqualsBuilder.java index 33eee397c..0f0314bbe 100644 --- a/src/main/java/org/apache/commons/lang3/builder/EqualsBuilder.java +++ b/src/main/java/org/apache/commons/lang3/builder/EqualsBuilder.java @@ -920,6 +920,7 @@ public class EqualsBuilder implements Builder { * * @since 3.0 */ + @Override public Boolean build() { return Boolean.valueOf(isEquals()); } diff --git a/src/main/java/org/apache/commons/lang3/builder/HashCodeBuilder.java b/src/main/java/org/apache/commons/lang3/builder/HashCodeBuilder.java index 5bbeec455..e37f0c3ec 100644 --- a/src/main/java/org/apache/commons/lang3/builder/HashCodeBuilder.java +++ b/src/main/java/org/apache/commons/lang3/builder/HashCodeBuilder.java @@ -940,6 +940,7 @@ public class HashCodeBuilder implements Builder { * * @since 3.0 */ + @Override public Integer build() { return Integer.valueOf(toHashCode()); } diff --git a/src/main/java/org/apache/commons/lang3/builder/ToStringBuilder.java b/src/main/java/org/apache/commons/lang3/builder/ToStringBuilder.java index 8bf833e1f..1c707ada2 100644 --- a/src/main/java/org/apache/commons/lang3/builder/ToStringBuilder.java +++ b/src/main/java/org/apache/commons/lang3/builder/ToStringBuilder.java @@ -1073,6 +1073,7 @@ public class ToStringBuilder implements Builder { * * @since 3.0 */ + @Override public String build() { return toString(); } diff --git a/src/main/java/org/apache/commons/lang3/concurrent/AtomicInitializer.java b/src/main/java/org/apache/commons/lang3/concurrent/AtomicInitializer.java index c4cb7bef5..b735c249f 100644 --- a/src/main/java/org/apache/commons/lang3/concurrent/AtomicInitializer.java +++ b/src/main/java/org/apache/commons/lang3/concurrent/AtomicInitializer.java @@ -77,6 +77,7 @@ public abstract class AtomicInitializer implements ConcurrentInitializer { * @throws ConcurrentException if an error occurred during initialization of * the object */ + @Override public T get() throws ConcurrentException { T result = reference.get(); diff --git a/src/main/java/org/apache/commons/lang3/concurrent/AtomicSafeInitializer.java b/src/main/java/org/apache/commons/lang3/concurrent/AtomicSafeInitializer.java index efe6dc5ee..5bb5096db 100644 --- a/src/main/java/org/apache/commons/lang3/concurrent/AtomicSafeInitializer.java +++ b/src/main/java/org/apache/commons/lang3/concurrent/AtomicSafeInitializer.java @@ -69,6 +69,7 @@ public abstract class AtomicSafeInitializer implements * @throws ConcurrentException if the initialization of the object causes an * exception */ + @Override public final T get() throws ConcurrentException { T result; diff --git a/src/main/java/org/apache/commons/lang3/concurrent/BackgroundInitializer.java b/src/main/java/org/apache/commons/lang3/concurrent/BackgroundInitializer.java index bd1335de3..57fac11a8 100644 --- a/src/main/java/org/apache/commons/lang3/concurrent/BackgroundInitializer.java +++ b/src/main/java/org/apache/commons/lang3/concurrent/BackgroundInitializer.java @@ -206,6 +206,7 @@ public abstract class BackgroundInitializer implements * background processing * @throws IllegalStateException if {@link #start()} has not been called */ + @Override public T get() throws ConcurrentException { try { return getFuture().get(); @@ -320,6 +321,7 @@ public abstract class BackgroundInitializer implements * @return the result object * @throws Exception if an error occurs */ + @Override public T call() throws Exception { try { return initialize(); diff --git a/src/main/java/org/apache/commons/lang3/concurrent/BasicThreadFactory.java b/src/main/java/org/apache/commons/lang3/concurrent/BasicThreadFactory.java index 56e50cfa6..8656e359c 100644 --- a/src/main/java/org/apache/commons/lang3/concurrent/BasicThreadFactory.java +++ b/src/main/java/org/apache/commons/lang3/concurrent/BasicThreadFactory.java @@ -200,6 +200,7 @@ public class BasicThreadFactory implements ThreadFactory { * @param r the {@code Runnable} to be executed by the new thread * @return the newly created thread */ + @Override public Thread newThread(Runnable r) { Thread t = getWrappedFactory().newThread(r); initializeThread(t); @@ -372,6 +373,7 @@ public class BasicThreadFactory implements ThreadFactory { * * @return the new {@code BasicThreadFactory} */ + @Override public BasicThreadFactory build() { BasicThreadFactory factory = new BasicThreadFactory(this); reset(); diff --git a/src/main/java/org/apache/commons/lang3/concurrent/ConcurrentUtils.java b/src/main/java/org/apache/commons/lang3/concurrent/ConcurrentUtils.java index 131869c58..dfde0ddeb 100644 --- a/src/main/java/org/apache/commons/lang3/concurrent/ConcurrentUtils.java +++ b/src/main/java/org/apache/commons/lang3/concurrent/ConcurrentUtils.java @@ -347,6 +347,7 @@ public class ConcurrentUtils { * the constant object managed by this {@code Future} implementation is * always available. */ + @Override public boolean isDone() { return true; } @@ -354,6 +355,7 @@ public class ConcurrentUtils { /** * {@inheritDoc} This implementation just returns the constant value. */ + @Override public T get() { return value; } @@ -362,6 +364,7 @@ public class ConcurrentUtils { * {@inheritDoc} This implementation just returns the constant value; it * does not block, therefore the timeout has no meaning. */ + @Override public T get(long timeout, TimeUnit unit) { return value; } @@ -370,6 +373,7 @@ public class ConcurrentUtils { * {@inheritDoc} This implementation always returns false; there * is no background process which could be cancelled. */ + @Override public boolean isCancelled() { return false; } @@ -378,6 +382,7 @@ public class ConcurrentUtils { * {@inheritDoc} The cancel operation is not supported. This * implementation always returns false. */ + @Override public boolean cancel(boolean mayInterruptIfRunning) { return false; } diff --git a/src/main/java/org/apache/commons/lang3/concurrent/ConstantInitializer.java b/src/main/java/org/apache/commons/lang3/concurrent/ConstantInitializer.java index e013b54ee..1d35bbec0 100644 --- a/src/main/java/org/apache/commons/lang3/concurrent/ConstantInitializer.java +++ b/src/main/java/org/apache/commons/lang3/concurrent/ConstantInitializer.java @@ -76,6 +76,7 @@ public class ConstantInitializer implements ConcurrentInitializer { * @return the object managed by this initializer * @throws ConcurrentException if an error occurs */ + @Override public T get() throws ConcurrentException { return getObject(); } diff --git a/src/main/java/org/apache/commons/lang3/concurrent/LazyInitializer.java b/src/main/java/org/apache/commons/lang3/concurrent/LazyInitializer.java index 2622b10e7..cb4d97f06 100644 --- a/src/main/java/org/apache/commons/lang3/concurrent/LazyInitializer.java +++ b/src/main/java/org/apache/commons/lang3/concurrent/LazyInitializer.java @@ -88,6 +88,7 @@ public abstract class LazyInitializer implements ConcurrentInitializer { * @throws ConcurrentException if an error occurred during initialization of * the object */ + @Override public T get() throws ConcurrentException { // use a temporary variable to reduce the number of reads of the // volatile field diff --git a/src/main/java/org/apache/commons/lang3/concurrent/TimedSemaphore.java b/src/main/java/org/apache/commons/lang3/concurrent/TimedSemaphore.java index d5cb0839d..1f27ae2bd 100644 --- a/src/main/java/org/apache/commons/lang3/concurrent/TimedSemaphore.java +++ b/src/main/java/org/apache/commons/lang3/concurrent/TimedSemaphore.java @@ -400,6 +400,7 @@ public class TimedSemaphore { */ protected ScheduledFuture startTimer() { return getExecutorService().scheduleAtFixedRate(new Runnable() { + @Override public void run() { endOfPeriod(); } diff --git a/src/main/java/org/apache/commons/lang3/event/EventListenerSupport.java b/src/main/java/org/apache/commons/lang3/event/EventListenerSupport.java index 9e912d03b..9b1165997 100644 --- a/src/main/java/org/apache/commons/lang3/event/EventListenerSupport.java +++ b/src/main/java/org/apache/commons/lang3/event/EventListenerSupport.java @@ -304,6 +304,7 @@ public class EventListenerSupport implements Serializable { * @return the result of the method call * @throws Throwable if an error occurs */ + @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { for (L listener : listeners) { method.invoke(listener, args); diff --git a/src/main/java/org/apache/commons/lang3/event/EventUtils.java b/src/main/java/org/apache/commons/lang3/event/EventUtils.java index fa0cb8284..7ad9d4927 100644 --- a/src/main/java/org/apache/commons/lang3/event/EventUtils.java +++ b/src/main/java/org/apache/commons/lang3/event/EventUtils.java @@ -106,6 +106,7 @@ public class EventUtils { * @return the result of the method call * @throws Throwable if an error occurs */ + @Override public Object invoke(final Object proxy, final Method method, final Object[] parameters) throws Throwable { if (eventTypes.isEmpty() || eventTypes.contains(method.getName())) { if (hasMatchingParametersMethod(method)) { diff --git a/src/main/java/org/apache/commons/lang3/exception/ContextedException.java b/src/main/java/org/apache/commons/lang3/exception/ContextedException.java index a9100245a..e80135ce3 100644 --- a/src/main/java/org/apache/commons/lang3/exception/ContextedException.java +++ b/src/main/java/org/apache/commons/lang3/exception/ContextedException.java @@ -164,6 +164,7 @@ public class ContextedException extends Exception implements ExceptionContext { * @param value information needed to understand exception, may be {@code null} * @return {@code this}, for method chaining, not {@code null} */ + @Override public ContextedException addContextValue(String label, Object value) { exceptionContext.addContextValue(label, value); return this; @@ -182,6 +183,7 @@ public class ContextedException extends Exception implements ExceptionContext { * @param value information needed to understand exception, may be {@code null} * @return {@code this}, for method chaining, not {@code null} */ + @Override public ContextedException setContextValue(String label, Object value) { exceptionContext.setContextValue(label, value); return this; @@ -190,6 +192,7 @@ public class ContextedException extends Exception implements ExceptionContext { /** * {@inheritDoc} */ + @Override public List getContextValues(String label) { return this.exceptionContext.getContextValues(label); } @@ -197,6 +200,7 @@ public class ContextedException extends Exception implements ExceptionContext { /** * {@inheritDoc} */ + @Override public Object getFirstContextValue(String label) { return this.exceptionContext.getFirstContextValue(label); } @@ -204,6 +208,7 @@ public class ContextedException extends Exception implements ExceptionContext { /** * {@inheritDoc} */ + @Override public List> getContextEntries() { return this.exceptionContext.getContextEntries(); } @@ -211,6 +216,7 @@ public class ContextedException extends Exception implements ExceptionContext { /** * {@inheritDoc} */ + @Override public Set getContextLabels() { return exceptionContext.getContextLabels(); } @@ -240,6 +246,7 @@ public class ContextedException extends Exception implements ExceptionContext { /** * {@inheritDoc} */ + @Override public String getFormattedExceptionMessage(String baseMessage) { return exceptionContext.getFormattedExceptionMessage(baseMessage); } diff --git a/src/main/java/org/apache/commons/lang3/exception/ContextedRuntimeException.java b/src/main/java/org/apache/commons/lang3/exception/ContextedRuntimeException.java index c8e2a2936..4425c1501 100644 --- a/src/main/java/org/apache/commons/lang3/exception/ContextedRuntimeException.java +++ b/src/main/java/org/apache/commons/lang3/exception/ContextedRuntimeException.java @@ -164,6 +164,7 @@ public class ContextedRuntimeException extends RuntimeException implements Excep * @param value information needed to understand exception, may be {@code null} * @return {@code this}, for method chaining, not {@code null} */ + @Override public ContextedRuntimeException addContextValue(String label, Object value) { exceptionContext.addContextValue(label, value); return this; @@ -182,6 +183,7 @@ public class ContextedRuntimeException extends RuntimeException implements Excep * @param value information needed to understand exception, may be {@code null} * @return {@code this}, for method chaining, not {@code null} */ + @Override public ContextedRuntimeException setContextValue(String label, Object value) { exceptionContext.setContextValue(label, value); return this; @@ -190,6 +192,7 @@ public class ContextedRuntimeException extends RuntimeException implements Excep /** * {@inheritDoc} */ + @Override public List getContextValues(String label) { return this.exceptionContext.getContextValues(label); } @@ -197,6 +200,7 @@ public class ContextedRuntimeException extends RuntimeException implements Excep /** * {@inheritDoc} */ + @Override public Object getFirstContextValue(String label) { return this.exceptionContext.getFirstContextValue(label); } @@ -204,6 +208,7 @@ public class ContextedRuntimeException extends RuntimeException implements Excep /** * {@inheritDoc} */ + @Override public List> getContextEntries() { return this.exceptionContext.getContextEntries(); } @@ -211,6 +216,7 @@ public class ContextedRuntimeException extends RuntimeException implements Excep /** * {@inheritDoc} */ + @Override public Set getContextLabels() { return exceptionContext.getContextLabels(); } @@ -240,6 +246,7 @@ public class ContextedRuntimeException extends RuntimeException implements Excep /** * {@inheritDoc} */ + @Override public String getFormattedExceptionMessage(String baseMessage) { return exceptionContext.getFormattedExceptionMessage(baseMessage); } diff --git a/src/main/java/org/apache/commons/lang3/exception/DefaultExceptionContext.java b/src/main/java/org/apache/commons/lang3/exception/DefaultExceptionContext.java index 75cc8324c..37a352ec8 100644 --- a/src/main/java/org/apache/commons/lang3/exception/DefaultExceptionContext.java +++ b/src/main/java/org/apache/commons/lang3/exception/DefaultExceptionContext.java @@ -49,6 +49,7 @@ public class DefaultExceptionContext implements ExceptionContext, Serializable { /** * {@inheritDoc} */ + @Override public DefaultExceptionContext addContextValue(String label, Object value) { contextValues.add(new ImmutablePair(label, value)); return this; @@ -57,6 +58,7 @@ public class DefaultExceptionContext implements ExceptionContext, Serializable { /** * {@inheritDoc} */ + @Override public DefaultExceptionContext setContextValue(String label, Object value) { for (final Iterator> iter = contextValues.iterator(); iter.hasNext();) { final Pair p = iter.next(); @@ -71,6 +73,7 @@ public class DefaultExceptionContext implements ExceptionContext, Serializable { /** * {@inheritDoc} */ + @Override public List getContextValues(String label) { final List values = new ArrayList(); for (final Pair pair : contextValues) { @@ -84,6 +87,7 @@ public class DefaultExceptionContext implements ExceptionContext, Serializable { /** * {@inheritDoc} */ + @Override public Object getFirstContextValue(String label) { for (final Pair pair : contextValues) { if (StringUtils.equals(label, pair.getKey())) { @@ -96,6 +100,7 @@ public class DefaultExceptionContext implements ExceptionContext, Serializable { /** * {@inheritDoc} */ + @Override public Set getContextLabels() { final Set labels = new HashSet(); for (final Pair pair : contextValues) { @@ -107,6 +112,7 @@ public class DefaultExceptionContext implements ExceptionContext, Serializable { /** * {@inheritDoc} */ + @Override public List> getContextEntries() { return contextValues; } @@ -117,6 +123,7 @@ public class DefaultExceptionContext implements ExceptionContext, Serializable { * @param baseMessage the base exception message without context information appended * @return the exception message with context information appended, never null */ + @Override public String getFormattedExceptionMessage(String baseMessage){ StringBuilder buffer = new StringBuilder(256); if (baseMessage != null) { diff --git a/src/main/java/org/apache/commons/lang3/math/Fraction.java b/src/main/java/org/apache/commons/lang3/math/Fraction.java index 21bbf9d5b..19269deaa 100644 --- a/src/main/java/org/apache/commons/lang3/math/Fraction.java +++ b/src/main/java/org/apache/commons/lang3/math/Fraction.java @@ -879,6 +879,7 @@ public final class Fraction extends Number implements Comparable { * @throws ClassCastException if the object is not a Fraction * @throws NullPointerException if the object is null */ + @Override public int compareTo(Fraction other) { if (this==other) { return 0; diff --git a/src/main/java/org/apache/commons/lang3/mutable/MutableBoolean.java b/src/main/java/org/apache/commons/lang3/mutable/MutableBoolean.java index 15ebba895..9cd776d4c 100644 --- a/src/main/java/org/apache/commons/lang3/mutable/MutableBoolean.java +++ b/src/main/java/org/apache/commons/lang3/mutable/MutableBoolean.java @@ -74,6 +74,7 @@ public class MutableBoolean implements Mutable, Serializable, Comparabl * * @return the value as a Boolean, never null */ + @Override public Boolean getValue() { return Boolean.valueOf(this.value); } @@ -93,6 +94,7 @@ public class MutableBoolean implements Mutable, Serializable, Comparabl * @param value the value to set, not null * @throws NullPointerException if the object is null */ + @Override public void setValue(Boolean value) { this.value = value.booleanValue(); } @@ -174,6 +176,7 @@ public class MutableBoolean implements Mutable, Serializable, Comparabl * @return negative if this is less, zero if equal, positive if greater * where false is less than true */ + @Override public int compareTo(MutableBoolean other) { boolean anotherVal = other.value; return value == anotherVal ? 0 : (value ? 1 : -1); diff --git a/src/main/java/org/apache/commons/lang3/mutable/MutableByte.java b/src/main/java/org/apache/commons/lang3/mutable/MutableByte.java index 37064d81e..73605aeae 100644 --- a/src/main/java/org/apache/commons/lang3/mutable/MutableByte.java +++ b/src/main/java/org/apache/commons/lang3/mutable/MutableByte.java @@ -83,6 +83,7 @@ public class MutableByte extends Number implements Comparable, Muta * * @return the value as a Byte, never null */ + @Override public Byte getValue() { return Byte.valueOf(this.value); } @@ -102,6 +103,7 @@ public class MutableByte extends Number implements Comparable, Muta * @param value the value to set, not null * @throws NullPointerException if the object is null */ + @Override public void setValue(Number value) { this.value = value.byteValue(); } @@ -264,6 +266,7 @@ public class MutableByte extends Number implements Comparable, Muta * @param other the other mutable to compare to, not null * @return negative if this is less, zero if equal, positive if greater */ + @Override public int compareTo(MutableByte other) { byte anotherVal = other.value; return value < anotherVal ? -1 : (value == anotherVal ? 0 : 1); diff --git a/src/main/java/org/apache/commons/lang3/mutable/MutableDouble.java b/src/main/java/org/apache/commons/lang3/mutable/MutableDouble.java index b36abe29d..54cc68ae0 100644 --- a/src/main/java/org/apache/commons/lang3/mutable/MutableDouble.java +++ b/src/main/java/org/apache/commons/lang3/mutable/MutableDouble.java @@ -83,6 +83,7 @@ public class MutableDouble extends Number implements Comparable, * * @return the value as a Double, never null */ + @Override public Double getValue() { return Double.valueOf(this.value); } @@ -102,6 +103,7 @@ public class MutableDouble extends Number implements Comparable, * @param value the value to set, not null * @throws NullPointerException if the object is null */ + @Override public void setValue(Number value) { this.value = value.doubleValue(); } @@ -293,6 +295,7 @@ public class MutableDouble extends Number implements Comparable, * @param other the other mutable to compare to, not null * @return negative if this is less, zero if equal, positive if greater */ + @Override public int compareTo(MutableDouble other) { double anotherVal = other.value; return Double.compare(value, anotherVal); diff --git a/src/main/java/org/apache/commons/lang3/mutable/MutableFloat.java b/src/main/java/org/apache/commons/lang3/mutable/MutableFloat.java index ed871910e..4a3b23872 100644 --- a/src/main/java/org/apache/commons/lang3/mutable/MutableFloat.java +++ b/src/main/java/org/apache/commons/lang3/mutable/MutableFloat.java @@ -83,6 +83,7 @@ public class MutableFloat extends Number implements Comparable, Mu * * @return the value as a Float, never null */ + @Override public Float getValue() { return Float.valueOf(this.value); } @@ -102,6 +103,7 @@ public class MutableFloat extends Number implements Comparable, Mu * @param value the value to set, not null * @throws NullPointerException if the object is null */ + @Override public void setValue(Number value) { this.value = value.floatValue(); } @@ -294,6 +296,7 @@ public class MutableFloat extends Number implements Comparable, Mu * @param other the other mutable to compare to, not null * @return negative if this is less, zero if equal, positive if greater */ + @Override public int compareTo(MutableFloat other) { float anotherVal = other.value; return Float.compare(value, anotherVal); diff --git a/src/main/java/org/apache/commons/lang3/mutable/MutableInt.java b/src/main/java/org/apache/commons/lang3/mutable/MutableInt.java index c8e396755..e5cdff5c7 100644 --- a/src/main/java/org/apache/commons/lang3/mutable/MutableInt.java +++ b/src/main/java/org/apache/commons/lang3/mutable/MutableInt.java @@ -83,6 +83,7 @@ public class MutableInt extends Number implements Comparable, Mutabl * * @return the value as a Integer, never null */ + @Override public Integer getValue() { return Integer.valueOf(this.value); } @@ -102,6 +103,7 @@ public class MutableInt extends Number implements Comparable, Mutabl * @param value the value to set, not null * @throws NullPointerException if the object is null */ + @Override public void setValue(Number value) { this.value = value.intValue(); } @@ -254,6 +256,7 @@ public class MutableInt extends Number implements Comparable, Mutabl * @param other the other mutable to compare to, not null * @return negative if this is less, zero if equal, positive if greater */ + @Override public int compareTo(MutableInt other) { int anotherVal = other.value; return value < anotherVal ? -1 : (value == anotherVal ? 0 : 1); diff --git a/src/main/java/org/apache/commons/lang3/mutable/MutableLong.java b/src/main/java/org/apache/commons/lang3/mutable/MutableLong.java index 275450d61..cf12300e7 100644 --- a/src/main/java/org/apache/commons/lang3/mutable/MutableLong.java +++ b/src/main/java/org/apache/commons/lang3/mutable/MutableLong.java @@ -83,6 +83,7 @@ public class MutableLong extends Number implements Comparable, Muta * * @return the value as a Long, never null */ + @Override public Long getValue() { return Long.valueOf(this.value); } @@ -102,6 +103,7 @@ public class MutableLong extends Number implements Comparable, Muta * @param value the value to set, not null * @throws NullPointerException if the object is null */ + @Override public void setValue(Number value) { this.value = value.longValue(); } @@ -254,6 +256,7 @@ public class MutableLong extends Number implements Comparable, Muta * @param other the other mutable to compare to, not null * @return negative if this is less, zero if equal, positive if greater */ + @Override public int compareTo(MutableLong other) { long anotherVal = other.value; return value < anotherVal ? -1 : (value == anotherVal ? 0 : 1); diff --git a/src/main/java/org/apache/commons/lang3/mutable/MutableObject.java b/src/main/java/org/apache/commons/lang3/mutable/MutableObject.java index 2c7adb14a..4198e2749 100644 --- a/src/main/java/org/apache/commons/lang3/mutable/MutableObject.java +++ b/src/main/java/org/apache/commons/lang3/mutable/MutableObject.java @@ -60,6 +60,7 @@ public class MutableObject implements Mutable, Serializable { * * @return the value, may be null */ + @Override public T getValue() { return this.value; } @@ -69,6 +70,7 @@ public class MutableObject implements Mutable, Serializable { * * @param value the value to set */ + @Override public void setValue(T value) { this.value = value; } diff --git a/src/main/java/org/apache/commons/lang3/mutable/MutableShort.java b/src/main/java/org/apache/commons/lang3/mutable/MutableShort.java index 315e07d3b..5c948f997 100644 --- a/src/main/java/org/apache/commons/lang3/mutable/MutableShort.java +++ b/src/main/java/org/apache/commons/lang3/mutable/MutableShort.java @@ -83,6 +83,7 @@ public class MutableShort extends Number implements Comparable, Mu * * @return the value as a Short, never null */ + @Override public Short getValue() { return Short.valueOf(this.value); } @@ -102,6 +103,7 @@ public class MutableShort extends Number implements Comparable, Mu * @param value the value to set, not null * @throws NullPointerException if the object is null */ + @Override public void setValue(Number value) { this.value = value.shortValue(); } @@ -264,6 +266,7 @@ public class MutableShort extends Number implements Comparable, Mu * @param other the other mutable to compare to, not null * @return negative if this is less, zero if equal, positive if greater */ + @Override public int compareTo(MutableShort other) { short anotherVal = other.value; return value < anotherVal ? -1 : (value == anotherVal ? 0 : 1); diff --git a/src/main/java/org/apache/commons/lang3/text/StrBuilder.java b/src/main/java/org/apache/commons/lang3/text/StrBuilder.java index 6aec7a1eb..b97cbd7ae 100644 --- a/src/main/java/org/apache/commons/lang3/text/StrBuilder.java +++ b/src/main/java/org/apache/commons/lang3/text/StrBuilder.java @@ -182,6 +182,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable { * * @return the length */ + @Override public int length() { return size; } @@ -302,6 +303,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable { * @return the character at the index * @throws IndexOutOfBoundsException if the index is invalid */ + @Override public char charAt(int index) { if (index < 0 || index >= length()) { throw new StringIndexOutOfBoundsException(index); @@ -470,6 +472,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable { * @return this, to enable chaining * @since 3.0 */ + @Override public StrBuilder append(CharSequence seq) { if (seq == null) { return appendNull(); @@ -487,6 +490,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable { * @return this, to enable chaining * @since 3.0 */ + @Override public StrBuilder append(CharSequence seq, int startIndex, int length) { if (seq == null) { return appendNull(); @@ -721,6 +725,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable { * @return this, to enable chaining * @since 3.0 */ + @Override public StrBuilder append(char ch) { int len = length(); ensureCapacity(len + 1); @@ -2005,6 +2010,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable { * {@inheritDoc} * @since 3.0 */ + @Override public CharSequence subSequence(int startIndex, int endIndex) { if (startIndex < 0) { throw new StringIndexOutOfBoundsException(startIndex); diff --git a/src/main/java/org/apache/commons/lang3/text/StrTokenizer.java b/src/main/java/org/apache/commons/lang3/text/StrTokenizer.java index 959f4bd58..0b1269078 100644 --- a/src/main/java/org/apache/commons/lang3/text/StrTokenizer.java +++ b/src/main/java/org/apache/commons/lang3/text/StrTokenizer.java @@ -500,6 +500,7 @@ public class StrTokenizer implements ListIterator, Cloneable { * * @return true if there are more tokens */ + @Override public boolean hasNext() { checkTokenized(); return tokenPos < tokens.length; @@ -511,6 +512,7 @@ public class StrTokenizer implements ListIterator, Cloneable { * @return the next String token * @throws NoSuchElementException if there are no more elements */ + @Override public String next() { if (hasNext()) { return tokens[tokenPos++]; @@ -523,6 +525,7 @@ public class StrTokenizer implements ListIterator, Cloneable { * * @return the next token index */ + @Override public int nextIndex() { return tokenPos; } @@ -532,6 +535,7 @@ public class StrTokenizer implements ListIterator, Cloneable { * * @return true if there are previous tokens */ + @Override public boolean hasPrevious() { checkTokenized(); return tokenPos > 0; @@ -542,6 +546,7 @@ public class StrTokenizer implements ListIterator, Cloneable { * * @return the previous token */ + @Override public String previous() { if (hasPrevious()) { return tokens[--tokenPos]; @@ -554,6 +559,7 @@ public class StrTokenizer implements ListIterator, Cloneable { * * @return the previous token index */ + @Override public int previousIndex() { return tokenPos - 1; } @@ -563,6 +569,7 @@ public class StrTokenizer implements ListIterator, Cloneable { * * @throws UnsupportedOperationException always */ + @Override public void remove() { throw new UnsupportedOperationException("remove() is unsupported"); } @@ -572,6 +579,7 @@ public class StrTokenizer implements ListIterator, Cloneable { * @param obj this parameter ignored. * @throws UnsupportedOperationException always */ + @Override public void set(String obj) { throw new UnsupportedOperationException("set() is unsupported"); } @@ -581,6 +589,7 @@ public class StrTokenizer implements ListIterator, Cloneable { * @param obj this parameter ignored. * @throws UnsupportedOperationException always */ + @Override public void add(String obj) { throw new UnsupportedOperationException("add() is unsupported"); } diff --git a/src/main/java/org/apache/commons/lang3/time/DateUtils.java b/src/main/java/org/apache/commons/lang3/time/DateUtils.java index 8f48909fa..cd412b90b 100644 --- a/src/main/java/org/apache/commons/lang3/time/DateUtils.java +++ b/src/main/java/org/apache/commons/lang3/time/DateUtils.java @@ -1800,6 +1800,7 @@ public class DateUtils { * * @return true if the iterator has yet to reach the end date */ + @Override public boolean hasNext() { return spot.before(endFinal); } @@ -1809,6 +1810,7 @@ public class DateUtils { * * @return Object calendar for the next date */ + @Override public Calendar next() { if (spot.equals(endFinal)) { throw new NoSuchElementException(); @@ -1823,6 +1825,7 @@ public class DateUtils { * @throws UnsupportedOperationException * @see java.util.Iterator#remove() */ + @Override public void remove() { throw new UnsupportedOperationException(); } diff --git a/src/main/java/org/apache/commons/lang3/time/FastDateFormat.java b/src/main/java/org/apache/commons/lang3/time/FastDateFormat.java index e3d77557c..4a3608d25 100644 --- a/src/main/java/org/apache/commons/lang3/time/FastDateFormat.java +++ b/src/main/java/org/apache/commons/lang3/time/FastDateFormat.java @@ -393,6 +393,7 @@ public class FastDateFormat extends Format implements DateParser, DatePrinter { * @return the formatted string * @since 2.1 */ + @Override public String format(long millis) { return format(new Date(millis)); } @@ -403,6 +404,7 @@ public class FastDateFormat extends Format implements DateParser, DatePrinter { * @param date the date to format * @return the formatted string */ + @Override public String format(Date date) { return printer.format(date); } @@ -413,6 +415,7 @@ public class FastDateFormat extends Format implements DateParser, DatePrinter { * @param calendar the calendar to format * @return the formatted string */ + @Override public String format(Calendar calendar) { return printer.format(calendar); } @@ -426,6 +429,7 @@ public class FastDateFormat extends Format implements DateParser, DatePrinter { * @return the specified string buffer * @since 2.1 */ + @Override public StringBuffer format(long millis, StringBuffer buf) { return printer.format(millis, buf); } @@ -438,6 +442,7 @@ public class FastDateFormat extends Format implements DateParser, DatePrinter { * @param buf the buffer to format into * @return the specified string buffer */ + @Override public StringBuffer format(Date date, StringBuffer buf) { return printer.format(date, buf); } @@ -450,6 +455,7 @@ public class FastDateFormat extends Format implements DateParser, DatePrinter { * @param buf the buffer to format into * @return the specified string buffer */ + @Override public StringBuffer format(Calendar calendar, StringBuffer buf) { return printer.format(calendar, buf); } @@ -461,6 +467,7 @@ public class FastDateFormat extends Format implements DateParser, DatePrinter { /* (non-Javadoc) * @see DateParser#parse(java.lang.String) */ + @Override public Date parse(String source) throws ParseException { return parser.parse(source); } @@ -468,6 +475,7 @@ public class FastDateFormat extends Format implements DateParser, DatePrinter { /* (non-Javadoc) * @see DateParser#parse(java.lang.String, java.text.ParsePosition) */ + @Override public Date parse(String source, ParsePosition pos) { return parser.parse(source, pos); } @@ -487,6 +495,7 @@ public class FastDateFormat extends Format implements DateParser, DatePrinter { * * @return the pattern, {@link java.text.SimpleDateFormat} compatible */ + @Override public String getPattern() { return printer.getPattern(); } @@ -498,6 +507,7 @@ public class FastDateFormat extends Format implements DateParser, DatePrinter { * * @return the time zone */ + @Override public TimeZone getTimeZone() { return printer.getTimeZone(); } @@ -507,6 +517,7 @@ public class FastDateFormat extends Format implements DateParser, DatePrinter { * * @return the locale */ + @Override public Locale getLocale() { return printer.getLocale(); } diff --git a/src/main/java/org/apache/commons/lang3/time/FastDateParser.java b/src/main/java/org/apache/commons/lang3/time/FastDateParser.java index 2c7240575..3b02dd17f 100644 --- a/src/main/java/org/apache/commons/lang3/time/FastDateParser.java +++ b/src/main/java/org/apache/commons/lang3/time/FastDateParser.java @@ -144,6 +144,7 @@ public class FastDateParser implements DateParser, Serializable { /* (non-Javadoc) * @see org.apache.commons.lang3.time.DateParser#getPattern() */ + @Override public String getPattern() { return pattern; } @@ -151,6 +152,7 @@ public class FastDateParser implements DateParser, Serializable { /* (non-Javadoc) * @see org.apache.commons.lang3.time.DateParser#getTimeZone() */ + @Override public TimeZone getTimeZone() { return timeZone; } @@ -158,6 +160,7 @@ public class FastDateParser implements DateParser, Serializable { /* (non-Javadoc) * @see org.apache.commons.lang3.time.DateParser#getLocale() */ + @Override public Locale getLocale() { return locale; } @@ -219,6 +222,7 @@ public class FastDateParser implements DateParser, Serializable { /* (non-Javadoc) * @see org.apache.commons.lang3.time.DateParser#parseObject(java.lang.String) */ + @Override public Object parseObject(String source) throws ParseException { return parse(source); } @@ -226,6 +230,7 @@ public class FastDateParser implements DateParser, Serializable { /* (non-Javadoc) * @see org.apache.commons.lang3.time.DateParser#parse(java.lang.String) */ + @Override public Date parse(String source) throws ParseException { Date date= parse(source, new ParsePosition(0)); if(date==null) { @@ -237,6 +242,7 @@ public class FastDateParser implements DateParser, Serializable { /* (non-Javadoc) * @see org.apache.commons.lang3.time.DateParser#parseObject(java.lang.String, java.text.ParsePosition) */ + @Override public Object parseObject(String source, ParsePosition pos) { return parse(source, pos); } @@ -244,6 +250,7 @@ public class FastDateParser implements DateParser, Serializable { /* (non-Javadoc) * @see org.apache.commons.lang3.time.DateParser#parse(java.lang.String, java.text.ParsePosition) */ + @Override public Date parse(String source, ParsePosition pos) { int offset= pos.getIndex(); Matcher matcher= parsePattern.matcher(source.substring(offset)); @@ -336,6 +343,7 @@ public class FastDateParser implements DateParser, Serializable { * ignore case comparison of keys */ private static final Comparator IGNORE_CASE_COMPARATOR = new Comparator () { + @Override public int compare(KeyValue left, KeyValue right) { return left.key.compareToIgnoreCase(right.key); } @@ -565,6 +573,7 @@ public class FastDateParser implements DateParser, Serializable { /** * {@inheritDoc} */ + @Override public boolean isNumber() { char c= formatField.charAt(0); if(c=='\'') { @@ -576,6 +585,7 @@ public class FastDateParser implements DateParser, Serializable { /** * {@inheritDoc} */ + @Override public boolean addRegex(FastDateParser parser, StringBuilder regex) { escapeRegex(regex, formatField, true); return false; @@ -584,6 +594,7 @@ public class FastDateParser implements DateParser, Serializable { /** * {@inheritDoc} */ + @Override public void setCalendar(FastDateParser parser, Calendar cal, String value) { } } @@ -605,6 +616,7 @@ public class FastDateParser implements DateParser, Serializable { /** * {@inheritDoc} */ + @Override public boolean isNumber() { return false; } @@ -612,6 +624,7 @@ public class FastDateParser implements DateParser, Serializable { /** * {@inheritDoc} */ + @Override public boolean addRegex(FastDateParser parser, StringBuilder regex) { regex.append('('); for(KeyValue textKeyValue : parser.getDisplayNames(field)) { @@ -624,6 +637,7 @@ public class FastDateParser implements DateParser, Serializable { /** * {@inheritDoc} */ + @Override public void setCalendar(FastDateParser parser, Calendar cal, String value) { KeyValue[] textKeyValues= parser.getDisplayNames(field); int idx= Arrays.binarySearch(textKeyValues, new KeyValue(value, -1), IGNORE_CASE_COMPARATOR); @@ -657,6 +671,7 @@ public class FastDateParser implements DateParser, Serializable { /** * {@inheritDoc} */ + @Override public boolean isNumber() { return true; } @@ -664,6 +679,7 @@ public class FastDateParser implements DateParser, Serializable { /** * {@inheritDoc} */ + @Override public boolean addRegex(FastDateParser parser, StringBuilder regex) { if(parser.isNextNumber()) { regex.append("(\\d{").append(parser.getFieldWidth()).append("}+)"); @@ -677,6 +693,7 @@ public class FastDateParser implements DateParser, Serializable { /** * {@inheritDoc} */ + @Override public void setCalendar(FastDateParser parser, Calendar cal, String value) { cal.set(field, modify(Integer.parseInt(value))); } @@ -742,6 +759,7 @@ public class FastDateParser implements DateParser, Serializable { /** * {@inheritDoc} */ + @Override public boolean isNumber() { return false; } @@ -749,6 +767,7 @@ public class FastDateParser implements DateParser, Serializable { /** * {@inheritDoc} */ + @Override public boolean addRegex(FastDateParser parser, StringBuilder regex) { regex.append(validTimeZoneChars); return true; @@ -757,6 +776,7 @@ public class FastDateParser implements DateParser, Serializable { /** * {@inheritDoc} */ + @Override public void setCalendar(FastDateParser parser, Calendar cal, String value) { TimeZone tz; if(value.charAt(0)=='+' || value.charAt(0)=='-') { @@ -781,6 +801,7 @@ public class FastDateParser implements DateParser, Serializable { private static final Strategy TEXT_MONTH_STRATEGY = new TextStrategy(Calendar.MONTH); private static final Strategy NUMBER_MONTH_STRATEGY = new NumberStrategy(Calendar.MONTH) { + @Override public int modify(int iValue) { return iValue-1; } @@ -793,11 +814,13 @@ public class FastDateParser implements DateParser, Serializable { private static final Strategy DAY_OF_WEEK_IN_MONTH_STRATEGY = new NumberStrategy(Calendar.DAY_OF_WEEK_IN_MONTH); private static final Strategy HOUR_OF_DAY_STRATEGY = new NumberStrategy(Calendar.HOUR_OF_DAY); private static final Strategy MODULO_HOUR_OF_DAY_STRATEGY = new NumberStrategy(Calendar.HOUR_OF_DAY) { + @Override public int modify(int iValue) { return iValue%24; } }; private static final Strategy MODULO_HOUR_STRATEGY = new NumberStrategy(Calendar.HOUR) { + @Override public int modify(int iValue) { return iValue%12; } diff --git a/src/main/java/org/apache/commons/lang3/time/FastDatePrinter.java b/src/main/java/org/apache/commons/lang3/time/FastDatePrinter.java index 0a4ca8595..cc1af9dfc 100644 --- a/src/main/java/org/apache/commons/lang3/time/FastDatePrinter.java +++ b/src/main/java/org/apache/commons/lang3/time/FastDatePrinter.java @@ -375,6 +375,7 @@ public class FastDatePrinter implements DatePrinter, Serializable { * @param pos the position - ignored * @return the buffer passed in */ + @Override public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { if (obj instanceof Date) { return format((Date) obj, toAppendTo); @@ -391,6 +392,7 @@ public class FastDatePrinter implements DatePrinter, Serializable { /* (non-Javadoc) * @see org.apache.commons.lang3.time.DatePrinter#format(long) */ + @Override public String format(long millis) { return format(new Date(millis)); } @@ -398,6 +400,7 @@ public class FastDatePrinter implements DatePrinter, Serializable { /* (non-Javadoc) * @see org.apache.commons.lang3.time.DatePrinter#format(java.util.Date) */ + @Override public String format(Date date) { Calendar c = new GregorianCalendar(mTimeZone, mLocale); // hard code GregorianCalendar c.setTime(date); @@ -407,6 +410,7 @@ public class FastDatePrinter implements DatePrinter, Serializable { /* (non-Javadoc) * @see org.apache.commons.lang3.time.DatePrinter#format(java.util.Calendar) */ + @Override public String format(Calendar calendar) { return format(calendar, new StringBuffer(mMaxLengthEstimate)).toString(); } @@ -414,6 +418,7 @@ public class FastDatePrinter implements DatePrinter, Serializable { /* (non-Javadoc) * @see org.apache.commons.lang3.time.DatePrinter#format(long, java.lang.StringBuffer) */ + @Override public StringBuffer format(long millis, StringBuffer buf) { return format(new Date(millis), buf); } @@ -421,6 +426,7 @@ public class FastDatePrinter implements DatePrinter, Serializable { /* (non-Javadoc) * @see org.apache.commons.lang3.time.DatePrinter#format(java.util.Date, java.lang.StringBuffer) */ + @Override public StringBuffer format(Date date, StringBuffer buf) { Calendar c = new GregorianCalendar(mTimeZone, mLocale); // hard code GregorianCalendar c.setTime(date); @@ -430,6 +436,7 @@ public class FastDatePrinter implements DatePrinter, Serializable { /* (non-Javadoc) * @see org.apache.commons.lang3.time.DatePrinter#format(java.util.Calendar, java.lang.StringBuffer) */ + @Override public StringBuffer format(Calendar calendar, StringBuffer buf) { return applyRules(calendar, buf); } @@ -454,6 +461,7 @@ public class FastDatePrinter implements DatePrinter, Serializable { /* (non-Javadoc) * @see org.apache.commons.lang3.time.DatePrinter#getPattern() */ + @Override public String getPattern() { return mPattern; } @@ -461,6 +469,7 @@ public class FastDatePrinter implements DatePrinter, Serializable { /* (non-Javadoc) * @see org.apache.commons.lang3.time.DatePrinter#getTimeZone() */ + @Override public TimeZone getTimeZone() { return mTimeZone; } @@ -468,6 +477,7 @@ public class FastDatePrinter implements DatePrinter, Serializable { /* (non-Javadoc) * @see org.apache.commons.lang3.time.DatePrinter#getLocale() */ + @Override public Locale getLocale() { return mLocale; } @@ -593,6 +603,7 @@ public class FastDatePrinter implements DatePrinter, Serializable { /** * {@inheritDoc} */ + @Override public int estimateLength() { return 1; } @@ -600,6 +611,7 @@ public class FastDatePrinter implements DatePrinter, Serializable { /** * {@inheritDoc} */ + @Override public void appendTo(StringBuffer buffer, Calendar calendar) { buffer.append(mValue); } @@ -624,6 +636,7 @@ public class FastDatePrinter implements DatePrinter, Serializable { /** * {@inheritDoc} */ + @Override public int estimateLength() { return mValue.length(); } @@ -631,6 +644,7 @@ public class FastDatePrinter implements DatePrinter, Serializable { /** * {@inheritDoc} */ + @Override public void appendTo(StringBuffer buffer, Calendar calendar) { buffer.append(mValue); } @@ -658,6 +672,7 @@ public class FastDatePrinter implements DatePrinter, Serializable { /** * {@inheritDoc} */ + @Override public int estimateLength() { int max = 0; for (int i=mValues.length; --i >= 0; ) { @@ -672,6 +687,7 @@ public class FastDatePrinter implements DatePrinter, Serializable { /** * {@inheritDoc} */ + @Override public void appendTo(StringBuffer buffer, Calendar calendar) { buffer.append(mValues[calendar.get(mField)]); } @@ -695,6 +711,7 @@ public class FastDatePrinter implements DatePrinter, Serializable { /** * {@inheritDoc} */ + @Override public int estimateLength() { return 4; } @@ -702,6 +719,7 @@ public class FastDatePrinter implements DatePrinter, Serializable { /** * {@inheritDoc} */ + @Override public void appendTo(StringBuffer buffer, Calendar calendar) { appendTo(buffer, calendar.get(mField)); } @@ -709,6 +727,7 @@ public class FastDatePrinter implements DatePrinter, Serializable { /** * {@inheritDoc} */ + @Override public final void appendTo(StringBuffer buffer, int value) { if (value < 10) { buffer.append((char)(value + '0')); @@ -738,6 +757,7 @@ public class FastDatePrinter implements DatePrinter, Serializable { /** * {@inheritDoc} */ + @Override public int estimateLength() { return 2; } @@ -745,6 +765,7 @@ public class FastDatePrinter implements DatePrinter, Serializable { /** * {@inheritDoc} */ + @Override public void appendTo(StringBuffer buffer, Calendar calendar) { appendTo(buffer, calendar.get(Calendar.MONTH) + 1); } @@ -752,6 +773,7 @@ public class FastDatePrinter implements DatePrinter, Serializable { /** * {@inheritDoc} */ + @Override public final void appendTo(StringBuffer buffer, int value) { if (value < 10) { buffer.append((char)(value + '0')); @@ -787,6 +809,7 @@ public class FastDatePrinter implements DatePrinter, Serializable { /** * {@inheritDoc} */ + @Override public int estimateLength() { return 4; } @@ -794,6 +817,7 @@ public class FastDatePrinter implements DatePrinter, Serializable { /** * {@inheritDoc} */ + @Override public void appendTo(StringBuffer buffer, Calendar calendar) { appendTo(buffer, calendar.get(mField)); } @@ -801,6 +825,7 @@ public class FastDatePrinter implements DatePrinter, Serializable { /** * {@inheritDoc} */ + @Override public final void appendTo(StringBuffer buffer, int value) { if (value < 100) { for (int i = mSize; --i >= 2; ) { @@ -842,6 +867,7 @@ public class FastDatePrinter implements DatePrinter, Serializable { /** * {@inheritDoc} */ + @Override public int estimateLength() { return 2; } @@ -849,6 +875,7 @@ public class FastDatePrinter implements DatePrinter, Serializable { /** * {@inheritDoc} */ + @Override public void appendTo(StringBuffer buffer, Calendar calendar) { appendTo(buffer, calendar.get(mField)); } @@ -856,6 +883,7 @@ public class FastDatePrinter implements DatePrinter, Serializable { /** * {@inheritDoc} */ + @Override public final void appendTo(StringBuffer buffer, int value) { if (value < 100) { buffer.append((char)(value / 10 + '0')); @@ -882,6 +910,7 @@ public class FastDatePrinter implements DatePrinter, Serializable { /** * {@inheritDoc} */ + @Override public int estimateLength() { return 2; } @@ -889,6 +918,7 @@ public class FastDatePrinter implements DatePrinter, Serializable { /** * {@inheritDoc} */ + @Override public void appendTo(StringBuffer buffer, Calendar calendar) { appendTo(buffer, calendar.get(Calendar.YEAR) % 100); } @@ -896,6 +926,7 @@ public class FastDatePrinter implements DatePrinter, Serializable { /** * {@inheritDoc} */ + @Override public final void appendTo(StringBuffer buffer, int value) { buffer.append((char)(value / 10 + '0')); buffer.append((char)(value % 10 + '0')); @@ -918,6 +949,7 @@ public class FastDatePrinter implements DatePrinter, Serializable { /** * {@inheritDoc} */ + @Override public int estimateLength() { return 2; } @@ -925,6 +957,7 @@ public class FastDatePrinter implements DatePrinter, Serializable { /** * {@inheritDoc} */ + @Override public void appendTo(StringBuffer buffer, Calendar calendar) { appendTo(buffer, calendar.get(Calendar.MONTH) + 1); } @@ -932,6 +965,7 @@ public class FastDatePrinter implements DatePrinter, Serializable { /** * {@inheritDoc} */ + @Override public final void appendTo(StringBuffer buffer, int value) { buffer.append((char)(value / 10 + '0')); buffer.append((char)(value % 10 + '0')); @@ -957,6 +991,7 @@ public class FastDatePrinter implements DatePrinter, Serializable { /** * {@inheritDoc} */ + @Override public int estimateLength() { return mRule.estimateLength(); } @@ -964,6 +999,7 @@ public class FastDatePrinter implements DatePrinter, Serializable { /** * {@inheritDoc} */ + @Override public void appendTo(StringBuffer buffer, Calendar calendar) { int value = calendar.get(Calendar.HOUR); if (value == 0) { @@ -975,6 +1011,7 @@ public class FastDatePrinter implements DatePrinter, Serializable { /** * {@inheritDoc} */ + @Override public void appendTo(StringBuffer buffer, int value) { mRule.appendTo(buffer, value); } @@ -999,6 +1036,7 @@ public class FastDatePrinter implements DatePrinter, Serializable { /** * {@inheritDoc} */ + @Override public int estimateLength() { return mRule.estimateLength(); } @@ -1006,6 +1044,7 @@ public class FastDatePrinter implements DatePrinter, Serializable { /** * {@inheritDoc} */ + @Override public void appendTo(StringBuffer buffer, Calendar calendar) { int value = calendar.get(Calendar.HOUR_OF_DAY); if (value == 0) { @@ -1017,6 +1056,7 @@ public class FastDatePrinter implements DatePrinter, Serializable { /** * {@inheritDoc} */ + @Override public void appendTo(StringBuffer buffer, int value) { mRule.appendTo(buffer, value); } @@ -1074,6 +1114,7 @@ public class FastDatePrinter implements DatePrinter, Serializable { /** * {@inheritDoc} */ + @Override public int estimateLength() { return Math.max(mStandard.length(), mDaylight.length()); } @@ -1081,6 +1122,7 @@ public class FastDatePrinter implements DatePrinter, Serializable { /** * {@inheritDoc} */ + @Override public void appendTo(StringBuffer buffer, Calendar calendar) { if (mTimeZone.useDaylightTime() && calendar.get(Calendar.DST_OFFSET) != 0) { buffer.append(mDaylight); @@ -1112,6 +1154,7 @@ public class FastDatePrinter implements DatePrinter, Serializable { /** * {@inheritDoc} */ + @Override public int estimateLength() { return 5; } @@ -1119,6 +1162,7 @@ public class FastDatePrinter implements DatePrinter, Serializable { /** * {@inheritDoc} */ + @Override public void appendTo(StringBuffer buffer, Calendar calendar) { int offset = calendar.get(Calendar.ZONE_OFFSET) + calendar.get(Calendar.DST_OFFSET); diff --git a/src/main/java/org/apache/commons/lang3/tuple/ImmutablePair.java b/src/main/java/org/apache/commons/lang3/tuple/ImmutablePair.java index 5c5d03d63..10ad357c8 100644 --- a/src/main/java/org/apache/commons/lang3/tuple/ImmutablePair.java +++ b/src/main/java/org/apache/commons/lang3/tuple/ImmutablePair.java @@ -96,6 +96,7 @@ public final class ImmutablePair extends Pair { * @return never * @throws UnsupportedOperationException as this operation is not supported */ + @Override public R setValue(R value) { throw new UnsupportedOperationException(); } diff --git a/src/main/java/org/apache/commons/lang3/tuple/MutablePair.java b/src/main/java/org/apache/commons/lang3/tuple/MutablePair.java index e8e72936a..883fdea5b 100644 --- a/src/main/java/org/apache/commons/lang3/tuple/MutablePair.java +++ b/src/main/java/org/apache/commons/lang3/tuple/MutablePair.java @@ -114,6 +114,7 @@ public class MutablePair extends Pair { * @param value the right value to set, not null * @return the old value for the right element */ + @Override public R setValue(R value) { R result = getRight(); setRight(value); diff --git a/src/main/java/org/apache/commons/lang3/tuple/Pair.java b/src/main/java/org/apache/commons/lang3/tuple/Pair.java index 3a9279e16..ce120bc05 100644 --- a/src/main/java/org/apache/commons/lang3/tuple/Pair.java +++ b/src/main/java/org/apache/commons/lang3/tuple/Pair.java @@ -87,6 +87,7 @@ public abstract class Pair implements Map.Entry, Comparable implements Map.Entry, Comparable implements Map.Entry, Comparable other) { return new CompareToBuilder().append(getLeft(), other.getLeft()) .append(getRight(), other.getRight()).toComparison(); diff --git a/src/main/java/org/apache/commons/lang3/tuple/Triple.java b/src/main/java/org/apache/commons/lang3/tuple/Triple.java index 5c485d739..e3390f107 100644 --- a/src/main/java/org/apache/commons/lang3/tuple/Triple.java +++ b/src/main/java/org/apache/commons/lang3/tuple/Triple.java @@ -91,6 +91,7 @@ public abstract class Triple implements Comparable>, Se * @param other the other triple, not null * @return negative if this is less, zero if equal, positive if greater */ + @Override public int compareTo(Triple other) { return new CompareToBuilder().append(getLeft(), other.getLeft()) .append(getMiddle(), other.getMiddle()) diff --git a/src/test/java/org/apache/commons/lang3/AnnotationUtilsTest.java b/src/test/java/org/apache/commons/lang3/AnnotationUtilsTest.java index c3b995d1c..7ff7b0a3c 100644 --- a/src/test/java/org/apache/commons/lang3/AnnotationUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/AnnotationUtilsTest.java @@ -451,6 +451,7 @@ public class AnnotationUtilsTest { InvocationHandler generatedTestInvocationHandler = new InvocationHandler() { + @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if ("equals".equals(method.getName()) && method.getParameterTypes().length == 1) { return Boolean.valueOf(proxy == args[0]); diff --git a/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java b/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java index 890e5b0fa..b5beb6f2d 100644 --- a/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java @@ -228,12 +228,15 @@ public class ArrayUtilsTest extends TestCase { } catch (IllegalArgumentException ex) {} map = ArrayUtils.toMap(new Object[] {new Map.Entry() { + @Override public Object getKey() { return "foo"; } + @Override public Object getValue() { return "bar"; } + @Override public Object setValue(Object value) { throw new UnsupportedOperationException(); } diff --git a/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java b/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java index e91d12661..e3981e32c 100644 --- a/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java @@ -489,14 +489,17 @@ public class ObjectUtilsTest { this.value = value; } + @Override public char charAt(int arg0) { return value.charAt(arg0); } + @Override public int length() { return value.length(); } + @Override public CharSequence subSequence(int arg0, int arg1) { return value.subSequence(arg0, arg1); } @@ -509,6 +512,7 @@ public class ObjectUtilsTest { static final class CharSequenceComparator implements Comparator { + @Override public int compare(CharSequence o1, CharSequence o2) { return o1.toString().compareTo(o2.toString()); } diff --git a/src/test/java/org/apache/commons/lang3/RangeTest.java b/src/test/java/org/apache/commons/lang3/RangeTest.java index 7affdb270..bf971c833 100644 --- a/src/test/java/org/apache/commons/lang3/RangeTest.java +++ b/src/test/java/org/apache/commons/lang3/RangeTest.java @@ -67,6 +67,7 @@ public class RangeTest { public void testComparableConstructors() { Comparable c = new Comparable() { + @Override public int compareTo(Object other) { return 1; } @@ -80,6 +81,7 @@ public class RangeTest { @Test public void testIsWithCompare(){ Comparator c = new Comparator(){ + @Override public int compare(Integer o1, Integer o2) { return 0; // all integers are equal } @@ -98,6 +100,7 @@ public class RangeTest { public void testBetweenWithCompare(){ // TODO add tests with a better comparator Comparator c = new Comparator(){ + @Override public int compare(Integer o1, Integer o2) { return 0; // all integers are equal } diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java index 42dc6673a..4a9bf4e61 100644 --- a/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java +++ b/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java @@ -453,14 +453,17 @@ public class StringUtilsEqualsIndexOfTest extends TestCase { this.seq = seq; } + @Override public char charAt(int index) { return seq.charAt(index); } + @Override public int length() { return seq.length(); } + @Override public CharSequence subSequence(int start, int end) { return new CustomCharSequence(seq.subSequence(start, end)); } @@ -474,6 +477,7 @@ public class StringUtilsEqualsIndexOfTest extends TestCase { return seq.equals(other.seq); } + @Override public String toString() { return seq.toString(); } diff --git a/src/test/java/org/apache/commons/lang3/builder/CompareToBuilderTest.java b/src/test/java/org/apache/commons/lang3/builder/CompareToBuilderTest.java index c39b4794f..190d1b1bc 100644 --- a/src/test/java/org/apache/commons/lang3/builder/CompareToBuilderTest.java +++ b/src/test/java/org/apache/commons/lang3/builder/CompareToBuilderTest.java @@ -57,6 +57,7 @@ public class CompareToBuilderTest { public int getA() { return a; } + @Override public int compareTo(TestObject rhs) { return a < rhs.a ? -1 : a > rhs.a ? +1 : 0; } diff --git a/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderConcurrencyTest.java b/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderConcurrencyTest.java index a52d11a3e..67f1bd7c6 100644 --- a/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderConcurrencyTest.java +++ b/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderConcurrencyTest.java @@ -90,6 +90,7 @@ public class ReflectionToStringBuilderConcurrencyTest { final ExecutorService threadPool = Executors.newFixedThreadPool(2); // Consumes toStrings Callable consumer = new Callable() { + @Override public Integer call() { for (int i = 0; i < REPEAT; i++) { String s = ReflectionToStringBuilder.toString(holder); @@ -100,6 +101,7 @@ public class ReflectionToStringBuilderConcurrencyTest { }; // Produces changes in the list Callable producer = new Callable() { + @Override public Integer call() { for (int i = 0; i < DATA_SIZE; i++) { list.remove(list.get(0)); diff --git a/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderMutateInspectConcurrencyTest.java b/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderMutateInspectConcurrencyTest.java index adf6208e5..66d89ae9c 100644 --- a/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderMutateInspectConcurrencyTest.java +++ b/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderMutateInspectConcurrencyTest.java @@ -67,6 +67,7 @@ public class ReflectionToStringBuilderMutateInspectConcurrencyTest { this.testFixture = testFixture; } + @Override public void run() { if (random.nextBoolean()) { testFixture.add(); @@ -84,6 +85,7 @@ public class ReflectionToStringBuilderMutateInspectConcurrencyTest { this.testFixture = testFixture; } + @Override public void run() { ReflectionToStringBuilder.toString(testFixture); } diff --git a/src/test/java/org/apache/commons/lang3/builder/ToStringStyleConcurrencyTest.java b/src/test/java/org/apache/commons/lang3/builder/ToStringStyleConcurrencyTest.java index 6d74b5284..53b3b084a 100644 --- a/src/test/java/org/apache/commons/lang3/builder/ToStringStyleConcurrencyTest.java +++ b/src/test/java/org/apache/commons/lang3/builder/ToStringStyleConcurrencyTest.java @@ -90,6 +90,7 @@ public class ToStringStyleConcurrencyTest { final ExecutorService threadPool = Executors.newFixedThreadPool(2); // Consumes toStrings Callable consumer = new Callable() { + @Override public Integer call() { for (int i = 0; i < REPEAT; i++) { // Calls ToStringStyle diff --git a/src/test/java/org/apache/commons/lang3/concurrent/CallableBackgroundInitializerTest.java b/src/test/java/org/apache/commons/lang3/concurrent/CallableBackgroundInitializerTest.java index 2f9b10923..b0cd01392 100644 --- a/src/test/java/org/apache/commons/lang3/concurrent/CallableBackgroundInitializerTest.java +++ b/src/test/java/org/apache/commons/lang3/concurrent/CallableBackgroundInitializerTest.java @@ -91,6 +91,7 @@ public class CallableBackgroundInitializerTest extends TestCase { /** * Records this invocation and returns the test result. */ + @Override public Integer call() throws Exception { callCount++; return RESULT; diff --git a/src/test/java/org/apache/commons/lang3/event/EventListenerSupportTest.java b/src/test/java/org/apache/commons/lang3/event/EventListenerSupportTest.java index 0d1e078ca..edb1df4c4 100644 --- a/src/test/java/org/apache/commons/lang3/event/EventListenerSupportTest.java +++ b/src/test/java/org/apache/commons/lang3/event/EventListenerSupportTest.java @@ -147,6 +147,7 @@ public class EventListenerSupportTest extends TestCase EventListenerSupport listenerSupport = EventListenerSupport.create(VetoableChangeListener.class); listenerSupport.addListener(new VetoableChangeListener() { + @Override public void vetoableChange(PropertyChangeEvent e) { } }); @@ -220,6 +221,7 @@ public class EventListenerSupportTest extends TestCase { listenerSupport.addListener(new VetoableChangeListener() { + @Override public void vetoableChange(PropertyChangeEvent e) { listenerSupport.removeListener(this); @@ -231,6 +233,7 @@ public class EventListenerSupportTest extends TestCase { return new VetoableChangeListener() { + @Override public void vetoableChange(PropertyChangeEvent e) { calledListeners.add(this); diff --git a/src/test/java/org/apache/commons/lang3/event/EventUtilsTest.java b/src/test/java/org/apache/commons/lang3/event/EventUtilsTest.java index ba3ca06aa..2f49bf8fa 100644 --- a/src/test/java/org/apache/commons/lang3/event/EventUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/event/EventUtilsTest.java @@ -83,6 +83,7 @@ public class EventUtilsTest extends TestCase { EventUtils.addEventListener(src, PropertyChangeListener.class, new PropertyChangeListener() { + @Override public void propertyChange(PropertyChangeEvent e) { // Do nothing! @@ -201,6 +202,7 @@ public class EventUtilsTest extends TestCase return count == null ? 0 : count.intValue(); } + @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { Integer count = eventCounts.get(method.getName()); diff --git a/src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java b/src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java index 581d86fed..b481dc575 100644 --- a/src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java @@ -115,10 +115,12 @@ public class MethodUtilsTest { } private static class TestMutable implements Mutable { + @Override public Object getValue() { return null; } + @Override public void setValue(Object value) { } } diff --git a/src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java b/src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java index 1abac30e1..b7d31aff6 100644 --- a/src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java +++ b/src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java @@ -412,6 +412,7 @@ public class ExtendedMessageFormatTest extends TestCase { */ private static class LowerCaseFormatFactory implements FormatFactory { private static final Format LOWER_INSTANCE = new LowerCaseFormat(); + @Override public Format getFormat(String name, String arguments, Locale locale) { return LOWER_INSTANCE; } @@ -421,6 +422,7 @@ public class ExtendedMessageFormatTest extends TestCase { */ private static class UpperCaseFormatFactory implements FormatFactory { private static final Format UPPER_INSTANCE = new UpperCaseFormat(); + @Override public Format getFormat(String name, String arguments, Locale locale) { return UPPER_INSTANCE; } @@ -429,6 +431,7 @@ public class ExtendedMessageFormatTest extends TestCase { * {@link FormatFactory} implementation to override date format "short" to "default". */ private static class OverrideShortDateFormatFactory implements FormatFactory { + @Override public Format getFormat(String name, String arguments, Locale locale) { return !"short".equals(arguments) ? null : locale == null ? DateFormat diff --git a/src/test/java/org/apache/commons/lang3/time/FastDateFormatTest.java b/src/test/java/org/apache/commons/lang3/time/FastDateFormatTest.java index df7bb3265..3818e804d 100644 --- a/src/test/java/org/apache/commons/lang3/time/FastDateFormatTest.java +++ b/src/test/java/org/apache/commons/lang3/time/FastDateFormatTest.java @@ -281,6 +281,7 @@ public class FastDateFormatTest { for(int i= 0; i