ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant Project.java
Date Tue, 10 Sep 2002 20:17:26 GMT
stevel      2002/09/10 13:17:26

  Modified:    src/main/org/apache/tools/ant Project.java
  Log:
  This is a fractional refactor of the class to split task creation from adding it to the
list of tasks we know about. As the factored out method is private, external routines still
cannot create tasks that arent added to the list...this change does not alter the external
API of Project, just makes it possible.
  
  Revision  Changes    Path
  1.115     +25 -4     jakarta-ant/src/main/org/apache/tools/ant/Project.java
  
  Index: Project.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/Project.java,v
  retrieving revision 1.114
  retrieving revision 1.115
  diff -u -r1.114 -r1.115
  --- Project.java	25 Jul 2002 15:21:01 -0000	1.114
  +++ Project.java	10 Sep 2002 20:17:25 -0000	1.115
  @@ -1087,8 +1087,9 @@
       }
   
       /**
  -     * Creates a new instance of a task.
  -     *
  +     * Creates a new instance of a task, adding it to a list of
  +     * created tasks for later invalidation. This causes all tasks
  +     * to be remembered until the containing project is removed
        * @param taskType The name of the task to create an instance of.
        *                 Must not be <code>null</code>.
        *
  @@ -1099,6 +1100,27 @@
        *                           creation fails.
        */
       public Task createTask(String taskType) throws BuildException {
  +        Task task=createNewTask(taskType);
  +        if(task!=null) {
  +            addCreatedTask(taskType, task);
  +        }
  +        return task;
  +    }
  +
  +    /**
  +     * Creates a new instance of a task. This task is not
  +     * cached in the createdTasks list.
  +     * @since ant1.6
  +     * @param taskType The name of the task to create an instance of.
  +     *                 Must not be <code>null</code>.
  +     *
  +     * @return an instance of the specified task, or <code>null</code> if
  +     *         the task name is not recognised.
  +     *
  +     * @exception BuildException if the task name is recognised but task
  +     *                           creation fails.
  +     */
  +    private Task createNewTask(String taskType) throws BuildException {
           Class c = (Class) taskClassDefinitions.get(taskType);
   
           if (c == null) {
  @@ -1125,7 +1147,6 @@
   
               String msg = "   +Task: " + taskType;
               log (msg, MSG_DEBUG);
  -            addCreatedTask(taskType, task);
               return task;
           } catch (Throwable t) {
               String msg = "Could not create task of type: "
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message