Browse Source

Shorten fully-qualified names (cherry-pick b4243b9)

master
Gintas Grigelionis 7 years ago
parent
commit
fd514f77c1
27 changed files with 61 additions and 50 deletions
  1. +2
    -1
      src/main/org/apache/tools/ant/ComponentHelper.java
  2. +1
    -0
      src/main/org/apache/tools/ant/Diagnostics.java
  3. +17
    -16
      src/main/org/apache/tools/ant/IntrospectionHelper.java
  4. +2
    -1
      src/main/org/apache/tools/ant/Project.java
  5. +4
    -2
      src/main/org/apache/tools/ant/input/InputHandler.java
  6. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/MakeUrl.java
  7. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/Rename.java
  8. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/Rmic.java
  9. +2
    -3
      src/main/org/apache/tools/ant/taskdefs/Sleep.java
  10. +2
    -1
      src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java
  11. +2
    -1
      src/main/org/apache/tools/ant/taskdefs/XmlProperty.java
  12. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/condition/IsReachable.java
  13. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/condition/Xor.java
  14. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java
  15. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/j2ee/AbstractHotDeploymentTool.java
  16. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/j2ee/GenericHotDeploymentTool.java
  17. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/j2ee/HotDeploymentTool.java
  18. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/j2ee/ServerDeploy.java
  19. +3
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java
  20. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/unix/AbstractAccessTask.java
  21. +2
    -2
      src/main/org/apache/tools/ant/types/RedirectorElement.java
  22. +1
    -1
      src/main/org/apache/tools/ant/types/optional/ScriptCondition.java
  23. +1
    -1
      src/main/org/apache/tools/ant/types/optional/ScriptSelector.java
  24. +2
    -1
      src/main/org/apache/tools/ant/types/selectors/TokenizedPath.java
  25. +1
    -0
      src/main/org/apache/tools/ant/types/selectors/modifiedselector/ModifiedSelector.java
  26. +1
    -1
      src/tests/junit/org/apache/tools/ant/taskdefs/ZipTest.java
  27. +2
    -1
      src/tests/junit/org/apache/tools/ant/taskdefs/optional/RpmTest.java

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

@@ -38,6 +38,7 @@ import java.util.Stack;

import org.apache.tools.ant.launch.Launcher;
import org.apache.tools.ant.taskdefs.Definer;
import org.apache.tools.ant.taskdefs.Property;
import org.apache.tools.ant.taskdefs.Typedef;
import org.apache.tools.ant.util.FileUtils;

