Browse Source

Review annotations

master
Gintas Grigelionis 7 years ago
parent
commit
342bf00579
21 changed files with 16 additions and 13 deletions
  1. +0
    -1
      src/main/org/apache/tools/ant/DirectoryScanner.java
  2. +2
    -1
      src/main/org/apache/tools/ant/RuntimeConfigurable.java
  3. +1
    -0
      src/main/org/apache/tools/ant/input/SecureInputHandler.java
  4. +0
    -1
      src/main/org/apache/tools/ant/launch/Locator.java
  5. +1
    -0
      src/main/org/apache/tools/ant/listener/Log4jListener.java
  6. +0
    -1
      src/main/org/apache/tools/ant/taskdefs/Concat.java
  7. +1
    -0
      src/main/org/apache/tools/ant/taskdefs/CopyPath.java
  8. +0
    -1
      src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
  9. +1
    -0
      src/main/org/apache/tools/ant/taskdefs/email/Message.java
  10. +0
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/XMLValidateTask.java
  11. +0
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java
  12. +1
    -0
      src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java
  13. +1
    -0
      src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/JUnitLauncherTask.java
  14. +2
    -0
      src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/LegacyPlainResultFormatter.java
  15. +1
    -0
      src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/LegacyXmlResultFormatter.java
  16. +0
    -1
      src/main/org/apache/tools/ant/types/resources/TarResource.java
  17. +0
    -1
      src/main/org/apache/tools/ant/util/JavaEnvUtils.java
  18. +1
    -0
      src/main/org/apache/tools/bzip2/BlockSort.java
  19. +1
    -1
      src/tests/junit/org/apache/tools/ant/IntrospectionHelperTest.java
  20. +1
    -0
      src/tests/junit/org/apache/tools/ant/taskdefs/XmlPropertyTest.java
  21. +2
    -2
      src/tests/junit/org/apache/tools/ant/util/JavaEnvUtilsTest.java

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

