You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Vlastimil Babka <ca...@gentoo.org> on 2006/10/04 11:34:55 UTC

ant-1.7.0_beta2: ant.jar depends on ant-nodeps.jar due to WeakishReference

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

It happens because WeakishReference.java imports
optional/WeakishReference12.java. Shouldn't be problem as long as you
use both jars together, but in Gentoo we are packaging them separately,
so it can be a problem (in case somebody still uses WeakishReference :)

- --
Vlastimil Babka (Caster)
Gentoo/Java
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFI4A+tbrAj05h3oQRApZ3AJ9ZMs4K8+wC5kuwxPX0YYxJgN1q0gCfSW5g
0zIOeGdrMGnkD6b44fOsgHk=
=qyen
-----END PGP SIGNATURE-----

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


Re: ant-1.7.0_beta2: ant.jar depends on ant-nodeps.jar due to WeakishReference

Posted by Steve Loughran <st...@apache.org>.
Antoine Levy-Lambert wrote:
> Hello Steve,
> 
> sounds good.
> 
> Are you going to implement the changes ?

already done, just waiting to see what people thought before I committed 
them. And for the tests to pass...

> 
> Regards,
> 
> Antoine
> -------- Original-Nachricht --------
> Datum: Wed, 04 Oct 2006 13:17:39 +0100
> Von: Steve Loughran <st...@apache.org>
> An: Ant Developers List <de...@ant.apache.org>
> Betreff: Re: ant-1.7.0_beta2: ant.jar depends on ant-nodeps.jar due to WeakishReference
> 
>> Steve Loughran wrote:
>>> Vlastimil Babka wrote:
>>>> -----BEGIN PGP SIGNED MESSAGE-----
>>>> Hash: SHA1
>>>>
>>>> It happens because WeakishReference.java imports
>>>> optional/WeakishReference12.java. Shouldn't be problem as long as you
>>>> use both jars together, but in Gentoo we are packaging them separately,
>>>> so it can be a problem (in case somebody still uses WeakishReference :)
>>> Maybe we can kill WeakishReference it was only there to let Java1.2 hang
>>> on to stuff weakly and yet still have code that worked on Java1.1. That 
>>> is no longer a requirement...
>>>
>> I am of course wrong
>>
>> 1. oata.util.WeakishReference is in Core, since Ant1.6. There's a 
>> HardReference as a nested class.
>>
>> 2. oata.optional.WeakReference12 extends WeakishReference s the Ant1.2+ 
>> implementation.
>>
>> In the past, the factory in WeakishReference would defer to 
>> WeakReference12 in ant1.2+, using reflection. Right now, in SVN, its 
>> hard coded in, leading to Vlastimil's problem.
>>
>> Here's what I propose.
>>
>> 1. Move all the functionality of WeakishReference12 into WeakishReference.
>>
>> 2. Leave WeakishReference12 in place as a (deprecated) facade.
>>
>> 3. Turn WeakishReference.HardReference into a (deprecated) Facade.
>>
>> this eliminatest the cross package functionality by moving what we need 
>> into the core (and creating nothing new) there. All references become 
>> weak, which was the original goal.
>>
>> The alternative would be to delete the lot of them.
>>
>> -Steve
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
> 


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


Re: ant-1.7.0_beta2: ant.jar depends on ant-nodeps.jar due to WeakishReference

Posted by Antoine Levy-Lambert <an...@gmx.de>.
Hello Steve,

sounds good.

Are you going to implement the changes ?

Regards,

Antoine
-------- Original-Nachricht --------
Datum: Wed, 04 Oct 2006 13:17:39 +0100
Von: Steve Loughran <st...@apache.org>
An: Ant Developers List <de...@ant.apache.org>
Betreff: Re: ant-1.7.0_beta2: ant.jar depends on ant-nodeps.jar due to WeakishReference

