ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tarun Garg" <>
Subject Re: static final string.
Date Fri, 28 Sep 2001 06:45:38 GMT
The java language itself specifies this behaviour.
So I guess nothing much can be done about this.

----- Original Message -----
From: "Tarun Garg" <>
To: "ant" <>
Sent: Friday, September 28, 2001 11:47 AM
Subject: static final string.

> This probably is not exactly an ant issue, but some of you might have
> it that's why I am posting it here.
> I have two classes. A and B.
> class A has a member in it which is declared something like:
> public static final String mesg="hello";
> Now class B uses this string for some purpose of its own.
> Lets say it just prints the message.
> class B {
> public static void main(String args[])
>     {
>         System.out.println(A.mesg);
>     }
> }
> Now when I change the mesg in class A to "hello world", Ant recompiles
> the class A as is the only file that has been modified.
> Now when I run class B, the message still remains "hello".
> I believe this has something to do the way compilers are implemented. I
> tried both javac and jikes. Both exhibit the same behaviour.
> During development it can happen that you need to change your final
> variables too.
> Has anybody faced this problem before ? How do you solve it ?
> One solution would be that whenever somebody changes a final variable, she
> informs everybody working on that project to do a clean build.
> But that's not a very clean solution.
> Any tips ?

View raw message