ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: General Concept Question
Date Tue, 01 Nov 2011 05:42:34 GMT
On 2011-10-31, Rhino wrote:

> I have an Ant script that changes the value of some constants in a
> constants file that is used later by a Java program. The edits are
> pretty trivial in nature - three booleans get set to false instead of
> their normal value of true - and then the Java program which uses them
> is supposed to change its behavior according to the new values of the
> booleans. But even though I am sure the edits are being done and that
> the .java files are only compiled after the edits have been completed,
> the Java program continues to see the booleans as true, even when they
> are not.

By constants you mean "static final" variables?

javac inlines static final primitives so in

public class A {
    public static final boolean FOO = true;
}
public class B {
    public static boolean BAR = A.FOO;
}

B won't even reference the A class after compilation and BAR is set to
true.  If you later change the value in A and re-compile A but not B the
value in B will not change.  You just re-compile B as well.

This is a Java concept, not an Ant concept 8-)

Stefan

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


Mime
View raw message