@@ -907,9 +907,9 @@ public class ComponentHelper { | |||||
} else { | } else { | ||||
//we are defined, so it is an instantiation problem | //we are defined, so it is an instantiation problem | ||||
final String classname = def.getClassName(); | final String classname = def.getClassName(); | ||||
antTask = classname.startsWith("org.apache.tools.ant."); | |||||
boolean optional = classname.startsWith("org.apache.tools.ant.taskdefs.optional"); | |||||
optional |= classname.startsWith("org.apache.tools.ant.types.optional"); | |||||
antTask = classname.startsWith(MagicNames.ANT_CORE_PACKAGE + "."); | |||||
boolean optional = classname.startsWith(MagicNames.ANT_CORE_PACKAGE + ".types.optional") | |||||
|| classname.startsWith(MagicNames.ANT_CORE_PACKAGE + ".taskdefs.optional"); | |||||
//start with instantiating the class. | //start with instantiating the class. | ||||
Class<?> clazz = null; | Class<?> clazz = null; | ||||
@@ -25,7 +25,6 @@ package org.apache.tools.ant; | |||||
public final class DefaultDefinitions { | public final class DefaultDefinitions { | ||||
private static final String IF_NAMESPACE = "ant:if"; | private static final String IF_NAMESPACE = "ant:if"; | ||||
private static final String UNLESS_NAMESPACE = "ant:unless"; | private static final String UNLESS_NAMESPACE = "ant:unless"; | ||||
private static final String OATA = "org.apache.tools.ant."; | |||||
private final ComponentHelper componentHelper; | private final ComponentHelper componentHelper; | ||||
@@ -52,14 +51,14 @@ public final class DefaultDefinitions { | |||||
private void attributeNamespaceDef(String ns) { | private void attributeNamespaceDef(String ns) { | ||||
AntTypeDefinition def = new AntTypeDefinition(); | AntTypeDefinition def = new AntTypeDefinition(); | ||||
def.setName(ProjectHelper.nsToComponentName(ns)); | def.setName(ProjectHelper.nsToComponentName(ns)); | ||||
def.setClassName(OATA + "attribute.AttributeNamespace"); | |||||
def.setClassName(MagicNames.ANT_CORE_PACKAGE + ".attribute.AttributeNamespace"); | |||||
def.setClassLoader(getClass().getClassLoader()); | def.setClassLoader(getClass().getClassLoader()); | ||||
def.setRestrict(true); | def.setRestrict(true); | ||||
componentHelper.addDataTypeDefinition(def); | componentHelper.addDataTypeDefinition(def); | ||||
} | } | ||||
private void ifUnlessDef(String name, String base) { | private void ifUnlessDef(String name, String base) { | ||||
String classname = OATA + "attribute." + base; | |||||
String classname = MagicNames.ANT_CORE_PACKAGE + ".attribute." + base; | |||||
componentDef(IF_NAMESPACE, name, classname); | componentDef(IF_NAMESPACE, name, classname); | ||||
componentDef(UNLESS_NAMESPACE, name, classname + "$Unless"); | componentDef(UNLESS_NAMESPACE, name, classname + "$Unless"); | ||||
} | } | ||||
@@ -207,11 +207,18 @@ public final class MagicNames { | |||||
*/ | */ | ||||
public static final String REFID_LOCAL_PROPERTIES = "ant.LocalProperties"; | public static final String REFID_LOCAL_PROPERTIES = "ant.LocalProperties"; | ||||
/** | |||||
* Name of Ant core package | |||||
* Value: {@value} | |||||
* @since Ant 1.10.9 | |||||
*/ | |||||
public static final String ANT_CORE_PACKAGE = "org.apache.tools.ant"; | |||||
/** | /** | ||||
* Name of JVM system property which provides the name of the ProjectHelper class to use. | * Name of JVM system property which provides the name of the ProjectHelper class to use. | ||||
* Value: {@value} | * Value: {@value} | ||||
*/ | */ | ||||
public static final String PROJECT_HELPER_CLASS = "org.apache.tools.ant.ProjectHelper"; | |||||
public static final String PROJECT_HELPER_CLASS = ANT_CORE_PACKAGE + ".ProjectHelper"; | |||||
/** | /** | ||||
* The service identifier in jars which provide ProjectHelper implementations. | * The service identifier in jars which provide ProjectHelper implementations. | ||||
@@ -38,17 +38,22 @@ import org.xml.sax.AttributeList; | |||||
*/ | */ | ||||
public class ProjectHelper { | public class ProjectHelper { | ||||
/** The URI for ant name space */ | /** The URI for ant name space */ | ||||
public static final String ANT_CORE_URI = MagicNames.ANTLIB_PREFIX + "org.apache.tools.ant"; | |||||
public static final String ANT_CORE_URI = MagicNames.ANTLIB_PREFIX | |||||
+ MagicNames.ANT_CORE_PACKAGE; | |||||
/** The URI for antlib current definitions */ | /** The URI for antlib current definitions */ | ||||
public static final String ANT_CURRENT_URI = "ant:current"; | public static final String ANT_CURRENT_URI = "ant:current"; | ||||
/** The URI for ant specific attributes | /** The URI for ant specific attributes | ||||
* @since Ant 1.9.1 | * @since Ant 1.9.1 | ||||
* */ | |||||
*/ | |||||
public static final String ANT_ATTRIBUTE_URI = "ant:attribute"; | public static final String ANT_ATTRIBUTE_URI = "ant:attribute"; | ||||
/** The URI for defined types/tasks - the format is antlib:<package> */ | |||||
/** | |||||
* The URI for defined types/tasks - the format is antlib:<package> | |||||
* @deprecated use MagicNames.ANTLIB_PREFIX | |||||
*/ | |||||
@Deprecated | |||||
public static final String ANTLIB_URI = MagicNames.ANTLIB_PREFIX; | public static final String ANTLIB_URI = MagicNames.ANTLIB_PREFIX; | ||||
/** Polymorphic attribute */ | /** Polymorphic attribute */ | ||||
@@ -57,18 +62,24 @@ public class ProjectHelper { | |||||
/** | /** | ||||
* Name of JVM system property which provides the name of the | * Name of JVM system property which provides the name of the | ||||
* ProjectHelper class to use. | * ProjectHelper class to use. | ||||
* @deprecated use MagicNames.PROJECT_HELPER_CLASS | |||||
*/ | */ | ||||
@Deprecated | |||||
public static final String HELPER_PROPERTY = MagicNames.PROJECT_HELPER_CLASS; | public static final String HELPER_PROPERTY = MagicNames.PROJECT_HELPER_CLASS; | ||||
/** | /** | ||||
* The service identifier in jars which provide Project Helper | * The service identifier in jars which provide Project Helper | ||||
* implementations. | * implementations. | ||||
* @deprecated use MagicNames.PROJECT_HELPER_SERVICE | |||||
*/ | */ | ||||
@Deprecated | |||||
public static final String SERVICE_ID = MagicNames.PROJECT_HELPER_SERVICE; | public static final String SERVICE_ID = MagicNames.PROJECT_HELPER_SERVICE; | ||||
/** | /** | ||||
* name of project helper reference that we add to a project | * name of project helper reference that we add to a project | ||||
* @deprecated use MagicNames.REFID_PROJECT_HELPER | |||||
*/ | */ | ||||
@Deprecated | |||||
public static final String PROJECTHELPER_REFERENCE = MagicNames.REFID_PROJECT_HELPER; | public static final String PROJECTHELPER_REFERENCE = MagicNames.REFID_PROJECT_HELPER; | ||||
/** | /** | ||||
@@ -89,7 +100,7 @@ public class ProjectHelper { | |||||
public static void configureProject(Project project, File buildFile) throws BuildException { | public static void configureProject(Project project, File buildFile) throws BuildException { | ||||
FileResource resource = new FileResource(buildFile); | FileResource resource = new FileResource(buildFile); | ||||
ProjectHelper helper = ProjectHelperRepository.getInstance().getProjectHelperForBuildFile(resource); | ProjectHelper helper = ProjectHelperRepository.getInstance().getProjectHelperForBuildFile(resource); | ||||
project.addReference(PROJECTHELPER_REFERENCE, helper); | |||||
project.addReference(MagicNames.REFID_PROJECT_HELPER, helper); | |||||
helper.parse(project, buildFile); | helper.parse(project, buildFile); | ||||
} | } | ||||
@@ -86,7 +86,7 @@ public class ProjectHelperRepository { | |||||
try { | try { | ||||
ClassLoader classLoader = LoaderUtils.getContextClassLoader(); | ClassLoader classLoader = LoaderUtils.getContextClassLoader(); | ||||
if (classLoader != null) { | if (classLoader != null) { | ||||
for (URL resource : Collections.list(classLoader.getResources(ProjectHelper.SERVICE_ID))) { | |||||
for (URL resource : Collections.list(classLoader.getResources(MagicNames.PROJECT_HELPER_SERVICE))) { | |||||
URLConnection conn = resource.openConnection(); | URLConnection conn = resource.openConnection(); | ||||
conn.setUseCaches(false); | conn.setUseCaches(false); | ||||
registerProjectHelper(getProjectHelperByService(conn.getInputStream())); | registerProjectHelper(getProjectHelperByService(conn.getInputStream())); | ||||
@@ -94,13 +94,13 @@ public class ProjectHelperRepository { | |||||
} | } | ||||
InputStream systemResource = | InputStream systemResource = | ||||
ClassLoader.getSystemResourceAsStream(ProjectHelper.SERVICE_ID); | |||||
ClassLoader.getSystemResourceAsStream(MagicNames.PROJECT_HELPER_SERVICE); | |||||
if (systemResource != null) { | if (systemResource != null) { | ||||
registerProjectHelper(getProjectHelperByService(systemResource)); | registerProjectHelper(getProjectHelperByService(systemResource)); | ||||
} | } | ||||
} catch (Exception e) { | } catch (Exception e) { | ||||
System.err.println("Unable to load ProjectHelper from service " | System.err.println("Unable to load ProjectHelper from service " | ||||
+ ProjectHelper.SERVICE_ID + " (" | |||||
+ MagicNames.PROJECT_HELPER_SERVICE + " (" | |||||
+ e.getClass().getName() | + e.getClass().getName() | ||||
+ ": " + e.getMessage() + ")"); | + ": " + e.getMessage() + ")"); | ||||
if (DEBUG) { | if (DEBUG) { | ||||
@@ -160,7 +160,7 @@ public class ProjectHelperRepository { | |||||
} | } | ||||
private Constructor<? extends ProjectHelper> getProjectHelperBySystemProperty() { | private Constructor<? extends ProjectHelper> getProjectHelperBySystemProperty() { | ||||
String helperClass = System.getProperty(ProjectHelper.HELPER_PROPERTY); | |||||
String helperClass = System.getProperty(MagicNames.PROJECT_HELPER_CLASS); | |||||
try { | try { | ||||
if (helperClass != null) { | if (helperClass != null) { | ||||
return getHelperConstructor(helperClass); | return getHelperConstructor(helperClass); | ||||
@@ -168,7 +168,7 @@ public class ProjectHelperRepository { | |||||
} catch (SecurityException e) { | } catch (SecurityException e) { | ||||
System.err.println("Unable to load ProjectHelper class \"" | System.err.println("Unable to load ProjectHelper class \"" | ||||
+ helperClass + " specified in system property " | + helperClass + " specified in system property " | ||||
+ ProjectHelper.HELPER_PROPERTY + " (" | |||||
+ MagicNames.PROJECT_HELPER_CLASS + " (" | |||||
+ e.getMessage() + ")"); | + e.getMessage() + ")"); | ||||
if (DEBUG) { | if (DEBUG) { | ||||
e.printStackTrace(System.err); //NOSONAR | e.printStackTrace(System.err); //NOSONAR | ||||
@@ -191,7 +191,7 @@ public class ProjectHelperRepository { | |||||
} | } | ||||
} catch (Exception e) { | } catch (Exception e) { | ||||
System.out.println("Unable to load ProjectHelper from service " | System.out.println("Unable to load ProjectHelper from service " | ||||
+ ProjectHelper.SERVICE_ID + " (" + e.getMessage() + ")"); | |||||
+ MagicNames.PROJECT_HELPER_SERVICE + " (" + e.getMessage() + ")"); | |||||
if (DEBUG) { | if (DEBUG) { | ||||
e.printStackTrace(System.err); //NOSONAR | e.printStackTrace(System.err); //NOSONAR | ||||
} | } | ||||
@@ -1026,7 +1026,7 @@ public class ProjectHelper2 extends ProjectHelper { | |||||
} | } | ||||
if (extensionPoint != null) { | if (extensionPoint != null) { | ||||
ProjectHelper helper = | ProjectHelper helper = | ||||
context.getProject().getReference(ProjectHelper.PROJECTHELPER_REFERENCE); | |||||
context.getProject().getReference(MagicNames.REFID_PROJECT_HELPER); | |||||
for (String extPointName : Target.parseDepends(extensionPoint, name, "extensionOf")) { | for (String extPointName : Target.parseDepends(extensionPoint, name, "extensionOf")) { | ||||
if (extensionPointMissing == null) { | if (extensionPointMissing == null) { | ||||
extensionPointMissing = OnMissingExtensionPoint.FAIL; | extensionPointMissing = OnMissingExtensionPoint.FAIL; | ||||
@@ -26,6 +26,7 @@ import org.apache.commons.logging.LogFactory; | |||||
import org.apache.tools.ant.BuildEvent; | import org.apache.tools.ant.BuildEvent; | ||||
import org.apache.tools.ant.BuildListener; | import org.apache.tools.ant.BuildListener; | ||||
import org.apache.tools.ant.BuildLogger; | import org.apache.tools.ant.BuildLogger; | ||||
import org.apache.tools.ant.MagicNames; | |||||
import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
import org.apache.tools.ant.UnknownElement; | import org.apache.tools.ant.UnknownElement; | ||||
@@ -61,11 +62,11 @@ public class CommonsLoggingListener implements BuildListener, BuildLogger { | |||||
/** | /** | ||||
* name of the category under which target events are logged | * name of the category under which target events are logged | ||||
*/ | */ | ||||
public static final String TARGET_LOG = "org.apache.tools.ant.Target"; | |||||
public static final String TARGET_LOG = MagicNames.ANT_CORE_PACKAGE + ".Target"; | |||||
/** | /** | ||||
* name of the category under which project events are logged | * name of the category under which project events are logged | ||||
*/ | */ | ||||
public static final String PROJECT_LOG = "org.apache.tools.ant.Project"; | |||||
public static final String PROJECT_LOG = MagicNames.ANT_CORE_PACKAGE + ".Project"; | |||||
/** | /** | ||||
* Construct the listener and make sure that a LogFactory | * Construct the listener and make sure that a LogFactory | ||||
@@ -20,6 +20,7 @@ package org.apache.tools.ant.listener; | |||||
import org.apache.log4j.Logger; | import org.apache.log4j.Logger; | ||||
import org.apache.tools.ant.BuildEvent; | import org.apache.tools.ant.BuildEvent; | ||||
import org.apache.tools.ant.BuildListener; | import org.apache.tools.ant.BuildListener; | ||||
import org.apache.tools.ant.MagicNames; | |||||
import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
import org.apache.tools.ant.Target; | import org.apache.tools.ant.Target; | ||||
import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
@@ -36,8 +37,10 @@ public class Log4jListener implements BuildListener { | |||||
/** | /** | ||||
* log category we log into | * log category we log into | ||||
* @deprecated use MagicNames.ANT_CORE_PACKAGE | |||||
*/ | */ | ||||
public static final String LOG_ANT = "org.apache.tools.ant"; | |||||
@Deprecated | |||||
public static final String LOG_ANT = MagicNames.ANT_CORE_PACKAGE; | |||||
/** | /** | ||||
* Construct the listener | * Construct the listener | ||||
@@ -45,7 +48,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") | @SuppressWarnings("unused") | ||||
final Logger log = Logger.getLogger(LOG_ANT); | |||||
final Logger log = Logger.getLogger(MagicNames.ANT_CORE_PACKAGE); | |||||
} | } | ||||
/** | /** | ||||
@@ -23,8 +23,10 @@ import java.net.URL; | |||||
import java.net.URLConnection; | import java.net.URLConnection; | ||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import java.util.List; | import java.util.List; | ||||
import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
import org.apache.tools.ant.ComponentHelper; | import org.apache.tools.ant.ComponentHelper; | ||||
import org.apache.tools.ant.MagicNames; | |||||
import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
import org.apache.tools.ant.ProjectHelper; | import org.apache.tools.ant.ProjectHelper; | ||||
import org.apache.tools.ant.ProjectHelperRepository; | import org.apache.tools.ant.ProjectHelperRepository; | ||||
@@ -77,7 +79,7 @@ public class Antlib extends Task implements TaskContainer { | |||||
// Should be safe to parse | // Should be safe to parse | ||||
ProjectHelper parser = null; | ProjectHelper parser = null; | ||||
Object p = | Object p = | ||||
project.getReference(ProjectHelper.PROJECTHELPER_REFERENCE); | |||||
project.getReference(MagicNames.REFID_PROJECT_HELPER); | |||||
if (p instanceof ProjectHelper) { | if (p instanceof ProjectHelper) { | ||||
parser = (ProjectHelper) p; | parser = (ProjectHelper) p; | ||||
if (!parser.canParseAntlibDescriptor(antlibResource)) { | if (!parser.canParseAntlibDescriptor(antlibResource)) { | ||||
@@ -22,6 +22,7 @@ import java.util.List; | |||||
import java.util.stream.Stream; | import java.util.stream.Stream; | ||||
import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
import org.apache.tools.ant.MagicNames; | |||||
import org.apache.tools.ant.ProjectHelper; | import org.apache.tools.ant.ProjectHelper; | ||||
import org.apache.tools.ant.ProjectHelper.OnMissingExtensionPoint; | import org.apache.tools.ant.ProjectHelper.OnMissingExtensionPoint; | ||||
import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
@@ -72,8 +73,7 @@ public class BindTargets extends Task { | |||||
if (onMissingExtensionPoint == null) { | if (onMissingExtensionPoint == null) { | ||||
onMissingExtensionPoint = OnMissingExtensionPoint.FAIL; | onMissingExtensionPoint = OnMissingExtensionPoint.FAIL; | ||||
} | } | ||||
final ProjectHelper helper = getProject().getReference( | |||||
ProjectHelper.PROJECTHELPER_REFERENCE); | |||||
final ProjectHelper helper = getProject().getReference(MagicNames.REFID_PROJECT_HELPER); | |||||
for (String target : targets) { | for (String target : targets) { | ||||
helper.getExtensionStack().add(new String[] {extensionPoint, | helper.getExtensionStack().add(new String[] {extensionPoint, | ||||
@@ -215,7 +215,7 @@ public class Classloader extends Task { | |||||
if (name == null) { | if (name == null) { | ||||
// This allows the core loader to load optional tasks | // This allows the core loader to load optional tasks | ||||
// without delegating | // without delegating | ||||
acl.addLoaderPackageRoot("org.apache.tools.ant.taskdefs.optional"); | |||||
acl.addLoaderPackageRoot(MagicNames.ANT_CORE_PACKAGE + ".taskdefs.optional"); | |||||
getProject().setCoreLoader(acl); | getProject().setCoreLoader(acl); | ||||
} | } | ||||
} | } | ||||
@@ -20,6 +20,7 @@ package org.apache.tools.ant.taskdefs; | |||||
import org.apache.tools.ant.AntClassLoader; | import org.apache.tools.ant.AntClassLoader; | ||||
import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
import org.apache.tools.ant.MagicNames; | |||||
import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
import org.apache.tools.ant.types.Reference; | import org.apache.tools.ant.types.Reference; | ||||
@@ -145,7 +146,7 @@ public abstract class DefBase extends AntlibDefinition { | |||||
// task we want to define will never be a Task but always | // task we want to define will never be a Task but always | ||||
// be wrapped into a TaskAdapter. | // be wrapped into a TaskAdapter. | ||||
((AntClassLoader) createdLoader) | ((AntClassLoader) createdLoader) | ||||
.addSystemPackageRoot("org.apache.tools.ant"); | |||||
.addSystemPackageRoot(MagicNames.ANT_CORE_PACKAGE); | |||||
} | } | ||||
return createdLoader; | return createdLoader; | ||||
} | } | ||||
@@ -24,6 +24,7 @@ import java.net.URL; | |||||
import java.util.Vector; | import java.util.Vector; | ||||
import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
import org.apache.tools.ant.MagicNames; | |||||
import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
import org.apache.tools.ant.ProjectHelper; | import org.apache.tools.ant.ProjectHelper; | ||||
import org.apache.tools.ant.ProjectHelperRepository; | import org.apache.tools.ant.ProjectHelperRepository; | ||||
@@ -138,8 +139,7 @@ public class ImportTask extends Task { | |||||
throw new BuildException("import only allowed as a top-level task"); | throw new BuildException("import only allowed as a top-level task"); | ||||
} | } | ||||
ProjectHelper helper = getProject(). | |||||
getReference(ProjectHelper.PROJECTHELPER_REFERENCE); | |||||
ProjectHelper helper = getProject().getReference(MagicNames.REFID_PROJECT_HELPER); | |||||
if (helper == null) { | if (helper == null) { | ||||
// this happens if the projecthelper was not registered with the project. | // this happens if the projecthelper was not registered with the project. | ||||
@@ -216,12 +216,12 @@ public class ImportTask extends Task { | |||||
// push current stacks into the sub helper | // push current stacks into the sub helper | ||||
subHelper.getImportStack().addAll(helper.getImportStack()); | subHelper.getImportStack().addAll(helper.getImportStack()); | ||||
subHelper.getExtensionStack().addAll(helper.getExtensionStack()); | subHelper.getExtensionStack().addAll(helper.getExtensionStack()); | ||||
getProject().addReference(ProjectHelper.PROJECTHELPER_REFERENCE, subHelper); | |||||
getProject().addReference(MagicNames.REFID_PROJECT_HELPER, subHelper); | |||||
subHelper.parse(getProject(), importedResource); | subHelper.parse(getProject(), importedResource); | ||||
// push back the stack from the sub helper to the main one | // push back the stack from the sub helper to the main one | ||||
getProject().addReference(ProjectHelper.PROJECTHELPER_REFERENCE, helper); | |||||
getProject().addReference(MagicNames.REFID_PROJECT_HELPER, helper); | |||||
helper.getImportStack().clear(); | helper.getImportStack().clear(); | ||||
helper.getImportStack().addAll(subHelper.getImportStack()); | helper.getImportStack().addAll(subHelper.getImportStack()); | ||||
helper.getExtensionStack().clear(); | helper.getExtensionStack().clear(); | ||||
@@ -48,6 +48,7 @@ import java.util.stream.Stream; | |||||
import org.apache.tools.ant.AntClassLoader; | import org.apache.tools.ant.AntClassLoader; | ||||
import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
import org.apache.tools.ant.MagicNames; | |||||
import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
import org.apache.tools.ant.taskdefs.Execute; | import org.apache.tools.ant.taskdefs.Execute; | ||||
@@ -1972,7 +1973,7 @@ public class JUnitTask extends Task { | |||||
// make sure the test annotation are accepted | // make sure the test annotation are accepted | ||||
classLoader.addSystemPackageRoot("org.junit"); | classLoader.addSystemPackageRoot("org.junit"); | ||||
// will cause trouble in JDK 1.1 if omitted | // will cause trouble in JDK 1.1 if omitted | ||||
classLoader.addSystemPackageRoot("org.apache.tools.ant"); | |||||
classLoader.addSystemPackageRoot(MagicNames.ANT_CORE_PACKAGE); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -49,6 +49,7 @@ import junit.framework.TestResult; | |||||
import junit.framework.TestSuite; | import junit.framework.TestSuite; | ||||
import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
import org.apache.tools.ant.MagicNames; | |||||
import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
import org.apache.tools.ant.types.Permissions; | import org.apache.tools.ant.types.Permissions; | ||||
import org.apache.tools.ant.util.FileUtils; | import org.apache.tools.ant.util.FileUtils; | ||||
@@ -85,7 +86,7 @@ public class JUnitTestRunner implements TestListener, JUnitTaskMirror.JUnitTestR | |||||
"junit.textui.TestRunner", | "junit.textui.TestRunner", | ||||
"java.lang.reflect.Method.invoke(", | "java.lang.reflect.Method.invoke(", | ||||
"sun.reflect.", | "sun.reflect.", | ||||
"org.apache.tools.ant.", | |||||
MagicNames.ANT_CORE_PACKAGE + ".", | |||||
// JUnit 4 support: | // JUnit 4 support: | ||||
"org.junit.", | "org.junit.", | ||||
"junit.framework.JUnit4TestAdapter", | "junit.framework.JUnit4TestAdapter", | ||||
@@ -21,6 +21,7 @@ import java.util.List; | |||||
import java.util.stream.Collectors; | import java.util.stream.Collectors; | ||||
import java.util.stream.Stream; | import java.util.stream.Stream; | ||||
import org.apache.tools.ant.MagicNames; | |||||
import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
import org.apache.tools.ant.ProjectHelper; | import org.apache.tools.ant.ProjectHelper; | ||||
import org.apache.tools.ant.Target; | import org.apache.tools.ant.Target; | ||||
@@ -52,7 +53,7 @@ public class Description extends DataType { | |||||
*/ | */ | ||||
public void addText(String text) { | public void addText(String text) { | ||||
ProjectHelper ph = getProject().getReference(ProjectHelper.PROJECTHELPER_REFERENCE); | |||||
ProjectHelper ph = getProject().getReference(MagicNames.REFID_PROJECT_HELPER); | |||||
if (!(ph instanceof ProjectHelperImpl)) { | if (!(ph instanceof ProjectHelperImpl)) { | ||||
// New behavior for delayed task creation. Description | // New behavior for delayed task creation. Description | ||||
// will be evaluated in Project.getDescription() | // will be evaluated in Project.getDescription() | ||||
@@ -23,6 +23,7 @@ import java.util.Map; | |||||
import org.apache.tools.ant.AntClassLoader; | import org.apache.tools.ant.AntClassLoader; | ||||
import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
import org.apache.tools.ant.MagicNames; | |||||
/** | /** | ||||
@@ -31,7 +32,7 @@ import org.apache.tools.ant.BuildException; | |||||
*/ | */ | ||||
public class ScriptFixBSFPath { | public class ScriptFixBSFPath { | ||||
private static final String UTIL_OPTIONAL_PACKAGE | private static final String UTIL_OPTIONAL_PACKAGE | ||||
= "org.apache.tools.ant.util.optional"; | |||||
= MagicNames.ANT_CORE_PACKAGE + ".util.optional"; | |||||
private static final String BSF_PACKAGE = "org.apache.bsf"; | private static final String BSF_PACKAGE = "org.apache.bsf"; | ||||
private static final String BSF_MANAGER = BSF_PACKAGE + ".BSFManager"; | private static final String BSF_MANAGER = BSF_PACKAGE + ".BSFManager"; | ||||
@@ -18,6 +18,7 @@ | |||||
package org.apache.tools.ant.util; | package org.apache.tools.ant.util; | ||||
import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
import org.apache.tools.ant.MagicNames; | |||||
import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
/** | /** | ||||
@@ -26,8 +27,7 @@ import org.apache.tools.ant.Project; | |||||
*/ | */ | ||||
public class ScriptRunnerCreator { | public class ScriptRunnerCreator { | ||||
private static final String AUTO = "auto"; | private static final String AUTO = "auto"; | ||||
private static final String OATAU = "org.apache.tools.ant.util"; | |||||
private static final String UTIL_OPT = OATAU + ".optional"; | |||||
private static final String UTIL_OPT = MagicNames.ANT_CORE_PACKAGE + ".util.optional"; | |||||
private static final String BSF = "bsf"; | private static final String BSF = "bsf"; | ||||
private static final String BSF_PACK = "org.apache.bsf"; | private static final String BSF_PACK = "org.apache.bsf"; | ||||
@@ -31,6 +31,7 @@ import java.io.PipedOutputStream; | |||||
import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
import org.apache.tools.ant.BuildFileRule; | import org.apache.tools.ant.BuildFileRule; | ||||
import org.apache.tools.ant.MagicNames; | |||||
import org.apache.tools.ant.input.DefaultInputHandler; | import org.apache.tools.ant.input.DefaultInputHandler; | ||||
import org.apache.tools.ant.taskdefs.condition.JavaVersion; | import org.apache.tools.ant.taskdefs.condition.JavaVersion; | ||||
import org.apache.tools.ant.util.FileUtils; | import org.apache.tools.ant.util.FileUtils; | ||||
@@ -346,7 +347,7 @@ public class JavaTest { | |||||
Java java = new Java(); | Java java = new Java(); | ||||
java.setProject(buildRule.getProject()); | java.setProject(buildRule.getProject()); | ||||
java.setClassname("org.apache.tools.ant.Main"); | |||||
java.setClassname(MagicNames.ANT_CORE_PACKAGE + ".Main"); | |||||
java.setArgs("-version"); | java.setArgs("-version"); | ||||
java.setFork(true); | java.setFork(true); | ||||
// note: due to the missing classpath it will fail, but the input stream | // note: due to the missing classpath it will fail, but the input stream | ||||