@@ -613,7 +613,6 @@ public class DirectoryScanner
* *
* @since Ant 1.6 * @since Ant 1.6
*/ */
@SuppressWarnings("deprecated")
public static void resetDefaultExcludes() { public static void resetDefaultExcludes() {
synchronized (defaultExcludes) { synchronized (defaultExcludes) {
defaultExcludes.clear(); defaultExcludes.clear();


+ 2
- 1
src/main/org/apache/tools/ant/RuntimeConfigurable.java View File

@@ -119,6 +119,7 @@ public class RuntimeConfigurable implements Serializable {
} }


private static class EnableAttributeConsumer { private static class EnableAttributeConsumer {
@SuppressWarnings("unused")
public void add(EnableAttribute b) { public void add(EnableAttribute b) {
// Ignore // Ignore
} }
@@ -176,7 +177,7 @@ public class RuntimeConfigurable implements Serializable {
* false. * false.
* @since 1.9.1 * @since 1.9.1
*/ */
@SuppressWarnings("deprecated")
@SuppressWarnings("deprecation")
public boolean isEnabled(UnknownElement owner) { public boolean isEnabled(UnknownElement owner) {
if (!namespacedAttribute) { if (!namespacedAttribute) {
return true; return true;


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

@@ -38,6 +38,7 @@ public class SecureInputHandler extends DefaultInputHandler {
* @param request the request to handle * @param request the request to handle
* @throws BuildException if not possible to read from console * @throws BuildException if not possible to read from console
*/ */
@SuppressWarnings("unused")
public void handleInput(InputRequest request) throws BuildException { public void handleInput(InputRequest request) throws BuildException {
String prompt = getPrompt(request); String prompt = getPrompt(request);
do { do {


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

@@ -470,7 +470,6 @@ public final class Locator {
* @exception MalformedURLException if the URLs for the files cannot be * @exception MalformedURLException if the URLs for the files cannot be
* formed. * formed.
*/ */
@SuppressWarnings("deprecated")
public static URL[] getLocationURLs(File location, public static URL[] getLocationURLs(File location,
final String... extensions) final String... extensions)
throws MalformedURLException { throws MalformedURLException {


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

@@ -44,6 +44,7 @@ public class Log4jListener implements BuildListener {
*/ */
public Log4jListener() { public Log4jListener() {
// trigger the log4j initialization (if at all it's not yet initialized) // trigger the log4j initialization (if at all it's not yet initialized)
@SuppressWarnings("unused")
final Logger log = Logger.getLogger(LOG_ANT); final Logger log = Logger.getLogger(LOG_ANT);
} }




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

@@ -601,7 +601,6 @@ public class Concat extends Task implements ResourceCollection {
* input files. * input files.
* @since Ant 1.8.2 * @since Ant 1.8.2
*/ */
@SuppressWarnings("deprecated")
public void setOverwrite(boolean forceOverwrite) { public void setOverwrite(boolean forceOverwrite) {
setForce(forceOverwrite); setForce(forceOverwrite);
} }


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

@@ -63,6 +63,7 @@ public class CopyPath extends Task {
private File destDir; private File destDir;


// TODO not read, yet in a public setter // TODO not read, yet in a public setter
@SuppressWarnings("unused")
private long granularity = FILE_UTILS.getFileTimestampGranularity(); private long granularity = FILE_UTILS.getFileTimestampGranularity();


private boolean preserveLastModified = false; private boolean preserveLastModified = false;


+ 0
- 1
src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java View File

@@ -706,7 +706,6 @@ public abstract class DefaultCompilerAdapter
* @return true if JDK 9 * @return true if JDK 9
* @since Ant 1.9.8 * @since Ant 1.9.8
*/ */
@SuppressWarnings("deprecated")
protected boolean assumeJava9() { protected boolean assumeJava9() {
return assumeJava19(); return assumeJava19();
} }


+ 1
- 0
src/main/org/apache/tools/ant/taskdefs/email/Message.java View File

@@ -109,6 +109,7 @@ public class Message extends ProjectComponent {
* @param ps The print stream to write to * @param ps The print stream to write to
* @throws IOException if an error occurs * @throws IOException if an error occurs
*/ */
@SuppressWarnings("resource")
public void print(PrintStream ps) throws IOException { public void print(PrintStream ps) throws IOException {
// We need character encoding aware printing here. // We need character encoding aware printing here.
// So, using BufferedWriter over OutputStreamWriter instead of PrintStream // So, using BufferedWriter over OutputStreamWriter instead of PrintStream


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

@@ -375,7 +375,6 @@ public class XMLValidateTask extends Task {
* we have created and wrapped a SAX1 parser. * we have created and wrapped a SAX1 parser.
* @return the new XMLReader. * @return the new XMLReader.
*/ */
@SuppressWarnings("deprecated")
protected XMLReader createXmlReader() { protected XMLReader createXmlReader() {
Object reader = null; Object reader = null;
if (readerClassName == null) { if (readerClassName == null) {


+ 0
- 2
src/main/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java View File

@@ -389,7 +389,6 @@ public class JDependTask extends Task {
* @exception BuildException if an error occurs * @exception BuildException if an error occurs
*/ */
@Override @Override
@SuppressWarnings("deprecated")
public void execute() throws BuildException { public void execute() throws BuildException {


CommandlineJava commandline = new CommandlineJava(); CommandlineJava commandline = new CommandlineJava();
@@ -628,7 +627,6 @@ public class JDependTask extends Task {
return new ExecuteWatchdog(getTimeout()); return new ExecuteWatchdog(getTimeout());
} }


@SuppressWarnings("deprecated")
private Optional<Path> getWorkingPath() { private Optional<Path> getWorkingPath() {
Optional<Path> result = Optional.ofNullable(getClassespath()); Optional<Path> result = Optional.ofNullable(getClassespath());
if (result.isPresent()) { if (result.isPresent()) {


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

@@ -1265,6 +1265,7 @@ public class JUnitTestRunner implements TestListener, JUnitTaskMirror.JUnitTestR
public void addFailure(final Test test, final AssertionFailedError t) { public void addFailure(final Test test, final AssertionFailedError t) {
testListener.addFailure(test, t); testListener.addFailure(test, t);
} }
@SuppressWarnings("unused")
public void addFailure(final Test test, final Throwable t) { // pre-3.4 public void addFailure(final Test test, final Throwable t) { // pre-3.4
if (t instanceof AssertionFailedError) { if (t instanceof AssertionFailedError) {
testListener.addFailure(test, (AssertionFailedError) t); testListener.addFailure(test, (AssertionFailedError) t);


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

@@ -295,6 +295,7 @@ public class JUnitLauncherTask extends Task {
return new AntClassLoader(this.getClass().getClassLoader(), getProject(), this.classPath, true); return new AntClassLoader(this.getClass().getClassLoader(), getProject(), this.classPath, true);
} }


@SuppressWarnings("resource")
private Optional<SwitchedStreamHandle> trySwitchSysOutErr(final TestRequest testRequest, final StreamType streamType) { private Optional<SwitchedStreamHandle> trySwitchSysOutErr(final TestRequest testRequest, final StreamType streamType) {
switch (streamType) { switch (streamType) {
case SYS_OUT: { case SYS_OUT: {


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

@@ -174,6 +174,7 @@ class LegacyPlainResultFormatter extends AbstractJUnitResultFormatter implements
} }
} }


@SuppressWarnings("incomplete-switch")
@Override @Override
public void executionFinished(final TestIdentifier testIdentifier, final TestExecutionResult testExecutionResult) { public void executionFinished(final TestIdentifier testIdentifier, final TestExecutionResult testExecutionResult) {
final long currentTime = System.currentTimeMillis(); final long currentTime = System.currentTimeMillis();
@@ -272,6 +273,7 @@ class LegacyPlainResultFormatter extends AbstractJUnitResultFormatter implements
} }


private final class Stats { private final class Stats {
@SuppressWarnings("unused")
private final TestIdentifier testIdentifier; private final TestIdentifier testIdentifier;
private final AtomicLong numTestsRun = new AtomicLong(0); private final AtomicLong numTestsRun = new AtomicLong(0);
private final AtomicLong numTestsFailed = new AtomicLong(0); private final AtomicLong numTestsFailed = new AtomicLong(0);


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

@@ -124,6 +124,7 @@ class LegacyXmlResultFormatter extends AbstractJUnitResultFormatter implements T
} }


private final class Stats { private final class Stats {
@SuppressWarnings("unused")
private final TestIdentifier testIdentifier; private final TestIdentifier testIdentifier;
private final long startedAt; private final long startedAt;
private long endedAt; private long endedAt;


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

@@ -198,7 +198,6 @@ public class TarResource extends ArchiveResource {
return (TarResource) super.getCheckedRef(); return (TarResource) super.getCheckedRef();
} }


@SuppressWarnings("deprecated")
private void setEntry(TarEntry e) { private void setEntry(TarEntry e) {
if (e == null) { if (e == null) {
setExists(false); setExists(false);


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

@@ -279,7 +279,6 @@ public final class JavaEnvUtils {
* @return true if the version of Java is the same as the given version. * @return true if the version of Java is the same as the given version.
* @since Ant 1.5 * @since Ant 1.5
*/ */
@SuppressWarnings("deprecated")
public static boolean isJavaVersion(String version) { public static boolean isJavaVersion(String version) {
return javaVersion.equals(version) return javaVersion.equals(version)
|| (javaVersion.equals(JAVA_9) && JAVA_1_9.equals(version)); || (javaVersion.equals(JAVA_9) && JAVA_1_9.equals(version));


+ 1
- 0
src/main/org/apache/tools/bzip2/BlockSort.java View File

@@ -117,6 +117,7 @@ class BlockSort {


private static final int FALLBACK_QSORT_STACK_SIZE = 100; private static final int FALLBACK_QSORT_STACK_SIZE = 100;


@SuppressWarnings("unused")
private static final int STACK_SIZE = private static final int STACK_SIZE =
QSORT_STACK_SIZE < FALLBACK_QSORT_STACK_SIZE QSORT_STACK_SIZE < FALLBACK_QSORT_STACK_SIZE
? FALLBACK_QSORT_STACK_SIZE : QSORT_STACK_SIZE; ? FALLBACK_QSORT_STACK_SIZE : QSORT_STACK_SIZE;


+ 1
- 1
src/tests/junit/org/apache/tools/ant/IntrospectionHelperTest.java View File

@@ -800,7 +800,7 @@ public class IntrospectionHelperTest {
} }
} }


public List<Object> add(List l) {
public List<Object> add(List<Object> l) {
// INVALID extension point // INVALID extension point
return null; return null;
} }


+ 1
- 0
src/tests/junit/org/apache/tools/ant/taskdefs/XmlPropertyTest.java View File

@@ -258,6 +258,7 @@ public class XmlPropertyTest {
/** /**
* Debugging method to print the properties in the given hashtable * Debugging method to print the properties in the given hashtable
*/ */
@SuppressWarnings("unused")
private static void printProperties(Hashtable<Object, Object> xmlproperties) { private static void printProperties(Hashtable<Object, Object> xmlproperties) {
xmlproperties.forEach((key, value) -> System.out.println(key + " = " + value)); xmlproperties.forEach((key, value) -> System.out.println(key + " = " + value));
} }


+ 2
- 2
src/tests/junit/org/apache/tools/ant/util/JavaEnvUtilsTest.java View File

@@ -127,7 +127,7 @@ public class JavaEnvUtilsTest {
} }


@Test @Test
@SuppressWarnings("deprecated")
@SuppressWarnings("deprecation")
public void isJavaVersionSupportsBothVersionsOfJava9() { public void isJavaVersionSupportsBothVersionsOfJava9() {
assumeTrue(JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_9)); assumeTrue(JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_9));
assertTrue("JAVA_1_9 is not considered equal to JAVA_9", assertTrue("JAVA_1_9 is not considered equal to JAVA_9",
@@ -135,7 +135,7 @@ public class JavaEnvUtilsTest {
} }


@Test @Test
@SuppressWarnings("deprecated")
@SuppressWarnings("deprecation")
public void java10IsDetectedProperly() { public void java10IsDetectedProperly() {
assumeTrue("10".equals(System.getProperty("java.specification.version"))); assumeTrue("10".equals(System.getProperty("java.specification.version")));
assertEquals("10", JavaEnvUtils.getJavaVersion()); assertEquals("10", JavaEnvUtils.getJavaVersion());


Loading…
Cancel
Save