> Steve Loughran wrote:
> > Vlastimil Babka wrote:
> >> -----BEGIN PGP SIGNED MESSAGE-----
> >> Hash: SHA1
> >>
> >> It happens because WeakishReference.java imports
> >> optional/WeakishReference12.java. Shouldn't be problem as long as you
> >> use both jars together, but in Gentoo we are packaging them separately,
> >> so it can be a problem (in case somebody still uses WeakishReference :)
> > 
> > Maybe we can kill WeakishReference it was only there to let Java1.2 hang
> > on to stuff weakly and yet still have code that worked on Java1.1. That 
> > is no longer a requirement...
> > 
> 
> I am of course wrong
> 
> 1. oata.util.WeakishReference is in Core, since Ant1.6. There's a 
> HardReference as a nested class.
> 
> 2. oata.optional.WeakReference12 extends WeakishReference s the Ant1.2+ 
> implementation.
> 
> In the past, the factory in WeakishReference would defer to 
> WeakReference12 in ant1.2+, using reflection. Right now, in SVN, its 
> hard coded in, leading to Vlastimil's problem.
> 
> Here's what I propose.
> 
> 1. Move all the functionality of WeakishReference12 into WeakishReference.
> 
> 2. Leave WeakishReference12 in place as a (deprecated) facade.
> 
> 3. Turn WeakishReference.HardReference into a (deprecated) Facade.
> 
> this eliminatest the cross package functionality by moving what we need 
> into the core (and creating nothing new) there. All references become 
> weak, which was the original goal.
> 
> The alternative would be to delete the lot of them.
> 
> -Steve
> 

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


Re: ant-1.7.0_beta2: ant.jar depends on ant-nodeps.jar due to WeakishReference

Posted by Antoine Levy-Lambert <an...@gmx.de>.
Hello Kevin,

I do not see the patch in the email.

Regards,

Antoine
On Oct 5, 2006, at 5:31 AM, Kevin Jackson wrote:

> Here's a patch that (should) do what Steve suggested - my only worry
> is that I've changed the signature of the WeakishReference class -
> hence I'm submitting as a patch instead of committing this myself
>
> Thanks,
> Kev
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org


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


Re: ant-1.7.0_beta2: ant.jar depends on ant-nodeps.jar due to WeakishReference

Posted by Kevin Jackson <fo...@gmail.com>.
On 10/5/06, Steve Loughran <st...@apache.org> wrote:
> Kevin Jackson wrote:
> > Inline patch as gmail seems to not like .patch attachments today:
>
> This is almost like what I have done, except I kept WeakishReference
> abstract, and had WeakReference12 extend HardReference. That way the
> base class remains abstract.
>

That's better as it keeps the public API of WeakishReference the same
as it's always been (although changing it to not be abstract would be
a BWC change anyway)

Kev

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


Re: ant-1.7.0_beta2: ant.jar depends on ant-nodeps.jar due to WeakishReference

Posted by Steve Loughran <st...@apache.org>.
Kevin Jackson wrote:
> Inline patch as gmail seems to not like .patch attachments today:

This is almost like what I have done, except I kept WeakishReference 
abstract, and had WeakReference12 extend HardReference. That way the 
base class remains abstract.

-steve

> 
> Index: org/apache/tools/ant/util/WeakishReference.java
> 
> ===================================================================
> 
> --- org/apache/tools/ant/util/WeakishReference.java    (revision 453080)
> 
> +++ org/apache/tools/ant/util/WeakishReference.java    (working copy)
> 
> @@ -18,7 +18,7 @@
> 
> 
> package org.apache.tools.ant.util;
> 
> -import org.apache.tools.ant.util.optional.WeakishReference12;
> +import java.lang.ref.WeakReference;
> 
> /**
>  * This is a weak reference on java1.2 and up, that is all
> @@ -27,8 +27,10 @@
> 
>  * @deprecated since 1.7.
>  *             Just use {@link java.lang.ref.WeakReference} directly.
>  */
> -public abstract class WeakishReference  {
> +public class WeakishReference  {
> 
> +    private WeakReference weakref;
> +
>     /**
>      * create the appropriate type of reference for the java version
>      * @param object the object that the reference will refer to.
> @@ -35,17 +37,23 @@
> 
>      * @return reference to the Object.
>      */
>     public static WeakishReference createReference(Object object) {
> -            return new WeakishReference12(object);
> +        return new WeakishReference(object);
>     }
> 
> +    public WeakishReference(Object reference) {
> +        this.weakref = new WeakReference(reference);
> +    }
> +
> +    public WeakishReference() {/* default */}
> +
>     /**
> -     * Returns this reference object's referent.  If this reference 
> object has
> -     * been cleared, then this method returns <code>null</code>.
> +     * Returns this reference object's referent.
>      *
> -     * @return The object to which this reference refers, or
> -     *         <code>null</code> if this reference object has been 
> cleared.
> +     * @return referent.
>      */
> -    public abstract Object get();
> +    public Object get() {
> +        return weakref.get();
> +    }
> 
>     /**
>      * A hard reference for Java 1.1.
> @@ -53,7 +61,6 @@
> 
>      *             Hopefully nobody is using this.
>      */
>     public static class HardReference extends WeakishReference {
> -        private Object object;
> 
>         /**
>          * constructor.
> @@ -60,7 +67,7 @@
> 
>          * @param object the object that the reference will refer to.
>          */
>         public HardReference(Object object) {
> -            this.object = object;
> +            super(object);
>         }
> 
>         /**
> @@ -68,8 +75,7 @@
> 
>          * @return the object to which this reference refers.
>          */
>         public Object get() {
> -            return object;
> +            return super.get();
>         }
>     }
> -
> -}
> +}
> 
> \ No newline at end of file
> 
> Index: org/apache/tools/ant/util/optional/WeakishReference12.java
> 
> ===================================================================
> 
> --- org/apache/tools/ant/util/optional/WeakishReference12.java    
> (revision 453080)
> 
> +++ org/apache/tools/ant/util/optional/WeakishReference12.java    
> (working copy)
> 
> @@ -20,8 +20,6 @@
> 
> 
> import org.apache.tools.ant.util.WeakishReference;
> 
> -import java.lang.ref.WeakReference;
> -
> /**
>  * This is a reference that really is is Weak, as it uses the
>  * appropriate java.lang.ref class.
> @@ -30,25 +28,4 @@
> 
>  */
> public class WeakishReference12 extends WeakishReference  {
> 
> -    private WeakReference weakref;
> -
> -    /**
> -     * create a new soft reference, which is bound to a
> -     * Weak reference inside
> -     * @param reference
> -     * @see java.lang.ref.WeakReference
> -     */
> -    public WeakishReference12(Object reference) {
> -        this.weakref = new WeakReference(reference);
> -    }
> -
> -    /**
> -     * Returns this reference object's referent.
> -     *
> -     * @return referent.
> -     */
> -    public Object get() {
> -        return weakref.get();
> -    }
> -
> -}
> +}
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
> 


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


