Browse Source

SonarQube: missing annotations on overridden methods

(major code smell)
master
Gintas Grigelionis 6 years ago
parent
commit
e8762432be
23 changed files with 96 additions and 27 deletions
  1. +22
    -21
      src/main/org/apache/tools/ant/AntClassLoader.java
  2. +1
    -0
      src/main/org/apache/tools/ant/BuildException.java
  3. +1
    -0
      src/main/org/apache/tools/ant/Evaluable.java
  4. +1
    -0
      src/main/org/apache/tools/ant/ProjectHelper.java
  5. +2
    -0
      src/main/org/apache/tools/ant/filters/BaseFilterReader.java
  6. +16
    -0
      src/main/org/apache/tools/ant/filters/FixCrLfFilter.java
  7. +8
    -2
      src/main/org/apache/tools/ant/filters/TokenFilter.java
  8. +15
    -0
      src/main/org/apache/tools/ant/helper/ProjectHelperImpl.java
  9. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/TaskOutputStream.java
  10. +3
    -0
      src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java
  11. +3
    -3
      src/main/org/apache/tools/ant/taskdefs/optional/XMLValidateTask.java
  12. +1
    -0
      src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/TestRequest.java
  13. +2
    -0
      src/main/org/apache/tools/ant/types/resources/ZipResource.java
  14. +3
    -0
      src/main/org/apache/tools/ant/types/selectors/TokenizedPattern.java
  15. +2
    -0
      src/main/org/apache/tools/ant/types/selectors/modifiedselector/EqualComparator.java
  16. +1
    -0
      src/main/org/apache/tools/ant/types/selectors/modifiedselector/HashvalueAlgorithm.java
  17. +1
    -0
      src/main/org/apache/tools/ant/util/KeepAliveInputStream.java
  18. +1
    -0
      src/main/org/apache/tools/ant/util/KeepAliveOutputStream.java
  19. +7
    -0
      src/main/org/apache/tools/ant/util/LazyHashtable.java
  20. +1
    -0
      src/main/org/apache/tools/ant/util/LinkedHashtable.java
  21. +2
    -0
      src/main/org/apache/tools/ant/util/StreamUtils.java
  22. +1
    -0
      src/main/org/apache/tools/ant/util/WorkerAnt.java
  23. +1
    -0
      src/main/org/apache/tools/zip/Simple8BitZipEncoding.java

+ 22
- 21
src/main/org/apache/tools/ant/AntClassLoader.java View File

@@ -126,6 +126,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener, Clo
* @return <code>true</code> if there are more elements in the * @return <code>true</code> if there are more elements in the
* enumeration; <code>false</code> otherwise. * enumeration; <code>false</code> otherwise.
*/ */
@Override
public boolean hasMoreElements() { public boolean hasMoreElements() {
return this.nextResource != null; return this.nextResource != null;
} }
@@ -135,6 +136,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener, Clo
* *
* @return the next resource in the enumeration * @return the next resource in the enumeration
*/ */
@Override
public URL nextElement() { public URL nextElement() {
final URL ret = this.nextResource; final URL ret = this.nextResource;
if (ret == null) { if (ret == null) {
@@ -584,27 +586,25 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener, Clo


final Constructor<?>[] cons = theClass.getDeclaredConstructors(); final Constructor<?>[] cons = theClass.getDeclaredConstructors();
//At least one constructor is guaranteed to be there, but check anyway. //At least one constructor is guaranteed to be there, but check anyway.
if (cons != null) {
if (cons.length > 0 && cons[0] != null) {
final String[] strs = new String[NUMBER_OF_STRINGS];
try {
cons[0].newInstance((Object[]) strs);
// Expecting an exception to be thrown by this call:
// IllegalArgumentException: wrong number of Arguments
} catch (final Exception e) {
// Ignore - we are interested only in the side
// effect - that of getting the static initializers
// invoked. As we do not want to call a valid
// constructor to get this side effect, an
// attempt is made to call a hopefully
// invalid constructor - come on, nobody
// would have a constructor that takes in
// 256 String arguments ;-)
// (In fact, they can't - according to JVM spec
// section 4.10, the number of method parameters is limited
// to 255 by the definition of a method descriptor.
// Constructors count as methods here.)
}
if (cons != null && cons.length > 0 && cons[0] != null) {
final String[] strs = new String[NUMBER_OF_STRINGS];
try {
cons[0].newInstance((Object[]) strs);
// Expecting an exception to be thrown by this call:
// IllegalArgumentException: wrong number of Arguments
} catch (final Exception e) {
// Ignore - we are interested only in the side
// effect - that of getting the static initializers
// invoked. As we do not want to call a valid
// constructor to get this side effect, an
// attempt is made to call a hopefully
// invalid constructor - come on, nobody
// would have a constructor that takes in
// 256 String arguments ;-)
// (In fact, they can't - according to JVM spec
// section 4.10, the number of method parameters is limited
// to 255 by the definition of a method descriptor.
// Constructors count as methods here.)
} }
} }
} }
@@ -1523,6 +1523,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener, Clo
} }


