Skip to content

Commit

Permalink
Shorten fully qualified names and other small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Gintas Grigelionis committed Mar 31, 2018
1 parent 954ff0a commit b4243b9
Show file tree
Hide file tree
Showing 35 changed files with 72 additions and 67 deletions.
3 changes: 2 additions & 1 deletion src/main/org/apache/tools/ant/ComponentHelper.java
Expand Up @@ -38,6 +38,7 @@

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;

Expand Down Expand Up @@ -522,7 +523,7 @@ public Task createTask(String taskType) throws BuildException {
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;
Expand Down
1 change: 1 addition & 0 deletions src/main/org/apache/tools/ant/Diagnostics.java
Expand Up @@ -445,6 +445,7 @@ private static void printLibraries(File[] libs, PrintStream out) {

/**
* Call org.apache.env.Which if available
*
* @param out the stream to print the content to.
*/
private static void doReportWhich(PrintStream out) {
Expand Down
33 changes: 17 additions & 16 deletions src/main/org/apache/tools/ant/IntrospectionHelper.java
Expand Up @@ -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;
Expand Down Expand Up @@ -187,30 +188,30 @@ private IntrospectionHelper(final Class<?> bean) {
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
Expand All @@ -219,7 +220,7 @@ private IntrospectionHelper(final Class<?> bean) {
*/
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;
Expand Down Expand Up @@ -251,8 +252,8 @@ private IntrospectionHelper(final Class<?> bean) {
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;
Expand All @@ -269,8 +270,8 @@ private IntrospectionHelper(final Class<?> bean) {
// 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;
Expand Down Expand Up @@ -308,10 +309,10 @@ private IntrospectionHelper(final Class<?> bean) {
* @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;
Expand Down Expand Up @@ -1060,7 +1061,7 @@ public void set(final Project p, final Object parent, final String value)
};
}
// 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)
Expand Down Expand Up @@ -1695,7 +1696,7 @@ private AntTypeDefinition findRestrictedDefinition(
if (exposedClass == null) {
continue;
}
final Method method = findMatchingMethod(exposedClass, methods);
final Method method = findMatchingMethod(exposedClass, methods);
if (method == null) {
continue;
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/org/apache/tools/ant/Project.java
Expand Up @@ -38,6 +38,7 @@
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;
Expand Down Expand Up @@ -326,7 +327,7 @@ public void initProperties() throws BuildException {
* 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());
Expand Down
6 changes: 4 additions & 2 deletions src/main/org/apache/tools/ant/input/InputHandler.java
Expand Up @@ -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.
*
Expand All @@ -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;
}
2 changes: 1 addition & 1 deletion src/main/org/apache/tools/ant/taskdefs/MakeUrl.java
Expand Up @@ -222,7 +222,7 @@ private void validateFile(File fileToCheck) {
/**
* Create the url
*
* @throws org.apache.tools.ant.BuildException
* @throws BuildException
* if something goes wrong with the build
*/
@Override
Expand Down
4 changes: 2 additions & 2 deletions src/main/org/apache/tools/ant/taskdefs/Rename.java
Expand Up @@ -69,8 +69,8 @@ public void setReplace(String replace) {

/**
* 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.");
Expand Down
4 changes: 2 additions & 2 deletions src/main/org/apache/tools/ant/taskdefs/Rmic.java
Expand Up @@ -591,7 +591,7 @@ public void add(RmicAdapter adapter) {
/**
* 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
Expand Down Expand Up @@ -697,7 +697,7 @@ protected void cleanup() {
/**
* 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,
Expand Down
5 changes: 2 additions & 3 deletions src/main/org/apache/tools/ant/taskdefs/Sleep.java
Expand Up @@ -154,10 +154,9 @@ public void validate()
}

/**
* 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()
Expand Down
3 changes: 2 additions & 1 deletion src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java
Expand Up @@ -41,6 +41,7 @@
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;
Expand Down Expand Up @@ -697,7 +698,7 @@ public TraceConfiguration getTraceConfiguration() {
*/
private void resolveProcessor(final String proc) throws Exception {
if (PROCESSOR_TRAX.equals(proc)) {
liaison = new org.apache.tools.ant.taskdefs.optional.TraXLiaison();
liaison = new TraXLiaison();
} else {
//anything else is a classname
final Class<? extends XSLTLiaison> clazz = loadClass(proc).asSubclass(XSLTLiaison.class);
Expand Down
3 changes: 2 additions & 1 deletion src/main/org/apache/tools/ant/taskdefs/XmlProperty.java
Expand Up @@ -29,6 +29,7 @@

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;
Expand Down Expand Up @@ -176,7 +177,7 @@
*
* @ant.task name="xmlproperty" category="xml"
*/
public class XmlProperty extends org.apache.tools.ant.Task {
public class XmlProperty extends Task {
private static final String ID = "id";
private static final String REF_ID = "refid";
private static final String LOCATION = "location";
Expand Down
Expand Up @@ -136,7 +136,7 @@ private boolean empty(final String string) {
*
* @return true if the condition is true.
*
* @throws org.apache.tools.ant.BuildException
* @throws BuildException
* if an error occurs
*/
@Override
Expand Down
2 changes: 1 addition & 1 deletion src/main/org/apache/tools/ant/taskdefs/condition/Xor.java
Expand Up @@ -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.
*/
@Override
Expand Down
Expand Up @@ -431,7 +431,6 @@ private void writeTagDiff(CvsTagEntry[] entries) throws BuildException {
if (writer.checkError()) {
throw new IOException("Encountered an error writing tagdiff");
}
writer.close();
} catch (UnsupportedEncodingException uee) {
log(uee.toString(), Project.MSG_ERR);
} catch (IOException ioe) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java
Expand Up @@ -779,8 +779,8 @@ private void doNetRexxCompile() throws BuildException {

final String eol = System.getProperty("line.separator");
log(
compileList.stream().map(s -> " " + s).collect(Collectors.joining(eol))
, Project.MSG_VERBOSE);
compileList.stream().map(s -> " " + s).collect(Collectors.joining(eol)),
Project.MSG_VERBOSE);

// create a single array of arguments for the compiler
String[] compileArgs =
Expand Down
Expand Up @@ -321,7 +321,7 @@ private void verifyBorlandJarV5(File sourceJar) {
* @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;
Expand Down
Expand Up @@ -45,7 +45,7 @@ public class OrionDeploymentTool extends GenericDeploymentTool {
* @param ejbFiles Hashtable&lt;String, File&gt;
* @param baseName String
*/
protected void addVendorFiles(Hashtable ejbFiles, String baseName) {
protected void addVendorFiles(Hashtable<String, File> ejbFiles, String baseName) {
String ddPrefix = usingBaseJarName() ? "" : baseName;
File orionDD = new File(getConfig().descriptorDir, ddPrefix + ORION_DD);

Expand Down
Expand Up @@ -85,7 +85,7 @@ public Path createClasspath() {
* 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.
*/
@Override
public void validateAttributes() throws BuildException {
Expand Down
Expand Up @@ -90,7 +90,7 @@ public void setTask(ServerDeploy task) {
* 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.
*/
@Override
public void deploy() throws BuildException {
Expand All @@ -104,7 +104,7 @@ public void deploy() throws BuildException {
/**
* 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.
*/
@Override
public void validateAttributes() throws BuildException {
Expand Down
Expand Up @@ -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;

Expand Down
Expand Up @@ -97,7 +97,7 @@ public void addJonas(JonasHotDeploymentTool tool) {
* <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.
*/
@Override
Expand Down
Expand Up @@ -33,6 +33,7 @@

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;
Expand Down Expand Up @@ -71,7 +72,7 @@
* 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;
Expand Down Expand Up @@ -157,7 +158,7 @@ private String getExecutable(String exe) {
}

/**
* @exception org.apache.tools.ant.BuildException Something is stopping the build...
* @throws BuildException Something is stopping the build...
*/
@Override
public void execute() throws BuildException {
Expand Down

0 comments on commit b4243b9

Please sign in to comment.