Re: ant-1.7.0_beta2: ant.jar depends on ant-nodeps.jar due to WeakishReference

Posted by Kevin Jackson <fo...@gmail.com>.
Inline patch as gmail seems to not like .patch attachments today:

Index: org/apache/tools/ant/util/WeakishReference.java

===================================================================

--- org/apache/tools/ant/util/WeakishReference.java	(revision 453080)

+++ org/apache/tools/ant/util/WeakishReference.java	(working copy)

@@ -18,7 +18,7 @@


 package org.apache.tools.ant.util;

-import org.apache.tools.ant.util.optional.WeakishReference12;
+import java.lang.ref.WeakReference;

 /**
  * This is a weak reference on java1.2 and up, that is all
@@ -27,8 +27,10 @@

  * @deprecated since 1.7.
  *             Just use {@link java.lang.ref.WeakReference} directly.
  */
-public abstract class WeakishReference  {
+public class WeakishReference  {

+    private WeakReference weakref;
+
     /**
      * create the appropriate type of reference for the java version
      * @param object the object that the reference will refer to.
@@ -35,17 +37,23 @@

      * @return reference to the Object.
      */
     public static WeakishReference createReference(Object object) {
-            return new WeakishReference12(object);
+        return new WeakishReference(object);
     }

+    public WeakishReference(Object reference) {
+        this.weakref = new WeakReference(reference);
+    }
+
+    public WeakishReference() {/* default */}
+
     /**
-     * Returns this reference object's referent.  If this reference object has
-     * been cleared, then this method returns <code>null</code>.
+     * Returns this reference object's referent.
      *
-     * @return The object to which this reference refers, or
-     *         <code>null</code> if this reference object has been cleared.
+     * @return referent.
      */
-    public abstract Object get();
+    public Object get() {
+        return weakref.get();
+    }

     /**
      * A hard reference for Java 1.1.
@@ -53,7 +61,6 @@

      *             Hopefully nobody is using this.
      */
     public static class HardReference extends WeakishReference {
-        private Object object;

         /**
          * constructor.
@@ -60,7 +67,7 @@

          * @param object the object that the reference will refer to.
          */
         public HardReference(Object object) {
-            this.object = object;
+            super(object);
         }

         /**
@@ -68,8 +75,7 @@

          * @return the object to which this reference refers.
          */
         public Object get() {
-            return object;
+            return super.get();
         }
     }
-
-}
+}

\ No newline at end of file

Index: org/apache/tools/ant/util/optional/WeakishReference12.java

===================================================================

--- org/apache/tools/ant/util/optional/WeakishReference12.java	(revision 453080)

