ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erik Hatcher" <jakarta-...@ehatchersolutions.com>
Subject Re: cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs Ant.java
Date Mon, 03 Jun 2002 13:02:58 GMT
Originally setProperty was deprecated (I believe) and it was decided to keep
the warning in there, but remove the deprecation, otherwise Ant's own
codebase would be calling the deprecated method in several places since we
did not want to remove those instances of setProperty use.

    Erik


----- Original Message -----
From: "Jose Alberto Fernandez" <j_a_fernandez@yahoo.com>
To: "Ant Developers List" <ant-dev@jakarta.apache.org>
Sent: Monday, June 03, 2002 8:48 AM
Subject: Re: cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs
Ant.java


Please take a look at the comment below on the usage of the Project API.

From: <bodewig@apache.org>
Subject: cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs
Ant.java


> bodewig     02/05/28 06:53:13
>
>   Modified:    src/main/org/apache/tools/ant Tag: ANT_15_BRANCH
>                         Project.java
>                src/main/org/apache/tools/ant/taskdefs Tag: ANT_15_BRANCH
>                         Ant.java
>   Log:
>   Make sure user properties remain user properties - no matter what
>   inheritall says.  Deal with potential non-String properties.
>
>   Revision  Changes    Path
>   No                   revision
>
>
>   No                   revision
>
>
>   1.108.2.1 +2 -2
jakarta-ant/src/main/org/apache/tools/ant/Project.java
>
>   Index: Ant.java
>   ===================================================================
>   RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Ant.java,v
>   retrieving revision 1.56.2.2
>   retrieving revision 1.56.2.3
>   diff -u -r1.56.2.2 -r1.56.2.3
>   --- Ant.java 10 May 2002 11:33:54 -0000 1.56.2.2
>   +++ Ant.java 28 May 2002 13:53:13 -0000 1.56.2.3
[...]
>   -            String value = (String) prop1.get(arg);
>   -            if (inheritAll){
>   -               newProject.setProperty(arg, value);
>   -            } else {
>   -               newProject.setUserProperty(arg, value);
>   +                String value = props.get(arg).toString();

Correct me if I am wrong but the snipped of code below is reproducing code
that we already have in the Project API.
I suggest we use here the existing API instead of implementing its current
behaviour.

>   +                if (newProject.getProperty(arg) == null){
>   +                    // no user property
>   +                    newProject.setProperty(arg, value);
>   +                }

Intead we just need to call here:

      +                newProject.setNewProperty(arg, value);

>                }
>            }
>        }
>

My point in this is that we should stop using Project.setProperty() which
allows mutation and USE the API that it is already there that guarantees the
correct behaviour.

Since we cannot get rid of it, could we at least mark Project.setProperty()
as deprecated and tell people to use
Property.setNewProperty() instead?

Jose Alberto



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




--
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