for a task, that is it is public, non-abstract, has a no-arg constructor and a public no-arg execute method. PR: 4163 Submitted by: Ralf Wiebicke <ralf@rw7.de> git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@269857 13f79535-47bb-0310-9956-ffa450edef68master
@@ -22,6 +22,10 @@ | |||||
<taskdef name="test" classname="org.apache.tools.ant.Project" /> | <taskdef name="test" classname="org.apache.tools.ant.Project" /> | ||||
</target> | </target> | ||||
<target name="test5a"> | |||||
<taskdef name="test" classname="org.apache.tools.ant.taskdefs.Copy" /> | |||||
</target> | |||||
<target name="test6"> | <target name="test6"> | ||||
<echo message="${build.test}" /> | <echo message="${build.test}" /> | ||||
<taskdef name="test6" | <taskdef name="test6" | ||||
@@ -62,6 +62,7 @@ import java.util.Vector; | |||||
import java.util.Properties; | import java.util.Properties; | ||||
import java.util.Enumeration; | import java.util.Enumeration; | ||||
import java.util.Stack; | import java.util.Stack; | ||||
import java.lang.reflect.Modifier; | |||||
import org.apache.tools.ant.types.FilterSet; | import org.apache.tools.ant.types.FilterSet; | ||||
@@ -414,9 +415,39 @@ public class Project { | |||||
String msg = " +User task: " + taskName + " " + taskClass.getName(); | String msg = " +User task: " + taskName + " " + taskClass.getName(); | ||||
log(msg, MSG_DEBUG); | log(msg, MSG_DEBUG); | ||||
checkTaskClass(taskClass); | |||||
taskClassDefinitions.put(taskName, taskClass); | taskClassDefinitions.put(taskName, taskClass); | ||||
} | } | ||||
/** | |||||
* Checks a class, whether it is suitable for serving as ant task. | |||||
* Throws a BuildException and logs as Project.MSG_ERR for | |||||
* conditions, that will cause the task execution to fail. | |||||
*/ | |||||
public void checkTaskClass(final Class taskClass) { | |||||
if(!Modifier.isPublic(taskClass.getModifiers())) { | |||||
final String message = taskClass + " is not public"; | |||||
log(message, Project.MSG_ERR); | |||||
throw new BuildException(message); | |||||
} | |||||
if(Modifier.isAbstract(taskClass.getModifiers())) { | |||||
final String message = taskClass + " is abstract"; | |||||
log(message, Project.MSG_ERR); | |||||
throw new BuildException(message); | |||||
} | |||||
try { | |||||
taskClass.getConstructor( null ); | |||||
// don't have to check for public, since | |||||
// getConstructor finds public constructors only. | |||||
} catch(NoSuchMethodException e) { | |||||
final String message = "No public default constructor in " + taskClass; | |||||
log(message, Project.MSG_ERR); | |||||
throw new BuildException(message); | |||||
} | |||||
if( !Task.class.isAssignableFrom(taskClass) ) | |||||
TaskAdapter.checkTaskClass(taskClass, this); | |||||
} | |||||
public Hashtable getTaskDefinitions() { | public Hashtable getTaskDefinitions() { | ||||
return taskClassDefinitions; | return taskClassDefinitions; | ||||
} | } | ||||
@@ -55,6 +55,7 @@ | |||||
package org.apache.tools.ant; | package org.apache.tools.ant; | ||||
import java.lang.reflect.Method; | import java.lang.reflect.Method; | ||||
import java.lang.reflect.Modifier; | |||||
/** | /** | ||||
@@ -67,6 +68,37 @@ public class TaskAdapter extends Task { | |||||
Object proxy; | Object proxy; | ||||
/** | |||||
* Checks a class, whether it is suitable to be adapted by TaskAdapter. | |||||
* | |||||
* Checks conditions only, which are additionally required for a tasks | |||||
* adapted by TaskAdapter. Thus, this method should be called by | |||||
* {@link Project.checkTaskClass}. | |||||
* | |||||
* Throws a BuildException and logs as Project.MSG_ERR for | |||||
* conditions, that will cause the task execution to fail. | |||||
* Logs other suspicious conditions with Project.MSG_WARN. | |||||
*/ | |||||
public static void checkTaskClass(final Class taskClass, final Project project) { | |||||
// don't have to check for interface, since then | |||||
// taskClass would be abstract too. | |||||
try { | |||||
final Method executeM = taskClass.getMethod( "execute", null ); | |||||
// don't have to check for public, since | |||||
// getMethod finds public method only. | |||||
// don't have to check for abstract, since then | |||||
// taskClass would be abstract too. | |||||
if(!Void.TYPE.equals(executeM.getReturnType())) { | |||||
final String message = "return type of execute() should be void but was \""+executeM.getReturnType()+"\" in " + taskClass; | |||||
project.log(message, Project.MSG_WARN); | |||||
} | |||||
} catch(NoSuchMethodException e) { | |||||
final String message = "No public execute() in " + taskClass; | |||||
project.log(message, Project.MSG_ERR); | |||||
throw new BuildException(message); | |||||
} | |||||
} | |||||
/** | /** | ||||
* Do the execution. | * Do the execution. | ||||
*/ | */ | ||||
@@ -94,8 +126,8 @@ public class TaskAdapter extends Task { | |||||
Class c=proxy.getClass(); | Class c=proxy.getClass(); | ||||
executeM=c.getMethod( "execute", new Class[0] ); | executeM=c.getMethod( "execute", new Class[0] ); | ||||
if( executeM == null ) { | if( executeM == null ) { | ||||
log("No execute in " + proxy.getClass(), Project.MSG_ERR); | |||||
throw new BuildException("No execute in " + proxy.getClass()); | |||||
log("No public execute() in " + proxy.getClass(), Project.MSG_ERR); | |||||
throw new BuildException("No public execute() in " + proxy.getClass()); | |||||
} | } | ||||
executeM.invoke(proxy, null); | executeM.invoke(proxy, null); | ||||
return; | return; | ||||
@@ -173,7 +173,8 @@ public abstract class Definer extends Task { | |||||
} | } | ||||
} | } | ||||
private void addDefinition( ClassLoader al, String name, String value ) { | |||||
private void addDefinition( ClassLoader al, String name, String value ) | |||||
throws BuildException { | |||||
try { | try { | ||||
Class c = al.loadClass(value); | Class c = al.loadClass(value); | ||||
AntClassLoader.initializeClass(c); | AntClassLoader.initializeClass(c); | ||||
@@ -54,13 +54,15 @@ | |||||
package org.apache.tools.ant.taskdefs; | package org.apache.tools.ant.taskdefs; | ||||
import org.apache.tools.ant.BuildException; | |||||
/** | /** | ||||
* Define a new task. | * Define a new task. | ||||
* | * | ||||
* @author <a href="stefan.bodewig@epost.de">Stefan Bodewig</a> | * @author <a href="stefan.bodewig@epost.de">Stefan Bodewig</a> | ||||
*/ | */ | ||||
public class Taskdef extends Definer { | public class Taskdef extends Definer { | ||||
protected void addDefinition(String name, Class c) { | |||||
protected void addDefinition(String name, Class c) throws BuildException { | |||||
project.addTaskDefinition(name, c); | project.addTaskDefinition(name, c); | ||||
} | } | ||||
} | } |
@@ -54,13 +54,15 @@ | |||||
package org.apache.tools.ant.taskdefs; | package org.apache.tools.ant.taskdefs; | ||||
import org.apache.tools.ant.BuildException; | |||||
/** | /** | ||||
* Define a new data type. | * Define a new data type. | ||||
* | * | ||||
* @author <a href="stefan.bodewig@epost.de">Stefan Bodewig</a> | * @author <a href="stefan.bodewig@epost.de">Stefan Bodewig</a> | ||||
*/ | */ | ||||
public class Typedef extends Definer { | public class Typedef extends Definer { | ||||
protected void addDefinition(String name, Class c) { | |||||
protected void addDefinition(String name, Class c) throws BuildException { | |||||
project.addDataTypeDefinition(name, c); | project.addDataTypeDefinition(name, c); | ||||
} | } | ||||
} | } |
@@ -528,7 +528,7 @@ public class Path extends DataType implements Cloneable { | |||||
msZipFiles.setDir(new File(System.getProperty("java.home") + File.separator + "Packages")); | msZipFiles.setDir(new File(System.getProperty("java.home") + File.separator + "Packages")); | ||||
msZipFiles.setIncludes("*.ZIP"); | msZipFiles.setIncludes("*.ZIP"); | ||||
addFileset(msZipFiles); | addFileset(msZipFiles); | ||||
} else if(System.getProperty("java.vm.name").equals("Kaffe")) { | |||||
} else if("Kaffe".equals(System.getProperty("java.vm.name"))) { | |||||
FileSet kaffeJarFiles = new FileSet(); | FileSet kaffeJarFiles = new FileSet(); | ||||
kaffeJarFiles.setDir(new File(System.getProperty("java.home") | kaffeJarFiles.setDir(new File(System.getProperty("java.home") | ||||
+ File.separator + "share" | + File.separator + "share" | ||||
@@ -549,7 +549,7 @@ public class Path extends DataType implements Cloneable { | |||||
System.getProperty("java.home") | System.getProperty("java.home") | ||||
+ File.separator + "lib" | + File.separator + "lib" | ||||
+ File.separator + "rt.jar")); | + File.separator + "rt.jar")); | ||||
// Just keep the old version as well and let addExistingToPath | |||||
// Just keep the old version as well and let addExisting | |||||
// sort it out. | // sort it out. | ||||
addExisting(new Path(null, | addExisting(new Path(null, | ||||
System.getProperty("java.home") | System.getProperty("java.home") | ||||
@@ -0,0 +1,68 @@ | |||||
/* | |||||
* The Apache Software License, Version 1.1 | |||||
* | |||||
* Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
* reserved. | |||||
* | |||||
* Redistribution and use in source and binary forms, with or without | |||||
* modification, are permitted provided that the following conditions | |||||
* are met: | |||||
* | |||||
* 1. Redistributions of source code must retain the above copyright | |||||
* notice, this list of conditions and the following disclaimer. | |||||
* | |||||
* 2. Redistributions in binary form must reproduce the above copyright | |||||
* notice, this list of conditions and the following disclaimer in | |||||
* the documentation and/or other materials provided with the | |||||
* distribution. | |||||
* | |||||
* 3. The end-user documentation included with the redistribution, if | |||||
* any, must include the following acknowlegement: | |||||
* "This product includes software developed by the | |||||
* Apache Software Foundation (http://www.apache.org/)." | |||||
* Alternately, this acknowlegement may appear in the software itself, | |||||
* if and wherever such third-party acknowlegements normally appear. | |||||
* | |||||
* 4. The names "The Jakarta Project", "Ant", and "Apache Software | |||||
* Foundation" must not be used to endorse or promote products derived | |||||
* from this software without prior written permission. For written | |||||
* permission, please contact apache@apache.org. | |||||
* | |||||
* 5. Products derived from this software may not be called "Apache" | |||||
* nor may "Apache" appear in their names without prior written | |||||
* permission of the Apache Group. | |||||
* | |||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED | |||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR | |||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | |||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | |||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |||||
* SUCH DAMAGE. | |||||
* ==================================================================== | |||||
* | |||||
* This software consists of voluntary contributions made by many | |||||
* individuals on behalf of the Apache Software Foundation. For more | |||||
* information on the Apache Software Foundation, please see | |||||
* <http://www.apache.org/>. | |||||
*/ | |||||
package org.apache.tools.ant; | |||||
import org.apache.tools.ant.Task; | |||||
public abstract class DummyTaskAbstract extends Task { | |||||
public DummyTaskAbstract() { | |||||
} | |||||
public void execute() { | |||||
} | |||||
public abstract void abstractDummy(); | |||||
} |
@@ -0,0 +1,61 @@ | |||||
/* | |||||
* The Apache Software License, Version 1.1 | |||||
* | |||||
* Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
* reserved. | |||||
* | |||||
* Redistribution and use in source and binary forms, with or without | |||||
* modification, are permitted provided that the following conditions | |||||
* are met: | |||||
* | |||||
* 1. Redistributions of source code must retain the above copyright | |||||
* notice, this list of conditions and the following disclaimer. | |||||
* | |||||
* 2. Redistributions in binary form must reproduce the above copyright | |||||
* notice, this list of conditions and the following disclaimer in | |||||
* the documentation and/or other materials provided with the | |||||
* distribution. | |||||
* | |||||
* 3. The end-user documentation included with the redistribution, if | |||||
* any, must include the following acknowlegement: | |||||
* "This product includes software developed by the | |||||
* Apache Software Foundation (http://www.apache.org/)." | |||||
* Alternately, this acknowlegement may appear in the software itself, | |||||
* if and wherever such third-party acknowlegements normally appear. | |||||
* | |||||
* 4. The names "The Jakarta Project", "Ant", and "Apache Software | |||||
* Foundation" must not be used to endorse or promote products derived | |||||
* from this software without prior written permission. For written | |||||
* permission, please contact apache@apache.org. | |||||
* | |||||
* 5. Products derived from this software may not be called "Apache" | |||||
* nor may "Apache" appear in their names without prior written | |||||
* permission of the Apache Group. | |||||
* | |||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED | |||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR | |||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | |||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | |||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |||||
* SUCH DAMAGE. | |||||
* ==================================================================== | |||||
* | |||||
* This software consists of voluntary contributions made by many | |||||
* individuals on behalf of the Apache Software Foundation. For more | |||||
* information on the Apache Software Foundation, please see | |||||
* <http://www.apache.org/>. | |||||
*/ | |||||
package org.apache.tools.ant; | |||||
public interface DummyTaskInterface { | |||||
public void execute(); | |||||
} |
@@ -0,0 +1,67 @@ | |||||
/* | |||||
* The Apache Software License, Version 1.1 | |||||
* | |||||
* Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
* reserved. | |||||
* | |||||
* Redistribution and use in source and binary forms, with or without | |||||
* modification, are permitted provided that the following conditions | |||||
* are met: | |||||
* | |||||
* 1. Redistributions of source code must retain the above copyright | |||||
* notice, this list of conditions and the following disclaimer. | |||||
* | |||||
* 2. Redistributions in binary form must reproduce the above copyright | |||||
* notice, this list of conditions and the following disclaimer in | |||||
* the documentation and/or other materials provided with the | |||||
* distribution. | |||||
* | |||||
* 3. The end-user documentation included with the redistribution, if | |||||
* any, must include the following acknowlegement: | |||||
* "This product includes software developed by the | |||||
* Apache Software Foundation (http://www.apache.org/)." | |||||
* Alternately, this acknowlegement may appear in the software itself, | |||||
* if and wherever such third-party acknowlegements normally appear. | |||||
* | |||||
* 4. The names "The Jakarta Project", "Ant", and "Apache Software | |||||
* Foundation" must not be used to endorse or promote products derived | |||||
* from this software without prior written permission. For written | |||||
* permission, please contact apache@apache.org. | |||||
* | |||||
* 5. Products derived from this software may not be called "Apache" | |||||
* nor may "Apache" appear in their names without prior written | |||||
* permission of the Apache Group. | |||||
* | |||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED | |||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR | |||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | |||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | |||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |||||
* SUCH DAMAGE. | |||||
* ==================================================================== | |||||
* | |||||
* This software consists of voluntary contributions made by many | |||||
* individuals on behalf of the Apache Software Foundation. For more | |||||
* information on the Apache Software Foundation, please see | |||||
* <http://www.apache.org/>. | |||||
*/ | |||||
package org.apache.tools.ant; | |||||
import org.apache.tools.ant.Task; | |||||
public class DummyTaskOk extends Task { | |||||
public DummyTaskOk() { | |||||
} | |||||
public void execute() { | |||||
} | |||||
} |
@@ -0,0 +1,65 @@ | |||||
/* | |||||
* The Apache Software License, Version 1.1 | |||||
* | |||||
* Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
* reserved. | |||||
* | |||||
* Redistribution and use in source and binary forms, with or without | |||||
* modification, are permitted provided that the following conditions | |||||
* are met: | |||||
* | |||||
* 1. Redistributions of source code must retain the above copyright | |||||
* notice, this list of conditions and the following disclaimer. | |||||
* | |||||
* 2. Redistributions in binary form must reproduce the above copyright | |||||
* notice, this list of conditions and the following disclaimer in | |||||
* the documentation and/or other materials provided with the | |||||
* distribution. | |||||
* | |||||
* 3. The end-user documentation included with the redistribution, if | |||||
* any, must include the following acknowlegement: | |||||
* "This product includes software developed by the | |||||
* Apache Software Foundation (http://www.apache.org/)." | |||||
* Alternately, this acknowlegement may appear in the software itself, | |||||
* if and wherever such third-party acknowlegements normally appear. | |||||
* | |||||
* 4. The names "The Jakarta Project", "Ant", and "Apache Software | |||||
* Foundation" must not be used to endorse or promote products derived | |||||
* from this software without prior written permission. For written | |||||
* permission, please contact apache@apache.org. | |||||
* | |||||
* 5. Products derived from this software may not be called "Apache" | |||||
* nor may "Apache" appear in their names without prior written | |||||
* permission of the Apache Group. | |||||
* | |||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED | |||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR | |||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | |||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | |||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |||||
* SUCH DAMAGE. | |||||
* ==================================================================== | |||||
* | |||||
* This software consists of voluntary contributions made by many | |||||
* individuals on behalf of the Apache Software Foundation. For more | |||||
* information on the Apache Software Foundation, please see | |||||
* <http://www.apache.org/>. | |||||
*/ | |||||
package org.apache.tools.ant; | |||||
public class DummyTaskOkNonTask { | |||||
public DummyTaskOkNonTask() { | |||||
} | |||||
public void execute() { | |||||
} | |||||
} |
@@ -0,0 +1,65 @@ | |||||
/* | |||||
* The Apache Software License, Version 1.1 | |||||
* | |||||
* Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
* reserved. | |||||
* | |||||
* Redistribution and use in source and binary forms, with or without | |||||
* modification, are permitted provided that the following conditions | |||||
* are met: | |||||
* | |||||
* 1. Redistributions of source code must retain the above copyright | |||||
* notice, this list of conditions and the following disclaimer. | |||||
* | |||||
* 2. Redistributions in binary form must reproduce the above copyright | |||||
* notice, this list of conditions and the following disclaimer in | |||||
* the documentation and/or other materials provided with the | |||||
* distribution. | |||||
* | |||||
* 3. The end-user documentation included with the redistribution, if | |||||
* any, must include the following acknowlegement: | |||||
* "This product includes software developed by the | |||||
* Apache Software Foundation (http://www.apache.org/)." | |||||
* Alternately, this acknowlegement may appear in the software itself, | |||||
* if and wherever such third-party acknowlegements normally appear. | |||||
* | |||||
* 4. The names "The Jakarta Project", "Ant", and "Apache Software | |||||
* Foundation" must not be used to endorse or promote products derived | |||||
* from this software without prior written permission. For written | |||||
* permission, please contact apache@apache.org. | |||||
* | |||||
* 5. Products derived from this software may not be called "Apache" | |||||
* nor may "Apache" appear in their names without prior written | |||||
* permission of the Apache Group. | |||||
* | |||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED | |||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR | |||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | |||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | |||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |||||
* SUCH DAMAGE. | |||||
* ==================================================================== | |||||
* | |||||
* This software consists of voluntary contributions made by many | |||||
* individuals on behalf of the Apache Software Foundation. For more | |||||
* information on the Apache Software Foundation, please see | |||||
* <http://www.apache.org/>. | |||||
*/ | |||||
package org.apache.tools.ant; | |||||
public class DummyTaskWithNonPublicExecute { | |||||
public DummyTaskWithNonPublicExecute() { | |||||
} | |||||
void execute() { | |||||
} | |||||
} |
@@ -0,0 +1,66 @@ | |||||
/* | |||||
* The Apache Software License, Version 1.1 | |||||
* | |||||
* Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
* reserved. | |||||
* | |||||
* Redistribution and use in source and binary forms, with or without | |||||
* modification, are permitted provided that the following conditions | |||||
* are met: | |||||
* | |||||
* 1. Redistributions of source code must retain the above copyright | |||||
* notice, this list of conditions and the following disclaimer. | |||||
* | |||||
* 2. Redistributions in binary form must reproduce the above copyright | |||||
* notice, this list of conditions and the following disclaimer in | |||||
* the documentation and/or other materials provided with the | |||||
* distribution. | |||||
* | |||||
* 3. The end-user documentation included with the redistribution, if | |||||
* any, must include the following acknowlegement: | |||||
* "This product includes software developed by the | |||||
* Apache Software Foundation (http://www.apache.org/)." | |||||
* Alternately, this acknowlegement may appear in the software itself, | |||||
* if and wherever such third-party acknowlegements normally appear. | |||||
* | |||||
* 4. The names "The Jakarta Project", "Ant", and "Apache Software | |||||
* Foundation" must not be used to endorse or promote products derived | |||||
* from this software without prior written permission. For written | |||||
* permission, please contact apache@apache.org. | |||||
* | |||||
* 5. Products derived from this software may not be called "Apache" | |||||
* nor may "Apache" appear in their names without prior written | |||||
* permission of the Apache Group. | |||||
* | |||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED | |||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR | |||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | |||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | |||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |||||
* SUCH DAMAGE. | |||||
* ==================================================================== | |||||
* | |||||
* This software consists of voluntary contributions made by many | |||||
* individuals on behalf of the Apache Software Foundation. For more | |||||
* information on the Apache Software Foundation, please see | |||||
* <http://www.apache.org/>. | |||||
*/ | |||||
package org.apache.tools.ant; | |||||
public class DummyTaskWithNonVoidExecute { | |||||
public DummyTaskWithNonVoidExecute() { | |||||
} | |||||
public int execute() { | |||||
return 0; | |||||
} | |||||
} |
@@ -0,0 +1,67 @@ | |||||
/* | |||||
* The Apache Software License, Version 1.1 | |||||
* | |||||
* Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
* reserved. | |||||
* | |||||
* Redistribution and use in source and binary forms, with or without | |||||
* modification, are permitted provided that the following conditions | |||||
* are met: | |||||
* | |||||
* 1. Redistributions of source code must retain the above copyright | |||||
* notice, this list of conditions and the following disclaimer. | |||||
* | |||||
* 2. Redistributions in binary form must reproduce the above copyright | |||||
* notice, this list of conditions and the following disclaimer in | |||||
* the documentation and/or other materials provided with the | |||||
* distribution. | |||||
* | |||||
* 3. The end-user documentation included with the redistribution, if | |||||
* any, must include the following acknowlegement: | |||||
* "This product includes software developed by the | |||||
* Apache Software Foundation (http://www.apache.org/)." | |||||
* Alternately, this acknowlegement may appear in the software itself, | |||||
* if and wherever such third-party acknowlegements normally appear. | |||||
* | |||||
* 4. The names "The Jakarta Project", "Ant", and "Apache Software | |||||
* Foundation" must not be used to endorse or promote products derived | |||||
* from this software without prior written permission. For written | |||||
* permission, please contact apache@apache.org. | |||||
* | |||||
* 5. Products derived from this software may not be called "Apache" | |||||
* nor may "Apache" appear in their names without prior written | |||||
* permission of the Apache Group. | |||||
* | |||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED | |||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR | |||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | |||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | |||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |||||
* SUCH DAMAGE. | |||||
* ==================================================================== | |||||
* | |||||
* This software consists of voluntary contributions made by many | |||||
* individuals on behalf of the Apache Software Foundation. For more | |||||
* information on the Apache Software Foundation, please see | |||||
* <http://www.apache.org/>. | |||||
*/ | |||||
package org.apache.tools.ant; | |||||
import org.apache.tools.ant.Task; | |||||
public class DummyTaskWithoutDefaultConstructor extends Task { | |||||
public DummyTaskWithoutDefaultConstructor(int dummy) { | |||||
} | |||||
public void execute() { | |||||
} | |||||
} |
@@ -0,0 +1,65 @@ | |||||
/* | |||||
* The Apache Software License, Version 1.1 | |||||
* | |||||
* Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
* reserved. | |||||
* | |||||
* Redistribution and use in source and binary forms, with or without | |||||
* modification, are permitted provided that the following conditions | |||||
* are met: | |||||
* | |||||
* 1. Redistributions of source code must retain the above copyright | |||||
* notice, this list of conditions and the following disclaimer. | |||||
* | |||||
* 2. Redistributions in binary form must reproduce the above copyright | |||||
* notice, this list of conditions and the following disclaimer in | |||||
* the documentation and/or other materials provided with the | |||||
* distribution. | |||||
* | |||||
* 3. The end-user documentation included with the redistribution, if | |||||
* any, must include the following acknowlegement: | |||||
* "This product includes software developed by the | |||||
* Apache Software Foundation (http://www.apache.org/)." | |||||
* Alternately, this acknowlegement may appear in the software itself, | |||||
* if and wherever such third-party acknowlegements normally appear. | |||||
* | |||||
* 4. The names "The Jakarta Project", "Ant", and "Apache Software | |||||
* Foundation" must not be used to endorse or promote products derived | |||||
* from this software without prior written permission. For written | |||||
* permission, please contact apache@apache.org. | |||||
* | |||||
* 5. Products derived from this software may not be called "Apache" | |||||
* nor may "Apache" appear in their names without prior written | |||||
* permission of the Apache Group. | |||||
* | |||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED | |||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR | |||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | |||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | |||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |||||
* SUCH DAMAGE. | |||||
* ==================================================================== | |||||
* | |||||
* This software consists of voluntary contributions made by many | |||||
* individuals on behalf of the Apache Software Foundation. For more | |||||
* information on the Apache Software Foundation, please see | |||||
* <http://www.apache.org/>. | |||||
*/ | |||||
package org.apache.tools.ant; | |||||
public class DummyTaskWithoutExecute { | |||||
public DummyTaskWithoutExecute() { | |||||
} | |||||
public void execute(String dummy) { | |||||
} | |||||
} |
@@ -0,0 +1,67 @@ | |||||
/* | |||||
* The Apache Software License, Version 1.1 | |||||
* | |||||
* Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
* reserved. | |||||
* | |||||
* Redistribution and use in source and binary forms, with or without | |||||
* modification, are permitted provided that the following conditions | |||||
* are met: | |||||
* | |||||
* 1. Redistributions of source code must retain the above copyright | |||||
* notice, this list of conditions and the following disclaimer. | |||||
* | |||||
* 2. Redistributions in binary form must reproduce the above copyright | |||||
* notice, this list of conditions and the following disclaimer in | |||||
* the documentation and/or other materials provided with the | |||||
* distribution. | |||||
* | |||||
* 3. The end-user documentation included with the redistribution, if | |||||
* any, must include the following acknowlegement: | |||||
* "This product includes software developed by the | |||||
* Apache Software Foundation (http://www.apache.org/)." | |||||
* Alternately, this acknowlegement may appear in the software itself, | |||||
* if and wherever such third-party acknowlegements normally appear. | |||||
* | |||||
* 4. The names "The Jakarta Project", "Ant", and "Apache Software | |||||
* Foundation" must not be used to endorse or promote products derived | |||||
* from this software without prior written permission. For written | |||||
* permission, please contact apache@apache.org. | |||||
* | |||||
* 5. Products derived from this software may not be called "Apache" | |||||
* nor may "Apache" appear in their names without prior written | |||||
* permission of the Apache Group. | |||||
* | |||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED | |||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR | |||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | |||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | |||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |||||
* SUCH DAMAGE. | |||||
* ==================================================================== | |||||
* | |||||
* This software consists of voluntary contributions made by many | |||||
* individuals on behalf of the Apache Software Foundation. For more | |||||
* information on the Apache Software Foundation, please see | |||||
* <http://www.apache.org/>. | |||||
*/ | |||||
package org.apache.tools.ant; | |||||
import org.apache.tools.ant.Task; | |||||
public class DummyTaskWithoutPublicConstructor extends Task { | |||||
DummyTaskWithoutPublicConstructor() { | |||||
} | |||||
public void execute() { | |||||
} | |||||
} |
@@ -0,0 +1,99 @@ | |||||
/* | |||||
* The Apache Software License, Version 1.1 | |||||
* | |||||
* Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
* reserved. | |||||
* | |||||
* Redistribution and use in source and binary forms, with or without | |||||
* modification, are permitted provided that the following conditions | |||||
* are met: | |||||
* | |||||
* 1. Redistributions of source code must retain the above copyright | |||||
* notice, this list of conditions and the following disclaimer. | |||||
* | |||||
* 2. Redistributions in binary form must reproduce the above copyright | |||||
* notice, this list of conditions and the following disclaimer in | |||||
* the documentation and/or other materials provided with the | |||||
* distribution. | |||||
* | |||||
* 3. The end-user documentation included with the redistribution, if | |||||
* any, must include the following acknowlegement: | |||||
* "This product includes software developed by the | |||||
* Apache Software Foundation (http://www.apache.org/)." | |||||
* Alternately, this acknowlegement may appear in the software itself, | |||||
* if and wherever such third-party acknowlegements normally appear. | |||||
* | |||||
* 4. The names "The Jakarta Project", "Ant", and "Apache Software | |||||
* Foundation" must not be used to endorse or promote products derived | |||||
* from this software without prior written permission. For written | |||||
* permission, please contact apache@apache.org. | |||||
* | |||||
* 5. Products derived from this software may not be called "Apache" | |||||
* nor may "Apache" appear in their names without prior written | |||||
* permission of the Apache Group. | |||||
* | |||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED | |||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR | |||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | |||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | |||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |||||
* SUCH DAMAGE. | |||||
* ==================================================================== | |||||
* | |||||
* This software consists of voluntary contributions made by many | |||||
* individuals on behalf of the Apache Software Foundation. For more | |||||
* information on the Apache Software Foundation, please see | |||||
* <http://www.apache.org/>. | |||||
*/ | |||||
package org.apache.tools.ant; | |||||
import java.util.Vector; | |||||
import junit.framework.Assert; | |||||
public class MockBuildListener extends Assert implements BuildListener { | |||||
private final Vector buffer = new Vector(); | |||||
private final Project project; | |||||
public MockBuildListener(final Project project) { | |||||
this.project = project; | |||||
} | |||||
public void buildStarted(BuildEvent event) {} | |||||
public void buildFinished(BuildEvent event) {} | |||||
public void targetStarted(BuildEvent event) {} | |||||
public void targetFinished(BuildEvent event) {} | |||||
public void taskStarted(BuildEvent event) {} | |||||
public void taskFinished(BuildEvent event) {} | |||||
public void messageLogged(final BuildEvent actual) { | |||||
if(actual.getPriority()==Project.MSG_DEBUG) | |||||
return; | |||||
assertTrue("unexpected messageLogged: "+actual.getMessage(), !buffer.isEmpty()); | |||||
assertEquals("unexpected project ", project, actual.getProject()); | |||||
BuildEvent expected = (BuildEvent) buffer.elementAt(0); | |||||
buffer.removeElementAt(0); | |||||
assertEquals("unexpected messageLogged ", expected.getMessage(), actual.getMessage()); | |||||
assertEquals("unexpected priority ", expected.getPriority(), actual.getPriority()); | |||||
} | |||||
public void assertEmpty() { | |||||
assertTrue("MockBuilListener is not empty", buffer.isEmpty()); | |||||
} | |||||
public void addBuildEvent(final String message, final int priority) { | |||||
final BuildEvent be = new BuildEvent(project); | |||||
be.setMessage(message, priority); | |||||
buffer.addElement(be); | |||||
} | |||||
} |
@@ -71,6 +71,7 @@ public class ProjectTest extends TestCase { | |||||
private Project p; | private Project p; | ||||
private String root; | private String root; | ||||
private MockBuildListener mbl; | |||||
public ProjectTest(String name) { | public ProjectTest(String name) { | ||||
super(name); | super(name); | ||||
@@ -80,6 +81,7 @@ public class ProjectTest extends TestCase { | |||||
p = new Project(); | p = new Project(); | ||||
p.init(); | p.init(); | ||||
root = new File(File.separator).getAbsolutePath(); | root = new File(File.separator).getAbsolutePath(); | ||||
mbl = new MockBuildListener(p); | |||||
} | } | ||||
public void testDataTypes() throws BuildException { | public void testDataTypes() throws BuildException { | ||||
@@ -155,4 +157,78 @@ public class ProjectTest extends TestCase { | |||||
path = root + path.substring(1); | path = root + path.substring(1); | ||||
return path.replace('\\', File.separatorChar).replace('/', File.separatorChar); | return path.replace('\\', File.separatorChar).replace('/', File.separatorChar); | ||||
} | } | ||||
private void assertTaskDefFails(final Class taskClass, | |||||
final String message) { | |||||
final String dummyName = "testTaskDefinitionDummy"; | |||||
try { | |||||
mbl.addBuildEvent(message, Project.MSG_ERR); | |||||
p.addTaskDefinition(dummyName, taskClass); | |||||
fail("expected BuildException(\""+message+"\", Project.MSG_ERR) when adding task " + taskClass); | |||||
} | |||||
catch(BuildException e) { | |||||
assertEquals(message, e.getMessage()); | |||||
mbl.assertEmpty(); | |||||
assertTrue(!p.getTaskDefinitions().containsKey(dummyName)); | |||||
} | |||||
} | |||||
public void testAddTaskDefinition() { | |||||
p.addBuildListener(mbl); | |||||
p.addTaskDefinition("Ok", DummyTaskOk.class); | |||||
assertEquals(DummyTaskOk.class, p.getTaskDefinitions().get("Ok")); | |||||
p.addTaskDefinition("OkNonTask", DummyTaskOkNonTask.class); | |||||
assertEquals(DummyTaskOkNonTask.class, p.getTaskDefinitions().get("OkNonTask")); | |||||
mbl.assertEmpty(); | |||||
assertTaskDefFails(DummyTaskPrivate.class, DummyTaskPrivate.class + " is not public"); | |||||
if (p.getJavaVersion() != Project.JAVA_1_1) { | |||||
assertTaskDefFails(DummyTaskProtected.class, | |||||
DummyTaskProtected.class + " is not public"); | |||||
} else { | |||||
/* | |||||
* I don't understand this, but this is what happens with | |||||
* > java -fullversion | |||||
* java full version "Linux_JDK_1.1.8_v3_green_threads" | |||||
*/ | |||||
assertTaskDefFails(DummyTaskProtected.class, | |||||
"No public default constructor in " | |||||
+ DummyTaskProtected.class); | |||||
} | |||||
assertTaskDefFails(DummyTaskPackage.class, DummyTaskPackage.class + " is not public"); | |||||
assertTaskDefFails(DummyTaskAbstract.class, DummyTaskAbstract.class + " is abstract"); | |||||
assertTaskDefFails(DummyTaskInterface.class, DummyTaskInterface.class + " is abstract"); | |||||
assertTaskDefFails(DummyTaskWithoutDefaultConstructor.class, "No public default constructor in " + DummyTaskWithoutDefaultConstructor.class); | |||||
assertTaskDefFails(DummyTaskWithoutPublicConstructor.class, "No public default constructor in " + DummyTaskWithoutPublicConstructor.class); | |||||
assertTaskDefFails(DummyTaskWithoutExecute.class, "No public execute() in " + DummyTaskWithoutExecute.class); | |||||
assertTaskDefFails(DummyTaskWithNonPublicExecute.class, "No public execute() in " + DummyTaskWithNonPublicExecute.class); | |||||
mbl.addBuildEvent("return type of execute() should be void but was \"int\" in " + DummyTaskWithNonVoidExecute.class, Project.MSG_WARN); | |||||
p.addTaskDefinition("NonVoidExecute", DummyTaskWithNonVoidExecute.class); | |||||
mbl.assertEmpty(); | |||||
assertEquals(DummyTaskWithNonVoidExecute.class, p.getTaskDefinitions().get("NonVoidExecute")); | |||||
} | |||||
private class DummyTaskPrivate extends Task { | |||||
public DummyTaskPrivate() {} | |||||
public void execute() {} | |||||
} | |||||
protected class DummyTaskProtected extends Task { | |||||
public DummyTaskProtected() {} | |||||
public void execute() {} | |||||
} | |||||
} | |||||
class DummyTaskPackage extends Task { | |||||
public DummyTaskPackage() {} | |||||
public void execute() {} | |||||
} | } |
@@ -54,6 +54,8 @@ | |||||
package org.apache.tools.ant.taskdefs; | package org.apache.tools.ant.taskdefs; | ||||
import org.apache.tools.ant.Project; | |||||
/** | /** | ||||
* @author Nico Seessle <nico@seessle.de> | * @author Nico Seessle <nico@seessle.de> | ||||
*/ | */ | ||||
@@ -84,7 +86,11 @@ public class TaskdefTest extends TaskdefsTest { | |||||
} | } | ||||
public void test5() { | public void test5() { | ||||
executeTarget("test5"); | |||||
expectBuildException("test5", "No public execute() in " + Project.class); | |||||
} | |||||
public void test5a() { | |||||
executeTarget("test5a"); | |||||
} | } | ||||
/* disabled until I know why they fail when run via the junit task --SB | /* disabled until I know why they fail when run via the junit task --SB | ||||