ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peterrei...@apache.org
Subject cvs commit: ant/src/main/org/apache/tools/ant/taskdefs DefBase.java
Date Tue, 11 May 2004 16:49:48 GMT
peterreilly    2004/05/11 09:49:48

  Modified:    src/main/org/apache/tools/ant/taskdefs DefBase.java
  Log:
  antlib: allow a typedef in an antlib to override the classpath
  unittests to follow
  
  Revision  Changes    Path
  1.11      +20 -13    ant/src/main/org/apache/tools/ant/taskdefs/DefBase.java
  
  Index: DefBase.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/DefBase.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- DefBase.java	9 Mar 2004 16:48:04 -0000	1.10
  +++ DefBase.java	11 May 2004 16:49:48 -0000	1.11
  @@ -42,7 +42,7 @@
        * @ant.attribute ignore="true"
        */
       public void setReverseLoader(boolean reverseLoader) {
  -        this.cpDelegate.setReverseLoader(reverseLoader);
  +        getDelegate().setReverseLoader(reverseLoader);
           log("The reverseloader attribute is DEPRECATED. It will be removed",
               Project.MSG_WARN);
       }
  @@ -51,14 +51,14 @@
        * @return the classpath for this definition
        */
       public Path getClasspath() {
  -        return cpDelegate.getClasspath();
  +        return getDelegate().getClasspath();
       }
   
       /**
        * @return the reverse loader attribute of the classpath delegate.
        */
       public boolean isReverseLoader() {
  -        return cpDelegate.isReverseLoader();
  +        return getDelegate().isReverseLoader();
       }
   
       /**
  @@ -66,7 +66,7 @@
        * @return the loader id
        */
       public String getLoaderId() {
  -        return cpDelegate.getClassLoadId();
  +        return getDelegate().getClassLoadId();
       }
   
       /**
  @@ -74,7 +74,7 @@
        * @return the class path id
        */
       public String getClasspathId() {
  -        return cpDelegate.getClassLoadId();
  +        return getDelegate().getClassLoadId();
       }
   
       /**
  @@ -83,7 +83,7 @@
        * @param classpath an Ant Path object containing the classpath.
        */
       public void setClasspath(Path classpath) {
  -        this.cpDelegate.setClasspath(classpath);
  +        getDelegate().setClasspath(classpath);
       }
   
       /**
  @@ -92,7 +92,7 @@
        * @return the classpath of the this definition
        */
       public Path createClasspath() {
  -        return this.cpDelegate.createClasspath();
  +        return getDelegate().createClasspath();
       }
   
       /**
  @@ -101,7 +101,7 @@
        * @param r the reference to the classpath
        */
       public void setClasspathRef(Reference r) {
  -        this.cpDelegate.setClasspathref(r);
  +        getDelegate().setClasspathref(r);
       }
   
       /**
  @@ -117,7 +117,7 @@
        * @since Ant 1.5
        */
       public void setLoaderRef(Reference r) {
  -        this.cpDelegate.setLoaderRef(r);
  +        getDelegate().setLoaderRef(r);
       }
   
       /**
  @@ -125,11 +125,14 @@
        * @return the classloader from the cpDelegate
        */
       protected ClassLoader createLoader() {
  -        if (getAntlibClassLoader() != null) {
  +        if (getAntlibClassLoader() != null && cpDelegate == null) {
               return getAntlibClassLoader();
           }
  +        if (cpDelegate == null) {
  +            cpDelegate = ClasspathUtils.getDelegate(this);
  +        }
           if (createdLoader == null) {
  -            createdLoader = this.cpDelegate.getClassLoader();
  +            createdLoader = cpDelegate.getClassLoader();
               // need to load Task via system classloader or the new
               // task we want to define will never be a Task but always
               // be wrapped into a TaskAdapter.
  @@ -144,9 +147,13 @@
        * @since Ant 1.6
        */
       public void init() throws BuildException {
  -        this.cpDelegate = ClasspathUtils.getDelegate(this);
           super.init();
       }
   
  -
  +    private ClasspathUtils.Delegate getDelegate() {
  +        if (cpDelegate == null) {
  +            cpDelegate = ClasspathUtils.getDelegate(this);
  +        }
  +        return cpDelegate;
  +    }
   }
  
  
  

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


Mime
View raw message