@@ -126,6 +126,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener, Clo | |||
* @return <code>true</code> if there are more elements in the | |||
* enumeration; <code>false</code> otherwise. | |||
*/ | |||
@Override | |||
public boolean hasMoreElements() { | |||
return this.nextResource != null; | |||
} | |||
@@ -135,6 +136,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener, Clo | |||
* | |||
* @return the next resource in the enumeration | |||
*/ | |||
@Override | |||
public URL nextElement() { | |||
final URL ret = this.nextResource; | |||
if (ret == null) { | |||
@@ -584,27 +586,25 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener, Clo | |||
final Constructor<?>[] cons = theClass.getDeclaredConstructors(); | |||
//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} */ | |||
@Override | |||
public void close() { | |||
cleanup(); | |||
} | |||
@@ -141,6 +141,7 @@ public class BuildException extends RuntimeException { | |||
* | |||
* @return the location of the error and the error message | |||
*/ | |||
@Override | |||
public String toString() { | |||
return location.toString() + getMessage(); | |||
} | |||
@@ -29,6 +29,7 @@ public interface Evaluable<T> extends Supplier<T> { | |||
T eval(); | |||
@Override | |||
default T get() { | |||
return eval(); | |||
} | |||
@@ -128,6 +128,7 @@ public class ProjectHelper { | |||
return name; | |||
} | |||
@Override | |||
public String toString() { | |||
return name; | |||
} | |||
@@ -78,6 +78,7 @@ public abstract class BaseFilterReader extends FilterReader { | |||
* | |||
* @exception IOException If an I/O error occurs | |||
*/ | |||
@Override | |||
public final int read(final char[] cbuf, final int off, | |||
final int len) throws IOException { | |||
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 IOException If an I/O error occurs | |||
*/ | |||
@Override | |||
public final long skip(final long n) | |||
throws IOException, IllegalArgumentException { | |||
if (n < 0L) { | |||
@@ -442,38 +442,47 @@ public final class FixCrLfFilter extends BaseParamFilterReader implements Chaina | |||
return in instanceof SimpleFilterReader && ((SimpleFilterReader) in).editsBlocked(); | |||
} | |||
@Override | |||
public int read() throws IOException { | |||
return preemptIndex > 0 ? preempt[--preemptIndex] : in.read(); | |||
} | |||
@Override | |||
public void close() throws IOException { | |||
in.close(); | |||
} | |||
@Override | |||
public void reset() throws IOException { | |||
in.reset(); | |||
} | |||
@Override | |||
public boolean markSupported() { | |||
return in.markSupported(); | |||
} | |||
@Override | |||
public boolean ready() throws IOException { | |||
return in.ready(); | |||
} | |||
@Override | |||
public void mark(int i) throws IOException { | |||
in.mark(i); | |||
} | |||
@Override | |||
public long skip(long i) throws IOException { | |||
return in.skip(i); | |||
} | |||
@Override | |||
public int read(char[] buf) throws IOException { | |||
return read(buf, 0, buf.length); | |||
} | |||
@Override | |||
public int read(char[] buf, int start, int length) throws IOException { | |||
int count = 0; | |||
int c = 0; | |||
@@ -512,10 +521,12 @@ public final class FixCrLfFilter extends BaseParamFilterReader implements Chaina | |||
state = JAVA; | |||
} | |||
@Override | |||
public boolean editsBlocked() { | |||
return editsBlocked || super.editsBlocked(); | |||
} | |||
@Override | |||
public int read() throws IOException { | |||
int thisChar = super.read(); | |||
// Mask, block from being edited, all characters in constants. | |||
@@ -628,6 +639,7 @@ public final class FixCrLfFilter extends BaseParamFilterReader implements Chaina | |||
this.fixLast = fixLast; | |||
} | |||
@Override | |||
public int read() throws IOException { | |||
int thisChar = super.read(); | |||
@@ -704,6 +716,7 @@ public final class FixCrLfFilter extends BaseParamFilterReader implements Chaina | |||
super(in); | |||
} | |||
@Override | |||
public int read() throws IOException { | |||
int thisChar = super.read(); | |||
@@ -733,6 +746,7 @@ public final class FixCrLfFilter extends BaseParamFilterReader implements Chaina | |||
} | |||
} | |||
@Override | |||
public int read() throws IOException { | |||
int lookAhead2 = super.read(); | |||
@@ -757,6 +771,7 @@ public final class FixCrLfFilter extends BaseParamFilterReader implements Chaina | |||
this.tabLength = tabLength; | |||
} | |||
@Override | |||
public int read() throws IOException { | |||
int c = super.read(); | |||
@@ -836,6 +851,7 @@ public final class FixCrLfFilter extends BaseParamFilterReader implements Chaina | |||
this.tabLength = tabLength; | |||
} | |||
@Override | |||
public int read() throws IOException { | |||
int c = super.read(); | |||
@@ -40,8 +40,7 @@ import org.apache.tools.ant.util.regexp.RegexpUtil; | |||
* @see ChainableReader | |||
* @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 | |||
*/ | |||
@@ -366,6 +365,7 @@ public class TokenFilter extends BaseFilterReader | |||
* @param line the string to be filtered | |||
* @return the filtered line | |||
*/ | |||
@Override | |||
public String filter(String line) { | |||
if (from == null) { | |||
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", | |||
* string otherwise | |||
*/ | |||
@Override | |||
public String filter(String string) { | |||
if (contains == null) { | |||
throw new BuildException("Missing contains in containsstring"); | |||
@@ -488,6 +489,7 @@ public class TokenFilter extends BaseFilterReader | |||
* @param line the string to modify | |||
* @return the modified string | |||
*/ | |||
@Override | |||
public String filter(String line) { | |||
initialize(); | |||
@@ -557,6 +559,7 @@ public class TokenFilter extends BaseFilterReader | |||
* @param string the string to apply filter on | |||
* @return the filtered string | |||
*/ | |||
@Override | |||
public String filter(String string) { | |||
initialize(); | |||
if (!regexp.matches(string, options)) { | |||
@@ -576,6 +579,7 @@ public class TokenFilter extends BaseFilterReader | |||
* @param line the string to be trimmed | |||
* @return the trimmed string | |||
*/ | |||
@Override | |||
public String filter(String line) { | |||
return line.trim(); | |||
} | |||
@@ -589,6 +593,7 @@ public class TokenFilter extends BaseFilterReader | |||
* @param line the line to modify | |||
* @return the trimmed line | |||
*/ | |||
@Override | |||
public String filter(String line) { | |||
if (line.trim().isEmpty()) { | |||
return null; | |||
@@ -619,6 +624,7 @@ public class TokenFilter extends BaseFilterReader | |||
* @param string the string to remove the characters from | |||
* @return the converted string | |||
*/ | |||
@Override | |||
public String filter(String string) { | |||
StringBuffer output = new StringBuffer(string.length()); | |||
for (int i = 0; i < string.length(); ++i) { | |||
@@ -228,6 +228,7 @@ public class ProjectHelperImpl extends ProjectHelper { | |||
* @exception SAXParseException if this method is not overridden, or in | |||
* case of error in an overridden version | |||
*/ | |||
@Override | |||
public void startElement(String tag, AttributeList attrs) throws SAXParseException { | |||
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 | |||
* case of error in an overridden version | |||
*/ | |||
@Override | |||
public void characters(char[] buf, int start, int count) throws SAXParseException { | |||
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 | |||
* this implementation) | |||
*/ | |||
@Override | |||
public void endElement(String name) throws SAXException { | |||
// Let parent resume handling SAX events | |||
helperImpl.parser.setDocumentHandler(parentHandler); | |||
@@ -290,6 +293,7 @@ public class ProjectHelperImpl extends ProjectHelper { | |||
* @param systemId The system identifier provided in the XML | |||
* document. Will not be <code>null</code>. | |||
*/ | |||
@Override | |||
public InputSource resolveEntity(String publicId, String systemId) { | |||
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 | |||
* <code>"project"</code> | |||
*/ | |||
@Override | |||
public void startElement(String tag, AttributeList attrs) throws SAXParseException { | |||
if ("project".equals(tag)) { | |||
new ProjectHandler(helperImpl, this).init(tag, attrs); | |||
@@ -344,6 +349,7 @@ public class ProjectHelperImpl extends ProjectHelper { | |||
* @param locator The locator used by the parser. | |||
* Will not be <code>null</code>. | |||
*/ | |||
@Override | |||
public void setDocumentLocator(Locator locator) { | |||
helperImpl.locator = locator; | |||
} | |||
@@ -459,6 +465,7 @@ public class ProjectHelperImpl extends ProjectHelper { | |||
* <code>"property"</code>, <code>"target"</code> | |||
* or a data type definition | |||
*/ | |||
@Override | |||
public void startElement(String name, AttributeList attrs) throws SAXParseException { | |||
if ("target".equals(name)) { | |||
handleTarget(name, attrs); | |||
@@ -596,6 +603,7 @@ public class ProjectHelperImpl extends ProjectHelper { | |||
* @exception SAXParseException if an error occurs when initialising | |||
* the appropriate child handler | |||
*/ | |||
@Override | |||
public void startElement(String name, AttributeList attrs) throws SAXParseException { | |||
handleElement(helperImpl, this, target, name, attrs); | |||
} | |||
@@ -646,6 +654,7 @@ public class ProjectHelperImpl extends ProjectHelper { | |||
* @param start The start element in the array. | |||
* @param count The number of characters to read from the array. | |||
*/ | |||
@Override | |||
public void characters(char[] buf, int start, int count) { | |||
String text = new String(buf, start, count); | |||
String currentDescription = helperImpl.project.getDescription(); | |||
@@ -765,6 +774,7 @@ public class ProjectHelperImpl extends ProjectHelper { | |||
* @param start The start element in the array. | |||
* @param count The number of characters to read from the array. | |||
*/ | |||
@Override | |||
public void characters(char[] buf, int start, int count) { | |||
wrapper.addText(buf, start, count); | |||
} | |||
@@ -782,6 +792,7 @@ public class ProjectHelperImpl extends ProjectHelper { | |||
* @exception SAXParseException if an error occurs when initialising | |||
* the appropriate child handler | |||
*/ | |||
@Override | |||
public void startElement(String name, AttributeList attrs) throws SAXParseException { | |||
if (task instanceof TaskContainer) { | |||
// 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 count The number of characters to read from the array. | |||
*/ | |||
@Override | |||
public void characters(char[] buf, int start, int count) { | |||
childWrapper.addText(buf, start, count); | |||
} | |||
@@ -917,6 +929,7 @@ public class ProjectHelperImpl extends ProjectHelper { | |||
* @exception SAXParseException if an error occurs when initialising | |||
* the appropriate child handler | |||
*/ | |||
@Override | |||
public void startElement(String name, AttributeList attrs) throws SAXParseException { | |||
if (child instanceof TaskContainer) { | |||
// 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) | |||
*/ | |||
@Override | |||
public void characters(char[] buf, int start, int count) { | |||
wrapper.addText(buf, start, count); | |||
} | |||
@@ -1015,6 +1029,7 @@ public class ProjectHelperImpl extends ProjectHelper { | |||
* @exception SAXParseException if an error occurs when initialising | |||
* the child handler | |||
*/ | |||
@Override | |||
public void startElement(String name, AttributeList attrs) throws SAXParseException { | |||
new NestedElementHandler(helperImpl, this, element, wrapper, target).init(name, attrs); | |||
} | |||
@@ -70,7 +70,7 @@ public class TaskOutputStream extends OutputStream { | |||
* @param c the character to write | |||
* @throws IOException on error | |||
*/ | |||
@Override | |||
public void write(int c) throws IOException { | |||
char cc = (char) c; | |||
if (cc == '\r' || cc == '\n') { | |||
@@ -531,6 +531,7 @@ public class TraXLiaison implements XSLTLiaison4, ErrorListener, XSLTLoggerAware | |||
* Log an error. | |||
* @param e the exception to log. | |||
*/ | |||
@Override | |||
public void error(final TransformerException e) { | |||
logError(e, "Error"); | |||
} | |||
@@ -539,6 +540,7 @@ public class TraXLiaison implements XSLTLiaison4, ErrorListener, XSLTLoggerAware | |||
* Log a fatal error. | |||
* @param e the exception to log. | |||
*/ | |||
@Override | |||
public void fatalError(final TransformerException e) { | |||
logError(e, "Fatal Error"); | |||
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. | |||
* @param e the exception to log. | |||
*/ | |||
@Override | |||
public void warning(final TransformerException e) { | |||
if (!suppressWarnings) { | |||
logError(e, "Warning"); | |||
@@ -599,6 +599,7 @@ public class XMLValidateTask extends Task { | |||
* record a fatal error | |||
* @param exception the fatal error | |||
*/ | |||
@Override | |||
public void fatalError(SAXParseException exception) { | |||
failed = true; | |||
doLog(exception, Project.MSG_ERR); | |||
@@ -607,6 +608,7 @@ public class XMLValidateTask extends Task { | |||
* receive notification of a recoverable error | |||
* @param exception the error | |||
*/ | |||
@Override | |||
public void error(SAXParseException exception) { | |||
failed = true; | |||
doLog(exception, Project.MSG_ERR); | |||
@@ -615,6 +617,7 @@ public class XMLValidateTask extends Task { | |||
* receive notification of a warning | |||
* @param exception the warning | |||
*/ | |||
@Override | |||
public void warning(SAXParseException exception) { | |||
// depending on implementation, XMLReader can yield hips of warning, | |||
// 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) { | |||
log(getMessage(e), logLevel); | |||
} | |||
@@ -743,6 +745,4 @@ public class XMLValidateTask extends Task { | |||
} // Property | |||
} |
@@ -82,6 +82,7 @@ final class TestRequest implements AutoCloseable { | |||
return Collections.unmodifiableList(this.interestedInSysErr); | |||
} | |||
@Override | |||
public void close() throws Exception { | |||
if (this.closables.isEmpty()) { | |||
return; | |||
@@ -137,10 +137,12 @@ public class ZipResource extends ArchiveResource { | |||
+ getArchive()); | |||
} | |||
return new FilterInputStream(z.getInputStream(ze)) { | |||
@Override | |||
public void close() throws IOException { | |||
FileUtils.close(in); | |||
z.close(); | |||
} | |||
@Override | |||
protected void finalize() throws Throwable { | |||
try { | |||
close(); | |||
@@ -89,6 +89,7 @@ public class TokenizedPattern { | |||
/** | |||
* @return The pattern String | |||
*/ | |||
@Override | |||
public String toString() { | |||
return pattern; | |||
} | |||
@@ -102,11 +103,13 @@ public class TokenizedPattern { | |||
* | |||
* @param o Object | |||
*/ | |||
@Override | |||
public boolean equals(Object o) { | |||
return o instanceof TokenizedPattern | |||
&& pattern.equals(((TokenizedPattern) o).pattern); | |||
} | |||
@Override | |||
public int hashCode() { | |||
return pattern.hashCode(); | |||
} | |||
@@ -38,6 +38,7 @@ public class EqualComparator implements Comparator<Object> { | |||
* @param o2 the second object | |||
* @return 0, if both are equal, otherwise 1 | |||
*/ | |||
@Override | |||
public int compare(Object o1, Object o2) { | |||
if (o1 == null) { | |||
if (o2 == null) { | |||
@@ -52,6 +53,7 @@ public class EqualComparator implements Comparator<Object> { | |||
* Override Object.toString(). | |||
* @return information about this comparator | |||
*/ | |||
@Override | |||
public String toString() { | |||
return "EqualComparator"; | |||
} | |||
@@ -73,6 +73,7 @@ public class HashvalueAlgorithm implements Algorithm { | |||
* Override Object.toString(). | |||
* @return information about this comparator | |||
*/ | |||
@Override | |||
public String toString() { | |||
return "HashvalueAlgorithm"; | |||
} | |||
@@ -50,6 +50,7 @@ public class KeepAliveInputStream extends FilterInputStream { | |||
* This method does nothing. | |||
* @throws IOException as we are overriding FilterInputStream. | |||
*/ | |||
@Override | |||
public void close() throws IOException { | |||
// do not close the stream | |||
} | |||
@@ -50,6 +50,7 @@ public class KeepAliveOutputStream extends FilterOutputStream { | |||
* This method does nothing. | |||
* @throws IOException as we are overriding FilterOutputStream. | |||
*/ | |||
@Override | |||
public void close() throws IOException { | |||
// do not close the stream | |||
} | |||
@@ -55,6 +55,7 @@ public class LazyHashtable<K, V> extends Hashtable<K, V> { | |||
* Get a enumeration over the elements. | |||
* @return an enumeration. | |||
*/ | |||
@Override | |||
public Enumeration<V> elements() { | |||
initAll(); | |||
return super.elements(); | |||
@@ -64,6 +65,7 @@ public class LazyHashtable<K, V> extends Hashtable<K, V> { | |||
* Check if the table is empty. | |||
* @return true if it is. | |||
*/ | |||
@Override | |||
public boolean isEmpty() { | |||
initAll(); | |||
return super.isEmpty(); | |||
@@ -73,6 +75,7 @@ public class LazyHashtable<K, V> extends Hashtable<K, V> { | |||
* Get the size of the table. | |||
* @return the size. | |||
*/ | |||
@Override | |||
public int size() { | |||
initAll(); | |||
return super.size(); | |||
@@ -83,6 +86,7 @@ public class LazyHashtable<K, V> extends Hashtable<K, V> { | |||
* @param value the value to look for. | |||
* @return true if the table contains the value. | |||
*/ | |||
@Override | |||
public boolean contains(Object value) { | |||
initAll(); | |||
return super.contains(value); | |||
@@ -93,6 +97,7 @@ public class LazyHashtable<K, V> extends Hashtable<K, V> { | |||
* @param value the key to look for. | |||
* @return true if the table contains key. | |||
*/ | |||
@Override | |||
public boolean containsKey(Object value) { | |||
initAll(); | |||
return super.containsKey(value); | |||
@@ -103,6 +108,7 @@ public class LazyHashtable<K, V> extends Hashtable<K, V> { | |||
* @param value the value to look for. | |||
* @return true if the table contains the value. | |||
*/ | |||
@Override | |||
public boolean containsValue(Object value) { | |||
return contains(value); | |||
} | |||
@@ -111,6 +117,7 @@ public class LazyHashtable<K, V> extends Hashtable<K, V> { | |||
* Get an enumeration over the keys. | |||
* @return an enumeration. | |||
*/ | |||
@Override | |||
public Enumeration<K> keys() { | |||
initAll(); | |||
return super.keys(); | |||
@@ -59,6 +59,7 @@ public class LinkedHashtable<K, V> extends Hashtable<K, V> { | |||
map = new LinkedHashMap<>(m); | |||
} | |||
@Override | |||
public synchronized void clear() { | |||
map.clear(); | |||
} | |||
@@ -36,6 +36,7 @@ public class StreamUtils { | |||
public static <T> Stream<T> enumerationAsStream(Enumeration<T> e) { | |||
return StreamSupport.stream( | |||
new Spliterators.AbstractSpliterator<T>(Long.MAX_VALUE, Spliterator.ORDERED) { | |||
@Override | |||
public boolean tryAdvance(Consumer<? super T> action) { | |||
if (e.hasMoreElements()) { | |||
action.accept(e.nextElement()); | |||
@@ -43,6 +44,7 @@ public class StreamUtils { | |||
} | |||
return false; | |||
} | |||
@Override | |||
public void forEachRemaining(Consumer<? super T> action) { | |||
while (e.hasMoreElements()) { | |||
action.accept(e.nextElement()); | |||
@@ -157,6 +157,7 @@ public class WorkerAnt extends Thread { | |||
* Run the task, which is skipped if null. | |||
* When invoked again, the task is re-run. | |||
*/ | |||
@Override | |||
public void run() { | |||
try { | |||
if (task != null) { | |||
@@ -58,6 +58,7 @@ class Simple8BitZipEncoding implements ZipEncoding { | |||
this.unicode = unicode; | |||
} | |||
@Override | |||
public int compareTo(final Simple8BitChar a) { | |||
return this.unicode - a.unicode; | |||
} | |||