+++ org/apache/tools/ant/util/optional/WeakishReference12.java	(working copy)

@@ -20,8 +20,6 @@


 import org.apache.tools.ant.util.WeakishReference;

-import java.lang.ref.WeakReference;
-
 /**
  * This is a reference that really is is Weak, as it uses the
  * appropriate java.lang.ref class.
@@ -30,25 +28,4 @@

  */
 public class WeakishReference12 extends WeakishReference  {

-    private WeakReference weakref;
-
-    /**
-     * create a new soft reference, which is bound to a
-     * Weak reference inside
-     * @param reference
-     * @see java.lang.ref.WeakReference
-     */
-    public WeakishReference12(Object reference) {
-        this.weakref = new WeakReference(reference);
-    }
-
-    /**
-     * Returns this reference object's referent.
-     *
-     * @return referent.
-     */
-    public Object get() {
-        return weakref.get();
-    }
-
-}
+}

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


Re: ant-1.7.0_beta2: ant.jar depends on ant-nodeps.jar due to WeakishReference

Posted by Kevin Jackson <fo...@gmail.com>.
Here's a patch that (should) do what Steve suggested - my only worry
is that I've changed the signature of the WeakishReference class -
hence I'm submitting as a patch instead of committing this myself

Thanks,
Kev


Re: ant-1.7.0_beta2: ant.jar depends on ant-nodeps.jar due to WeakishReference

Posted by Kevin Jackson <fo...@gmail.com>.
>
> > Here's what I propose.
> >
> > 1. Move all the functionality of WeakishReference12 into
> > WeakishReference.
> >
> > 2. Leave WeakishReference12 in place as a (deprecated) facade.
> >
> > 3. Turn WeakishReference.HardReference into a (deprecated) Facade.
>

+1

(I'll try and help out on this one too)
Kev

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


Re: ant-1.7.0_beta2: ant.jar depends on ant-nodeps.jar due to WeakishReference

Posted by Stefan Bodewig <bo...@apache.org>.
On Wed, 04 Oct 2006, Steve Loughran <st...@apache.org> wrote:

> Here's what I propose.
> 
> 1. Move all the functionality of WeakishReference12 into
> WeakishReference.
> 
> 2. Leave WeakishReference12 in place as a (deprecated) facade.
> 
> 3. Turn WeakishReference.HardReference into a (deprecated) Facade.

+1

Stefan

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


Re: ant-1.7.0_beta2: ant.jar depends on ant-nodeps.jar due to WeakishReference

Posted by Steve Loughran <st...@apache.org>.
Steve Loughran wrote:
> Vlastimil Babka wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> It happens because WeakishReference.java imports
>> optional/WeakishReference12.java. Shouldn't be problem as long as you
>> use both jars together, but in Gentoo we are packaging them separately,
>> so it can be a problem (in case somebody still uses WeakishReference :)
> 
> Maybe we can kill WeakishReference it was only there to let Java1.2 hang 
> on to stuff weakly and yet still have code that worked on Java1.1. That 
> is no longer a requirement...
> 

I am of course wrong

1. oata.util.WeakishReference is in Core, since Ant1.6. There's a 
HardReference as a nested class.

2. oata.optional.WeakReference12 extends WeakishReference s the Ant1.2+ 
implementation.

In the past, the factory in WeakishReference would defer to 
WeakReference12 in ant1.2+, using reflection. Right now, in SVN, its 
hard coded in, leading to Vlastimil's problem.

Here's what I propose.

1. Move all the functionality of WeakishReference12 into WeakishReference.

2. Leave WeakishReference12 in place as a (deprecated) facade.

3. Turn WeakishReference.HardReference into a (deprecated) Facade.

this eliminatest the cross package functionality by moving what we need 
into the core (and creating nothing new) there. All references become 
weak, which was the original goal.

The alternative would be to delete the lot of them.

-Steve



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


Re: ant-1.7.0_beta2: ant.jar depends on ant-nodeps.jar due to WeakishReference

Posted by Steve Loughran <st...@apache.org>.
Vlastimil Babka wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> It happens because WeakishReference.java imports
> optional/WeakishReference12.java. Shouldn't be problem as long as you
> use both jars together, but in Gentoo we are packaging them separately,
> so it can be a problem (in case somebody still uses WeakishReference :)

Maybe we can kill WeakishReference it was only there to let Java1.2 hang 
on to stuff weakly and yet still have code that worked on Java1.1. That 
is no longer a requirement...

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