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

From: <[EMAIL PROTECTED]>
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:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to