1. Create a class with a public static final String
2. Create another class that accesses that variable in the static way (through class name)
3. Compile and run -> both values are same
4. Change the value of the variable
5. Clean project (verify build/ and dist/ are deleted)
6. Build and run ->
Theory: both values are same
Practice: first class picks up the change, the other keeps the old value
This is probably the result of some very low-level JVM caching of final variables, however the curious thing is that
the .class files in build directory contain different values for the variable, while the generated .jar file in dist
directory contains same values for the variable.
Test case and system specs are in the attachment.
Googling around also revealed http://www.netbeans.org/servlets/ReadMsg?listName=nbusers&msgNo=79463.
Created attachment 76747 [details]
Test case (source code + output + system specs)
Thanks for excellent bug report!
Reproducible in trunk and nb6.5.
This is not related to any issue in JDK. Netbeans has separate copy of your classfiles for "Compile on Save".
Switching off "Compile on Save" is simple worarround (Project - properties - Compiling - Compile on Save)
Fixed by http://hg.netbeans.org/jet-main/rev/478c5b86ab89
jjancura, thanks for the workaround, switching off "compile on save" solves the problem.
Integrated into 'main-golden', will be available in build *200902220201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
User: Max Sauer <firstname.lastname@example.org>
Log: #158218: Clean and Build not picking up changes in final static variables
*** Issue 159114 has been marked as a duplicate of this issue. ***
*** Issue 161171 has been marked as a duplicate of this issue. ***
*** Issue 161564 has been marked as a duplicate of this issue. ***
*** Issue 162310 has been marked as a duplicate of this issue. ***
Using NB 6.7 RC1, CoS enabled:
1. Create class A with a public static final String AA = "Revision_1"
2. Create _main()_ class B that prints that variable, accessed in the static way (through static import)
3. Compile and run (should run B.main()) -> prints "Revision_1"
4. Change the value of the variable of class A to "Revision_2"
5. Run Project ->
Theory: prints "Revision_2"
Practice: prints "Revision_1"
6. Click on Editor Tab of class B (set focus to) -> note "scanning Tasks" in status line
7. Run Project ->
OK: prints "Revision_2"
I tried to reproduce using the attached steps to reproduce, and using my own project based on the description by
ulfzibis, but I was not able to reproduce the issue. ulfzibis, please provide standalone testcase to reproduce the
*** Issue 164987 has been marked as a duplicate of this issue. ***
I've tried to make the steps to reproduce simple, and "translated" the steps for reproduce using a string constant demo,
which I never tested, but it seems, that it isn't as simple as described here, so difficult project setup from Issue
161564 should be used actually.
Sooo, is this a duplicate of #161564? If yes, let's close it as the duplicate if not: Ulf are you going to work on this
or should I assign it to someone else?
I would say, this is a duplicate of Issue 161564.
I'm not working on this. Assignment was not made be me. Sorry, I'm not familiar, what assignment means in detail.
The original problem reported is fixed. Since the problem reported by ulfzibis is covered by issue #161564 (BTW -
ulfzibis - why have you opened two issues for the same problem?), I'm closing this one as FIXED.
> BTW - ulfzibis - why have you opened two issues for the same problem?
- My original problem was stated as duplicate of this which was stated as fixed.
- Later I found out, that my original problem was still reproducible, so I added different description (guessed
dependency from focusing editor tabs) to this issue and reopened it.
- jlahoda found out, that my steps were not reproducible
- I reopened my original issue, because IMO it likely was not valid duplicate from this issue, so from this time, we had
2 open issues. (maybe I should have close this issue again at same time, but I not felt authorized to do this)