@@ -523,7 +524,7 @@ public class ComponentHelper {
if (task == null && taskType.equals(ANT_PROPERTY_TASK)) {
// quick fix for Ant.java use of property before
// initializing the project
addTaskDefinition(ANT_PROPERTY_TASK, org.apache.tools.ant.taskdefs.Property.class);
addTaskDefinition(ANT_PROPERTY_TASK, Property.class);
task = createNewTask(taskType);
}
return task;


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

@@ -457,6 +457,7 @@ public final class Diagnostics {

/**
* Call org.apache.env.Which if available
*
* @param out the stream to print the content to.
*/
private static void doReportWhich(PrintStream out) {


+ 17
- 16
src/main/org/apache/tools/ant/IntrospectionHelper.java View File

@@ -17,6 +17,7 @@
*/
package org.apache.tools.ant;

import java.io.File;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@@ -187,30 +188,30 @@ public final class IntrospectionHelper {
final Class<?>[] args = m.getParameterTypes();

// check of add[Configured](Class) pattern
if (args.length == 1 && java.lang.Void.TYPE.equals(returnType)
if (args.length == 1 && Void.TYPE.equals(returnType)
&& ("add".equals(name) || "addConfigured".equals(name))) {
insertAddTypeMethod(m);
continue;
}
// not really user settable properties on tasks/project components
if (org.apache.tools.ant.ProjectComponent.class.isAssignableFrom(bean)
if (ProjectComponent.class.isAssignableFrom(bean)
&& args.length == 1 && isHiddenSetMethod(name, args[0])) {
continue;
}
// hide addTask for TaskContainers
if (isContainer() && args.length == 1 && "addTask".equals(name)
&& org.apache.tools.ant.Task.class.equals(args[0])) {
&& Task.class.equals(args[0])) {
continue;
}
if ("addText".equals(name) && java.lang.Void.TYPE.equals(returnType)
&& args.length == 1 && java.lang.String.class.equals(args[0])) {
if ("addText".equals(name) && Void.TYPE.equals(returnType)
&& args.length == 1 && String.class.equals(args[0])) {
addTextMethod = methods[i];
} else if (name.startsWith("set") && java.lang.Void.TYPE.equals(returnType)
} else if (name.startsWith("set") && Void.TYPE.equals(returnType)
&& args.length == 1 && !args[0].isArray()) {
final String propName = getPropertyName(name, "set");
AttributeSetter as = attributeSetters.get(propName);
if (as != null) {
if (java.lang.String.class.equals(args[0])) {
if (String.class.equals(args[0])) {
/*
Ignore method m, as there is an overloaded
form of this method that takes in a
@@ -219,7 +220,7 @@ public final class IntrospectionHelper {
*/
continue;
}
if (java.io.File.class.equals(args[0])) {
if (File.class.equals(args[0])) {
// Ant Resources/FileProviders override java.io.File
if (Resource.class.equals(as.type) || FileProvider.class.equals(as.type)) {
continue;
@@ -251,8 +252,8 @@ public final class IntrospectionHelper {
nestedCreators.put(propName, new CreateNestedCreator(m));
}
} else if (name.startsWith("addConfigured")
&& java.lang.Void.TYPE.equals(returnType) && args.length == 1
&& !java.lang.String.class.equals(args[0])
&& Void.TYPE.equals(returnType) && args.length == 1
&& !String.class.equals(args[0])
&& !args[0].isArray() && !args[0].isPrimitive()) {
try {
Constructor<?> constructor = null;
@@ -269,8 +270,8 @@ public final class IntrospectionHelper {
// ignore
}
} else if (name.startsWith("add")
&& java.lang.Void.TYPE.equals(returnType) && args.length == 1
&& !java.lang.String.class.equals(args[0])
&& Void.TYPE.equals(returnType) && args.length == 1
&& !String.class.equals(args[0])
&& !args[0].isArray() && !args[0].isPrimitive()) {
try {
Constructor<?> constructor = null;
@@ -308,10 +309,10 @@ public final class IntrospectionHelper {
* @return true if the given set method is to be hidden.
*/
private boolean isHiddenSetMethod(final String name, final Class<?> type) {
if ("setLocation".equals(name) && org.apache.tools.ant.Location.class.equals(type)) {
if ("setLocation".equals(name) && Location.class.equals(type)) {
return true;
}
if ("setTaskType".equals(name) && java.lang.String.class.equals(type)) {
if ("setTaskType".equals(name) && String.class.equals(type)) {
return true;
}
return false;
@@ -1060,7 +1061,7 @@ public final class IntrospectionHelper {
};
}
// simplest case - setAttribute expects String
if (java.lang.String.class.equals(reflectedArg)) {
if (String.class.equals(reflectedArg)) {
return new AttributeSetter(m, arg) {
@Override
public void set(final Project p, final Object parent, final String value)
@@ -1685,7 +1686,7 @@ public final class IntrospectionHelper {
if (exposedClass == null) {
continue;
}
final Method method = findMatchingMethod(exposedClass, methods);
final Method method = findMatchingMethod(exposedClass, methods);
if (method == null) {
continue;
}


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

@@ -38,6 +38,7 @@ import java.util.WeakHashMap;
import org.apache.tools.ant.helper.DefaultExecutor;
import org.apache.tools.ant.input.DefaultInputHandler;
import org.apache.tools.ant.input.InputHandler;
import org.apache.tools.ant.launch.Locator;
import org.apache.tools.ant.types.Description;
import org.apache.tools.ant.types.FilterSet;
import org.apache.tools.ant.types.FilterSetCollection;
@@ -326,7 +327,7 @@ public class Project implements ResourceFactory {
* to the result
*/
private void setAntLib() {
final File antlib = org.apache.tools.ant.launch.Locator.getClassSource(
final File antlib = Locator.getClassSource(
Project.class);
if (antlib != null) {
setPropertyInternal(MagicNames.ANT_LIB, antlib.getAbsolutePath());


+ 4
- 2
src/main/org/apache/tools/ant/input/InputHandler.java View File

@@ -18,6 +18,8 @@

package org.apache.tools.ant.input;

import org.apache.tools.ant.BuildException;

/**
* Plugin to Ant to handle requests for user input.
*
@@ -34,8 +36,8 @@ public interface InputHandler {
* <p>Postcondition: request.getInput will return a non-null
* value, request.isInputValid will return true.</p>
* @param request the request to be processed
* @throws org.apache.tools.ant.BuildException if the input cannot be read from the console
* @throws BuildException if the input cannot be read from the console
*/
void handleInput(InputRequest request)
throws org.apache.tools.ant.BuildException;
throws BuildException;
}

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

@@ -231,7 +231,7 @@ public class MakeUrl extends Task {
/**
* Create the url
*
* @throws org.apache.tools.ant.BuildException
* @throws BuildException
* if something goes wrong with the build
*/
@Override


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/Rename.java View File

@@ -69,8 +69,8 @@ public class Rename extends Task {

/**
* Renames the file <code>src</code> to <code>dest</code>
* @exception org.apache.tools.ant.BuildException The exception is
* thrown, if the rename operation fails.
*
* @throws BuildException if the rename operation fails
*/
public void execute() throws BuildException {
log("DEPRECATED - The rename task is deprecated. Use move instead.");


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/Rmic.java View File

@@ -590,7 +590,7 @@ public class Rmic extends MatchingTask {
/**
* execute by creating an instance of an implementation
* class and getting to do the work
* @throws org.apache.tools.ant.BuildException
* @throws BuildException
* if there's a problem with baseDir or RMIC
*/
@Override
@@ -701,7 +701,7 @@ public class Rmic extends MatchingTask {
/**
* Move the generated source file(s) to the base directory
*
* @throws org.apache.tools.ant.BuildException When error
* @throws BuildException When error
* copying/removing files.
*/
private void moveGeneratedFile(File baseDir, File sourceBaseFile, String classname,


+ 2
- 3
src/main/org/apache/tools/ant/taskdefs/Sleep.java View File

@@ -166,10 +166,9 @@ public class Sleep extends Task {


/**
* Executes this build task. Throws org.apache.tools.ant.BuildException
* if there is an error during task execution.
* Executes this build task.
*
* @exception BuildException Description of Exception
* @throws BuildException if there is an error during task execution
*/
@Override
public void execute()


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

@@ -41,6 +41,7 @@ import org.apache.tools.ant.DynamicConfigurator;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.ProjectComponent;
import org.apache.tools.ant.PropertyHelper;
import org.apache.tools.ant.taskdefs.optional.TraXLiaison;
import org.apache.tools.ant.types.CommandlineJava;
import org.apache.tools.ant.types.Environment;
import org.apache.tools.ant.types.Mapper;
@@ -713,7 +714,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
*/
private void resolveProcessor(final String proc) throws Exception {
if (proc.equals(PROCESSOR_TRAX)) {
liaison = new org.apache.tools.ant.taskdefs.optional.TraXLiaison();
liaison = new TraXLiaison();
} else {
//anything else is a classname
final Class clazz = loadClass(proc);


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

@@ -27,6 +27,7 @@ import javax.xml.parsers.ParserConfigurationException;

import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.Resource;
import org.apache.tools.ant.types.ResourceCollection;
@@ -174,7 +175,7 @@ import org.xml.sax.SAXException;
*
* @ant.task name="xmlproperty" category="xml"
*/
public class XmlProperty extends org.apache.tools.ant.Task {
public class XmlProperty extends Task {

private Resource src;
private String prefix = "";


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

@@ -136,7 +136,7 @@ public class IsReachable extends ProjectComponent implements Condition {
*
* @return true if the condition is true.
*
* @throws org.apache.tools.ant.BuildException
* @throws BuildException
* if an error occurs
*/
public boolean eval() throws BuildException {


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

@@ -31,7 +31,7 @@ public class Xor extends ConditionBase implements Condition {
/**
* Evaluate the contained conditions.
* @return the result of xoring the conditions together.
* @throws org.apache.tools.ant.BuildException
* @throws BuildException
* if an error occurs.
*/
public boolean eval() throws BuildException {


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

@@ -325,7 +325,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool
* @param sourceJar java.io.File representing the produced jar file
*/
private void verifyBorlandJarV4(File sourceJar) {
org.apache.tools.ant.taskdefs.Java javaTask = null;
Java javaTask = null;
log("verify BAS " + sourceJar, Project.MSG_INFO);
try {
String args = verifyArgs;


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

@@ -85,7 +85,7 @@ public abstract class AbstractHotDeploymentTool implements HotDeploymentTool {
* validation of boilerplate attributes.
* <p>Only the "action" attribute is required in the
* base class. Subclasses should check attributes accordingly.
* @exception org.apache.tools.ant.BuildException if the attributes are invalid or incomplete.
* @throws BuildException if the attributes are invalid or incomplete.
*/
public void validateAttributes() throws BuildException {
if (task.getAction() == null) {


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/optional/j2ee/GenericHotDeploymentTool.java View File

@@ -88,7 +88,7 @@ public class GenericHotDeploymentTool extends AbstractHotDeploymentTool {
* Perform the actual deployment.
* For this generic implementation, a JVM is spawned using the
* supplied classpath, classname, JVM args, and command line arguments.
* @exception org.apache.tools.ant.BuildException if the attributes are invalid or incomplete.
* @exception BuildException if the attributes are invalid or incomplete.
*/
public void deploy() throws BuildException {
java.setClassname(className);
@@ -101,7 +101,7 @@ public class GenericHotDeploymentTool extends AbstractHotDeploymentTool {
/**
* Validates the passed in attributes.
* Ensures the className and arguments attribute have been set.
* @exception org.apache.tools.ant.BuildException if the attributes are invalid or incomplete.
* @throws BuildException if the attributes are invalid or incomplete.
*/
public void validateAttributes() throws BuildException {
super.validateAttributes();


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/optional/j2ee/HotDeploymentTool.java View File

@@ -43,13 +43,13 @@ public interface HotDeploymentTool {

/**
* Validates the passed in attributes.
* @exception org.apache.tools.ant.BuildException if the attributes are invalid or incomplete.
* @exception BuildException if the attributes are invalid or incomplete.
*/
void validateAttributes() throws BuildException;

/**
* Perform the actual deployment.
* @exception org.apache.tools.ant.BuildException if the attributes are invalid or incomplete.
* @throws BuildException if the attributes are invalid or incomplete.
*/
void deploy() throws BuildException;



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

@@ -97,7 +97,7 @@ public class ServerDeploy extends Task {
* <p>This method calls the deploy() method on each of the vendor-specific tools
* in the <code>vendorTools</code> collection. This performs the actual
* process of deployment on each tool.
* @exception org.apache.tools.ant.BuildException if the attributes
* @throws BuildException if the attributes
* are invalid or incomplete, or a failure occurs in the deployment process.
*/
public void execute() throws BuildException {


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

@@ -33,6 +33,7 @@ import java.util.Vector;

import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.taskdefs.Execute;
import org.apache.tools.ant.taskdefs.ExecuteStreamHandler;
import org.apache.tools.ant.taskdefs.LogOutputStream;
@@ -71,7 +72,7 @@ import org.apache.tools.ant.util.FileUtils;
* discussion.
*
*/
public class Pvcs extends org.apache.tools.ant.Task {
public class Pvcs extends Task {
// CheckStyle - magic numbers
// checking for "X:\ 0=dquote,1=letter,2=:,3=\
private static final int POS_1 = 1;
@@ -143,7 +144,7 @@ public class Pvcs extends org.apache.tools.ant.Task {
}

/**
* @exception org.apache.tools.ant.BuildException Something is stopping the build...
* @throws BuildException Something is stopping the build...
*/
public void execute() throws org.apache.tools.ant.BuildException {
int result = 0;


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/optional/unix/AbstractAccessTask.java View File

@@ -32,6 +32,7 @@ package org.apache.tools.ant.taskdefs.optional.unix;
import java.io.File;

import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.taskdefs.ExecuteOn;
import org.apache.tools.ant.taskdefs.condition.Os;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.FileSet;
@@ -42,8 +43,7 @@ import org.apache.tools.ant.types.FileSet;
* @ant.task category="filesystem"
*/

public abstract class AbstractAccessTask
extends org.apache.tools.ant.taskdefs.ExecuteOn {
public abstract class AbstractAccessTask extends ExecuteOn {

/**
* Chmod task for setting file and directory permissions.


+ 2
- 2
src/main/org/apache/tools/ant/types/RedirectorElement.java View File

@@ -27,6 +27,7 @@ import java.util.Vector;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.Redirector;
import org.apache.tools.ant.util.MergingMapper;

/**
* Element representation of a <code>Redirector</code>.
@@ -556,8 +557,7 @@ public class RedirectorElement extends DataType {
*/
protected Mapper createMergeMapper(File destfile) {
Mapper result = new Mapper(getProject());
result.setClassname(
org.apache.tools.ant.util.MergingMapper.class.getName());
result.setClassname(MergingMapper.class.getName());
result.setTo(destfile.getAbsolutePath());
return result;
}


+ 1
- 1
src/main/org/apache/tools/ant/types/optional/ScriptCondition.java View File

@@ -38,7 +38,7 @@ public class ScriptCondition extends AbstractScriptComponent implements Conditio
*
* @return true if the condition is true
*
* @throws org.apache.tools.ant.BuildException
* @throws BuildException
* if an error occurs
*/
public boolean eval() throws BuildException {


+ 1
- 1
src/main/org/apache/tools/ant/types/optional/ScriptSelector.java View File

@@ -85,7 +85,7 @@ public class ScriptSelector extends BaseSelector {
/**
* Initialize on demand.
*
* @throws org.apache.tools.ant.BuildException
* @throws BuildException
* if something goes wrong
*/
private void init() throws BuildException {


+ 2
- 1
src/main/org/apache/tools/ant/types/selectors/TokenizedPath.java View File

@@ -78,7 +78,8 @@ public class TokenizedPath {
tokenizedPath[parent.tokenizedPath.length] = child;
}

/* package */ TokenizedPath(String path, String[] tokens) {
/* package */
TokenizedPath(String path, String[] tokens) {
this.path = path;
this.tokenizedPath = tokens;
}


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

@@ -397,6 +397,7 @@ public class ModifiedSelector extends BaseExtendSelector
* @param type the type to check against
* @return a castable object
*/
@SuppressWarnings("unchecked")
protected <T> T loadClass(String classname, String msg, Class<? extends T> type) {
try {
// load the specified class


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

@@ -244,7 +244,7 @@ public class ZipTest {

@Test
public void testTarFileSet() throws IOException {
buildRule.executeTarget("testTarFileSet");
buildRule.executeTarget("testTarFileSet");
org.apache.tools.zip.ZipFile zf = null;
try {
zf = new org.apache.tools.zip.ZipFile(new File(buildRule.getProject().getProperty("output"), "test3.zip"));


+ 2
- 1
src/tests/junit/org/apache/tools/ant/taskdefs/optional/RpmTest.java View File

@@ -18,6 +18,7 @@
package org.apache.tools.ant.taskdefs.optional;

import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.Execute;
import org.apache.tools.ant.taskdefs.ExecuteStreamHandler;
import org.apache.tools.ant.types.Commandline;
@@ -32,7 +33,7 @@ public class RpmTest {
@Test
public void testShouldThrowExceptionWhenRpmFails() throws Exception {
Rpm rpm = new MyRpm();
rpm.setProject(new org.apache.tools.ant.Project());
rpm.setProject(new Project());
rpm.setFailOnError(true);
// execute
try {


Loading…
Cancel
Save