/** {@inheritDoc} */ /** {@inheritDoc} */
@Override
public void close() { public void close() {
cleanup(); cleanup();
} }


+ 1
- 0
src/main/org/apache/tools/ant/BuildException.java View File

@@ -141,6 +141,7 @@ public class BuildException extends RuntimeException {
* *
* @return the location of the error and the error message * @return the location of the error and the error message
*/ */
@Override
public String toString() { public String toString() {
return location.toString() + getMessage(); return location.toString() + getMessage();
} }


+ 1
- 0
src/main/org/apache/tools/ant/Evaluable.java View File

@@ -29,6 +29,7 @@ public interface Evaluable<T> extends Supplier<T> {


T eval(); T eval();


@Override
default T get() { default T get() {
return eval(); return eval();
} }


+ 1
- 0
src/main/org/apache/tools/ant/ProjectHelper.java View File

@@ -128,6 +128,7 @@ public class ProjectHelper {
return name; return name;
} }


@Override
public String toString() { public String toString() {
return name; return name;
} }


+ 2
- 0
src/main/org/apache/tools/ant/filters/BaseFilterReader.java View File

@@ -78,6 +78,7 @@ public abstract class BaseFilterReader extends FilterReader {
* *
* @exception IOException If an I/O error occurs * @exception IOException If an I/O error occurs
*/ */
@Override
public final int read(final char[] cbuf, final int off, public final int read(final char[] cbuf, final int off,
final int len) throws IOException { final int len) throws IOException {
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
@@ -105,6 +106,7 @@ public abstract class BaseFilterReader extends FilterReader {
* @exception IllegalArgumentException If <code>n</code> is negative. * @exception IllegalArgumentException If <code>n</code> is negative.
* @exception IOException If an I/O error occurs * @exception IOException If an I/O error occurs
*/ */
@Override
public final long skip(final long n) public final long skip(final long n)
throws IOException, IllegalArgumentException { throws IOException, IllegalArgumentException {
if (n < 0L) { if (n < 0L) {


+ 16
- 0
src/main/org/apache/tools/ant/filters/FixCrLfFilter.java View File

@@ -442,38 +442,47 @@ public final class FixCrLfFilter extends BaseParamFilterReader implements Chaina
return in instanceof SimpleFilterReader && ((SimpleFilterReader) in).editsBlocked(); return in instanceof SimpleFilterReader && ((SimpleFilterReader) in).editsBlocked();
} }


@Override
public int read() throws IOException { public int read() throws IOException {
return preemptIndex > 0 ? preempt[--preemptIndex] : in.read(); return preemptIndex > 0 ? preempt[--preemptIndex] : in.read();
} }


@Override
public void close() throws IOException { public void close() throws IOException {
in.close(); in.close();
} }


@Override
public void reset() throws IOException { public void reset() throws IOException {
in.reset(); in.reset();
} }


@Override
public boolean markSupported() { public boolean markSupported() {
return in.markSupported(); return in.markSupported();
} }


@Override
public boolean ready() throws IOException { public boolean ready() throws IOException {
return in.ready(); return in.ready();
} }


@Override
public void mark(int i) throws IOException { public void mark(int i) throws IOException {
in.mark(i); in.mark(i);
} }


@Override
public long skip(long i) throws IOException { public long skip(long i) throws IOException {
return in.skip(i); return in.skip(i);
} }


@Override
public int read(char[] buf) throws IOException { public int read(char[] buf) throws IOException {
return read(buf, 0, buf.length); return read(buf, 0, buf.length);
} }


@Override
public int read(char[] buf, int start, int length) throws IOException { public int read(char[] buf, int start, int length) throws IOException {
int count = 0; int count = 0;
int c = 0; int c = 0;
@@ -512,10 +521,12 @@ public final class FixCrLfFilter extends BaseParamFilterReader implements Chaina
state = JAVA; state = JAVA;
} }


@Override
public boolean editsBlocked() { public boolean editsBlocked() {
return editsBlocked || super.editsBlocked(); return editsBlocked || super.editsBlocked();
} }


@Override
public int read() throws IOException { public int read() throws IOException {
int thisChar = super.read(); int thisChar = super.read();
// Mask, block from being edited, all characters in constants. // Mask, block from being edited, all characters in constants.
@@ -628,6 +639,7 @@ public final class FixCrLfFilter extends BaseParamFilterReader implements Chaina
this.fixLast = fixLast; this.fixLast = fixLast;
} }


@Override
public int read() throws IOException { public int read() throws IOException {
int thisChar = super.read(); int thisChar = super.read();


@@ -704,6 +716,7 @@ public final class FixCrLfFilter extends BaseParamFilterReader implements Chaina
super(in); super(in);
} }


@Override
public int read() throws IOException { public int read() throws IOException {
int thisChar = super.read(); int thisChar = super.read();


@@ -733,6 +746,7 @@ public final class FixCrLfFilter extends BaseParamFilterReader implements Chaina
} }
} }


@Override
public int read() throws IOException { public int read() throws IOException {
int lookAhead2 = super.read(); int lookAhead2 = super.read();


@@ -757,6 +771,7 @@ public final class FixCrLfFilter extends BaseParamFilterReader implements Chaina
this.tabLength = tabLength; this.tabLength = tabLength;
} }


@Override
public int read() throws IOException { public int read() throws IOException {
int c = super.read(); int c = super.read();


@@ -836,6 +851,7 @@ public final class FixCrLfFilter extends BaseParamFilterReader implements Chaina
this.tabLength = tabLength; this.tabLength = tabLength;
} }


@Override
public int read() throws IOException { public int read() throws IOException {
int c = super.read(); int c = super.read();




+ 8
- 2
src/main/org/apache/tools/ant/filters/TokenFilter.java View File

@@ -40,8 +40,7 @@ import org.apache.tools.ant.util.regexp.RegexpUtil;
* @see ChainableReader * @see ChainableReader
* @see org.apache.tools.ant.DynamicConfigurator * @see org.apache.tools.ant.DynamicConfigurator
*/ */
public class TokenFilter extends BaseFilterReader
implements ChainableReader {
public class TokenFilter extends BaseFilterReader implements ChainableReader {
/** /**
* string filters implement this interface * string filters implement this interface
*/ */
@@ -366,6 +365,7 @@ public class TokenFilter extends BaseFilterReader
* @param line the string to be filtered * @param line the string to be filtered
* @return the filtered line * @return the filtered line
*/ */
@Override
public String filter(String line) { public String filter(String line) {
if (from == null) { if (from == null) {
throw new BuildException("Missing from in stringreplace"); throw new BuildException("Missing from in stringreplace");
@@ -420,6 +420,7 @@ public class TokenFilter extends BaseFilterReader
* @return null if the string does not contain "contains", * @return null if the string does not contain "contains",
* string otherwise * string otherwise
*/ */
@Override
public String filter(String string) { public String filter(String string) {
if (contains == null) { if (contains == null) {
throw new BuildException("Missing contains in containsstring"); throw new BuildException("Missing contains in containsstring");
@@ -488,6 +489,7 @@ public class TokenFilter extends BaseFilterReader
* @param line the string to modify * @param line the string to modify
* @return the modified string * @return the modified string
*/ */
@Override
public String filter(String line) { public String filter(String line) {
initialize(); initialize();


@@ -557,6 +559,7 @@ public class TokenFilter extends BaseFilterReader
* @param string the string to apply filter on * @param string the string to apply filter on
* @return the filtered string * @return the filtered string
*/ */
@Override
public String filter(String string) { public String filter(String string) {
initialize(); initialize();
if (!regexp.matches(string, options)) { if (!regexp.matches(string, options)) {
@@ -576,6 +579,7 @@ public class TokenFilter extends BaseFilterReader
* @param line the string to be trimmed * @param line the string to be trimmed
* @return the trimmed string * @return the trimmed string
*/ */
@Override
public String filter(String line) { public String filter(String line) {
return line.trim(); return line.trim();
} }
@@ -589,6 +593,7 @@ public class TokenFilter extends BaseFilterReader
* @param line the line to modify * @param line the line to modify
* @return the trimmed line * @return the trimmed line
*/ */
@Override
public String filter(String line) { public String filter(String line) {
if (line.trim().isEmpty()) { if (line.trim().isEmpty()) {
return null; return null;
@@ -619,6 +624,7 @@ public class TokenFilter extends BaseFilterReader
* @param string the string to remove the characters from * @param string the string to remove the characters from
* @return the converted string * @return the converted string
*/ */
@Override
public String filter(String string) { public String filter(String string) {
StringBuffer output = new StringBuffer(string.length()); StringBuffer output = new StringBuffer(string.length());
for (int i = 0; i < string.length(); ++i) { for (int i = 0; i < string.length(); ++i) {


+ 15
- 0
src/main/org/apache/tools/ant/helper/ProjectHelperImpl.java View File

@@ -228,6 +228,7 @@ public class ProjectHelperImpl extends ProjectHelper {
* @exception SAXParseException if this method is not overridden, or in * @exception SAXParseException if this method is not overridden, or in
* case of error in an overridden version * case of error in an overridden version
*/ */
@Override
public void startElement(String tag, AttributeList attrs) throws SAXParseException { public void startElement(String tag, AttributeList attrs) throws SAXParseException {
throw new SAXParseException("Unexpected element \"" + tag + "\"", helperImpl.locator); throw new SAXParseException("Unexpected element \"" + tag + "\"", helperImpl.locator);
} }
@@ -244,6 +245,7 @@ public class ProjectHelperImpl extends ProjectHelper {
* @exception SAXParseException if this method is not overridden, or in * @exception SAXParseException if this method is not overridden, or in
* case of error in an overridden version * case of error in an overridden version
*/ */
@Override
public void characters(char[] buf, int start, int count) throws SAXParseException { public void characters(char[] buf, int start, int count) throws SAXParseException {
String s = new String(buf, start, count).trim(); String s = new String(buf, start, count).trim();


@@ -263,6 +265,7 @@ public class ProjectHelperImpl extends ProjectHelper {
* @exception SAXException in case of error (not thrown in * @exception SAXException in case of error (not thrown in
* this implementation) * this implementation)
*/ */
@Override
public void endElement(String name) throws SAXException { public void endElement(String name) throws SAXException {
// Let parent resume handling SAX events // Let parent resume handling SAX events
helperImpl.parser.setDocumentHandler(parentHandler); helperImpl.parser.setDocumentHandler(parentHandler);
@@ -290,6 +293,7 @@ public class ProjectHelperImpl extends ProjectHelper {
* @param systemId The system identifier provided in the XML * @param systemId The system identifier provided in the XML
* document. Will not be <code>null</code>. * document. Will not be <code>null</code>.
*/ */
@Override
public InputSource resolveEntity(String publicId, String systemId) { public InputSource resolveEntity(String publicId, String systemId) {


helperImpl.project.log("resolving systemId: " + systemId, Project.MSG_VERBOSE); helperImpl.project.log("resolving systemId: " + systemId, Project.MSG_VERBOSE);
@@ -329,6 +333,7 @@ public class ProjectHelperImpl extends ProjectHelper {
* @exception SAXParseException if the tag given is not * @exception SAXParseException if the tag given is not
* <code>"project"</code> * <code>"project"</code>
*/ */
@Override
public void startElement(String tag, AttributeList attrs) throws SAXParseException { public void startElement(String tag, AttributeList attrs) throws SAXParseException {
if ("project".equals(tag)) { if ("project".equals(tag)) {
new ProjectHandler(helperImpl, this).init(tag, attrs); new ProjectHandler(helperImpl, this).init(tag, attrs);
@@ -344,6 +349,7 @@ public class ProjectHelperImpl extends ProjectHelper {
* @param locator The locator used by the parser. * @param locator The locator used by the parser.
* Will not be <code>null</code>. * Will not be <code>null</code>.
*/ */
@Override
public void setDocumentLocator(Locator locator) { public void setDocumentLocator(Locator locator) {
helperImpl.locator = locator; helperImpl.locator = locator;
} }
@@ -459,6 +465,7 @@ public class ProjectHelperImpl extends ProjectHelper {
* <code>"property"</code>, <code>"target"</code> * <code>"property"</code>, <code>"target"</code>
* or a data type definition * or a data type definition
*/ */
@Override
public void startElement(String name, AttributeList attrs) throws SAXParseException { public void startElement(String name, AttributeList attrs) throws SAXParseException {
if ("target".equals(name)) { if ("target".equals(name)) {
handleTarget(name, attrs); handleTarget(name, attrs);
@@ -596,6 +603,7 @@ public class ProjectHelperImpl extends ProjectHelper {
* @exception SAXParseException if an error occurs when initialising * @exception SAXParseException if an error occurs when initialising
* the appropriate child handler * the appropriate child handler
*/ */
@Override
public void startElement(String name, AttributeList attrs) throws SAXParseException { public void startElement(String name, AttributeList attrs) throws SAXParseException {
handleElement(helperImpl, this, target, name, attrs); handleElement(helperImpl, this, target, name, attrs);
} }
@@ -646,6 +654,7 @@ public class ProjectHelperImpl extends ProjectHelper {
* @param start The start element in the array. * @param start The start element in the array.
* @param count The number of characters to read from the array. * @param count The number of characters to read from the array.
*/ */
@Override
public void characters(char[] buf, int start, int count) { public void characters(char[] buf, int start, int count) {
String text = new String(buf, start, count); String text = new String(buf, start, count);
String currentDescription = helperImpl.project.getDescription(); String currentDescription = helperImpl.project.getDescription();
@@ -765,6 +774,7 @@ public class ProjectHelperImpl extends ProjectHelper {
* @param start The start element in the array. * @param start The start element in the array.
* @param count The number of characters to read from the array. * @param count The number of characters to read from the array.
*/ */
@Override
public void characters(char[] buf, int start, int count) { public void characters(char[] buf, int start, int count) {
wrapper.addText(buf, start, count); wrapper.addText(buf, start, count);
} }
@@ -782,6 +792,7 @@ public class ProjectHelperImpl extends ProjectHelper {
* @exception SAXParseException if an error occurs when initialising * @exception SAXParseException if an error occurs when initialising
* the appropriate child handler * the appropriate child handler
*/ */
@Override
public void startElement(String name, AttributeList attrs) throws SAXParseException { public void startElement(String name, AttributeList attrs) throws SAXParseException {
if (task instanceof TaskContainer) { if (task instanceof TaskContainer) {
// task can contain other tasks - no other nested elements possible // task can contain other tasks - no other nested elements possible
@@ -900,6 +911,7 @@ public class ProjectHelperImpl extends ProjectHelper {
* @param start The start element in the array. * @param start The start element in the array.
* @param count The number of characters to read from the array. * @param count The number of characters to read from the array.
*/ */
@Override
public void characters(char[] buf, int start, int count) { public void characters(char[] buf, int start, int count) {
childWrapper.addText(buf, start, count); childWrapper.addText(buf, start, count);
} }
@@ -917,6 +929,7 @@ public class ProjectHelperImpl extends ProjectHelper {
* @exception SAXParseException if an error occurs when initialising * @exception SAXParseException if an error occurs when initialising
* the appropriate child handler * the appropriate child handler
*/ */
@Override
public void startElement(String name, AttributeList attrs) throws SAXParseException { public void startElement(String name, AttributeList attrs) throws SAXParseException {
if (child instanceof TaskContainer) { if (child instanceof TaskContainer) {
// taskcontainer nested element can contain other tasks - no other // taskcontainer nested element can contain other tasks - no other
@@ -999,6 +1012,7 @@ public class ProjectHelperImpl extends ProjectHelper {
* *
* @see ProjectHelper#addText(Project,Object,char[],int,int) * @see ProjectHelper#addText(Project,Object,char[],int,int)
*/ */
@Override
public void characters(char[] buf, int start, int count) { public void characters(char[] buf, int start, int count) {
wrapper.addText(buf, start, count); wrapper.addText(buf, start, count);
} }
@@ -1015,6 +1029,7 @@ public class ProjectHelperImpl extends ProjectHelper {
* @exception SAXParseException if an error occurs when initialising * @exception SAXParseException if an error occurs when initialising
* the child handler * the child handler
*/ */
@Override
public void startElement(String name, AttributeList attrs) throws SAXParseException { public void startElement(String name, AttributeList attrs) throws SAXParseException {
new NestedElementHandler(helperImpl, this, element, wrapper, target).init(name, attrs); new NestedElementHandler(helperImpl, this, element, wrapper, target).init(name, attrs);
} }


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/TaskOutputStream.java View File

@@ -70,7 +70,7 @@ public class TaskOutputStream extends OutputStream {
* @param c the character to write * @param c the character to write
* @throws IOException on error * @throws IOException on error
*/ */
@Override
public void write(int c) throws IOException { public void write(int c) throws IOException {
char cc = (char) c; char cc = (char) c;
if (cc == '\r' || cc == '\n') { if (cc == '\r' || cc == '\n') {


+ 3
- 0
src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java View File

@@ -531,6 +531,7 @@ public class TraXLiaison implements XSLTLiaison4, ErrorListener, XSLTLoggerAware
* Log an error. * Log an error.
* @param e the exception to log. * @param e the exception to log.
*/ */
@Override
public void error(final TransformerException e) { public void error(final TransformerException e) {
logError(e, "Error"); logError(e, "Error");
} }
@@ -539,6 +540,7 @@ public class TraXLiaison implements XSLTLiaison4, ErrorListener, XSLTLoggerAware
* Log a fatal error. * Log a fatal error.
* @param e the exception to log. * @param e the exception to log.
*/ */
@Override
public void fatalError(final TransformerException e) { public void fatalError(final TransformerException e) {
logError(e, "Fatal Error"); logError(e, "Fatal Error");
throw new BuildException("Fatal error during transformation using " + stylesheet + ": " + e.getMessageAndLocation(), e); throw new BuildException("Fatal error during transformation using " + stylesheet + ": " + e.getMessageAndLocation(), e);
@@ -548,6 +550,7 @@ public class TraXLiaison implements XSLTLiaison4, ErrorListener, XSLTLoggerAware
* Log a warning. * Log a warning.
* @param e the exception to log. * @param e the exception to log.
*/ */
@Override
public void warning(final TransformerException e) { public void warning(final TransformerException e) {
if (!suppressWarnings) { if (!suppressWarnings) {
logError(e, "Warning"); logError(e, "Warning");


+ 3
- 3
src/main/org/apache/tools/ant/taskdefs/optional/XMLValidateTask.java View File

@@ -599,6 +599,7 @@ public class XMLValidateTask extends Task {
* record a fatal error * record a fatal error
* @param exception the fatal error * @param exception the fatal error
*/ */
@Override
public void fatalError(SAXParseException exception) { public void fatalError(SAXParseException exception) {
failed = true; failed = true;
doLog(exception, Project.MSG_ERR); doLog(exception, Project.MSG_ERR);
@@ -607,6 +608,7 @@ public class XMLValidateTask extends Task {
* receive notification of a recoverable error * receive notification of a recoverable error
* @param exception the error * @param exception the error
*/ */
@Override
public void error(SAXParseException exception) { public void error(SAXParseException exception) {
failed = true; failed = true;
doLog(exception, Project.MSG_ERR); doLog(exception, Project.MSG_ERR);
@@ -615,6 +617,7 @@ public class XMLValidateTask extends Task {
* receive notification of a warning * receive notification of a warning
* @param exception the warning * @param exception the warning
*/ */
@Override
public void warning(SAXParseException exception) { public void warning(SAXParseException exception) {
// depending on implementation, XMLReader can yield hips of warning, // depending on implementation, XMLReader can yield hips of warning,
// only output then if user explicitly asked for it // only output then if user explicitly asked for it
@@ -624,7 +627,6 @@ public class XMLValidateTask extends Task {
} }


private void doLog(SAXParseException e, int logLevel) { private void doLog(SAXParseException e, int logLevel) {

log(getMessage(e), logLevel); log(getMessage(e), logLevel);
} }


@@ -743,6 +745,4 @@ public class XMLValidateTask extends Task {


} // Property } // Property




} }

+ 1
- 0
src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/TestRequest.java View File

@@ -82,6 +82,7 @@ final class TestRequest implements AutoCloseable {
return Collections.unmodifiableList(this.interestedInSysErr); return Collections.unmodifiableList(this.interestedInSysErr);
} }


@Override
public void close() throws Exception { public void close() throws Exception {
if (this.closables.isEmpty()) { if (this.closables.isEmpty()) {
return; return;


+ 2
- 0
src/main/org/apache/tools/ant/types/resources/ZipResource.java View File

@@ -137,10 +137,12 @@ public class ZipResource extends ArchiveResource {
+ getArchive()); + getArchive());
} }
return new FilterInputStream(z.getInputStream(ze)) { return new FilterInputStream(z.getInputStream(ze)) {
@Override
public void close() throws IOException { public void close() throws IOException {
FileUtils.close(in); FileUtils.close(in);
z.close(); z.close();
} }
@Override
protected void finalize() throws Throwable { protected void finalize() throws Throwable {
try { try {
close(); close();


+ 3
- 0
src/main/org/apache/tools/ant/types/selectors/TokenizedPattern.java View File

@@ -89,6 +89,7 @@ public class TokenizedPattern {
/** /**
* @return The pattern String * @return The pattern String
*/ */
@Override
public String toString() { public String toString() {
return pattern; return pattern;
} }
@@ -102,11 +103,13 @@ public class TokenizedPattern {
* *
* @param o Object * @param o Object
*/ */
@Override
public boolean equals(Object o) { public boolean equals(Object o) {
return o instanceof TokenizedPattern return o instanceof TokenizedPattern
&& pattern.equals(((TokenizedPattern) o).pattern); && pattern.equals(((TokenizedPattern) o).pattern);
} }


@Override
public int hashCode() { public int hashCode() {
return pattern.hashCode(); return pattern.hashCode();
} }


+ 2
- 0
src/main/org/apache/tools/ant/types/selectors/modifiedselector/EqualComparator.java View File

@@ -38,6 +38,7 @@ public class EqualComparator implements Comparator<Object> {
* @param o2 the second object * @param o2 the second object
* @return 0, if both are equal, otherwise 1 * @return 0, if both are equal, otherwise 1
*/ */
@Override
public int compare(Object o1, Object o2) { public int compare(Object o1, Object o2) {
if (o1 == null) { if (o1 == null) {
if (o2 == null) { if (o2 == null) {
@@ -52,6 +53,7 @@ public class EqualComparator implements Comparator<Object> {
* Override Object.toString(). * Override Object.toString().
* @return information about this comparator * @return information about this comparator
*/ */
@Override
public String toString() { public String toString() {
return "EqualComparator"; return "EqualComparator";
} }


+ 1
- 0
src/main/org/apache/tools/ant/types/selectors/modifiedselector/HashvalueAlgorithm.java View File

@@ -73,6 +73,7 @@ public class HashvalueAlgorithm implements Algorithm {
* Override Object.toString(). * Override Object.toString().
* @return information about this comparator * @return information about this comparator
*/ */
@Override
public String toString() { public String toString() {
return "HashvalueAlgorithm"; return "HashvalueAlgorithm";
} }


+ 1
- 0
src/main/org/apache/tools/ant/util/KeepAliveInputStream.java View File

@@ -50,6 +50,7 @@ public class KeepAliveInputStream extends FilterInputStream {
* This method does nothing. * This method does nothing.
* @throws IOException as we are overriding FilterInputStream. * @throws IOException as we are overriding FilterInputStream.
*/ */
@Override
public void close() throws IOException { public void close() throws IOException {
// do not close the stream // do not close the stream
} }


+ 1
- 0
src/main/org/apache/tools/ant/util/KeepAliveOutputStream.java View File

@@ -50,6 +50,7 @@ public class KeepAliveOutputStream extends FilterOutputStream {
* This method does nothing. * This method does nothing.
* @throws IOException as we are overriding FilterOutputStream. * @throws IOException as we are overriding FilterOutputStream.
*/ */
@Override
public void close() throws IOException { public void close() throws IOException {
// do not close the stream // do not close the stream
} }


+ 7
- 0
src/main/org/apache/tools/ant/util/LazyHashtable.java View File

@@ -55,6 +55,7 @@ public class LazyHashtable<K, V> extends Hashtable<K, V> {
* Get a enumeration over the elements. * Get a enumeration over the elements.
* @return an enumeration. * @return an enumeration.
*/ */
@Override
public Enumeration<V> elements() { public Enumeration<V> elements() {
initAll(); initAll();
return super.elements(); return super.elements();
@@ -64,6 +65,7 @@ public class LazyHashtable<K, V> extends Hashtable<K, V> {
* Check if the table is empty. * Check if the table is empty.
* @return true if it is. * @return true if it is.
*/ */
@Override
public boolean isEmpty() { public boolean isEmpty() {
initAll(); initAll();
return super.isEmpty(); return super.isEmpty();
@@ -73,6 +75,7 @@ public class LazyHashtable<K, V> extends Hashtable<K, V> {
* Get the size of the table. * Get the size of the table.
* @return the size. * @return the size.
*/ */
@Override
public int size() { public int size() {
initAll(); initAll();
return super.size(); return super.size();
@@ -83,6 +86,7 @@ public class LazyHashtable<K, V> extends Hashtable<K, V> {
* @param value the value to look for. * @param value the value to look for.
* @return true if the table contains the value. * @return true if the table contains the value.
*/ */
@Override
public boolean contains(Object value) { public boolean contains(Object value) {
initAll(); initAll();
return super.contains(value); return super.contains(value);
@@ -93,6 +97,7 @@ public class LazyHashtable<K, V> extends Hashtable<K, V> {
* @param value the key to look for. * @param value the key to look for.
* @return true if the table contains key. * @return true if the table contains key.
*/ */
@Override
public boolean containsKey(Object value) { public boolean containsKey(Object value) {
initAll(); initAll();
return super.containsKey(value); return super.containsKey(value);
@@ -103,6 +108,7 @@ public class LazyHashtable<K, V> extends Hashtable<K, V> {
* @param value the value to look for. * @param value the value to look for.
* @return true if the table contains the value. * @return true if the table contains the value.
*/ */
@Override
public boolean containsValue(Object value) { public boolean containsValue(Object value) {
return contains(value); return contains(value);
} }
@@ -111,6 +117,7 @@ public class LazyHashtable<K, V> extends Hashtable<K, V> {
* Get an enumeration over the keys. * Get an enumeration over the keys.
* @return an enumeration. * @return an enumeration.
*/ */
@Override
public Enumeration<K> keys() { public Enumeration<K> keys() {
initAll(); initAll();
return super.keys(); return super.keys();


+ 1
- 0
src/main/org/apache/tools/ant/util/LinkedHashtable.java View File

@@ -59,6 +59,7 @@ public class LinkedHashtable<K, V> extends Hashtable<K, V> {
map = new LinkedHashMap<>(m); map = new LinkedHashMap<>(m);
} }


@Override
public synchronized void clear() { public synchronized void clear() {
map.clear(); map.clear();
} }


+ 2
- 0
src/main/org/apache/tools/ant/util/StreamUtils.java View File

@@ -36,6 +36,7 @@ public class StreamUtils {
public static <T> Stream<T> enumerationAsStream(Enumeration<T> e) { public static <T> Stream<T> enumerationAsStream(Enumeration<T> e) {
return StreamSupport.stream( return StreamSupport.stream(
new Spliterators.AbstractSpliterator<T>(Long.MAX_VALUE, Spliterator.ORDERED) { new Spliterators.AbstractSpliterator<T>(Long.MAX_VALUE, Spliterator.ORDERED) {
@Override
public boolean tryAdvance(Consumer<? super T> action) { public boolean tryAdvance(Consumer<? super T> action) {
if (e.hasMoreElements()) { if (e.hasMoreElements()) {
action.accept(e.nextElement()); action.accept(e.nextElement());
@@ -43,6 +44,7 @@ public class StreamUtils {
} }
return false; return false;
} }
@Override
public void forEachRemaining(Consumer<? super T> action) { public void forEachRemaining(Consumer<? super T> action) {
while (e.hasMoreElements()) { while (e.hasMoreElements()) {
action.accept(e.nextElement()); action.accept(e.nextElement());


+ 1
- 0
src/main/org/apache/tools/ant/util/WorkerAnt.java View File

@@ -157,6 +157,7 @@ public class WorkerAnt extends Thread {
* Run the task, which is skipped if null. * Run the task, which is skipped if null.
* When invoked again, the task is re-run. * When invoked again, the task is re-run.
*/ */
@Override
public void run() { public void run() {
try { try {
if (task != null) { if (task != null) {


+ 1
- 0
src/main/org/apache/tools/zip/Simple8BitZipEncoding.java View File

@@ -58,6 +58,7 @@ class Simple8BitZipEncoding implements ZipEncoding {
this.unicode = unicode; this.unicode = unicode;
} }


@Override
public int compareTo(final Simple8BitChar a) { public int compareTo(final Simple8BitChar a) {
return this.unicode - a.unicode; return this.unicode - a.unicode;
} }


Loading…
Cancel
Save