ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve Cohen" <SCo...@sportvision.com>
Subject RE: <property refid=> question
Date Wed, 26 Feb 2003 19:29:33 GMT
Dominique - 
I do understand.  Thanks for your help.

-----Original Message-----
From: Dominique Devienne [mailto:DDevienne@lgc.com] 
Sent: Wednesday, February 26, 2003 1:26 PM
To: 'Ant Users List'
Subject: RE: <property refid=> question


It's called backward compatibility, which is also very important,
perhaps more so than consistency, at least for the Ant project. --DD

>From Project.java:
    /**
     * Adds a reference to the project.
     *
     * @param name The name of the reference.
     *        Must not be <code>null</code>.
     * @param value The value of the reference.
     *        Must not be <code>null</code>.
     */
    public void addReference(String name, Object value) {
        synchronized (references) {
            Object old = references.get(name);
            if (old == value) {
                // no warning, this is not changing anything
                return;
            }
// vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
            if (old != null && !(old instanceof UnknownElement)) {
                log("Overriding previous definition of reference to "
                    + name, MSG_WARN);
            }
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            String valueAsString = "";
            try {
                valueAsString = value.toString();
            } catch (Throwable t) {
                log("Caught exception (" + t.getClass().getName() +")"
                    + " while expanding " + name + ": " +
t.getMessage(),
                    MSG_WARN);
            }
            log("Adding reference: " + name + " -> " + valueAsString,
                MSG_DEBUG);
            references.put(name, value);
        }
    }

-----Original Message-----
From: Steve Cohen [mailto:SCohen@sportvision.com] 
Sent: Wednesday, February 26, 2003 1:19 PM
To: Ant Users List
Subject: RE: <property refid=> question

So I could initially define it empty and then define it otherwise as
needed.  

So it works the opposite as properties.  With properties, you define it
as needed (or not) first, and then if you need a default value, attempt
to redefine.  If already defined, the redefine does not take place.

But with references the "default" must be defined first.

This sort of inconsistency is what sometimes drives me crazy.

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


Mime
View raw message