ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rhino <>
Subject Re: General Concept Question
Date Tue, 01 Nov 2011 14:46:10 GMT

On 2011-11-01 01:42, Stefan Bodewig wrote:
> 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;
> }
No. What I have is a Constants file that looks like this before the 
build script starts running:

public class ResumeConstants {

public static final boolean FOO = true;

That is referenced by another Java class that looks like this:

public ResumeFileGenerator {

   if ResumeConstants.FOO { /* otherwise, print nothing */

  My build script prompts the person running the script whether FOO 
should be true or false on this run. If it should be false, 
ResumeConstants is edited (and saved), then all the files are compiled, 
then ResumeFileGenerator runs. But ResumeFileGenerator behaves as if FOO 
is true, even though it has been changed to false. A display of FOO in 
ResumeFileGenerator shows it to be true, even though I know I set it to 
> 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-)
My Java is rusty too, I'm afraid. I'm not sure if your remark still 
applies now that I've clarified what's actually happening in the code?
> Stefan
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message