This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 145671 - [65cat] after disabling, CoS is still in action
Summary: [65cat] after disabling, CoS is still in action
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Project (show other bugs)
Version: 6.x
Hardware: PC Windows XP
: P2 blocker with 1 vote (vote)
Assignee: Tomas Zezula
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-08-30 10:14 UTC by ulfzibis
Modified: 2008-09-03 17:28 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ulfzibis 2008-08-30 10:14:48 UTC
[ BUILD # : 200808260201 ]
[ JDK VERSION : 1.6.0_07 ]

1.) disable CoS ("Compile on Save") in Project properties window
2.) memorize timestamp of some class file in ./build/classes/*
3.) modify concerning java file (see '*' in editor tab)
4.) Hit "Save all" button
5.) control timestamp of same class file in ./build/classes/*, and
    see: --> timestamp has changed. :-(
Comment 1 ulfzibis 2008-08-30 12:14:37 UTC
*** Issue 145669 has been marked as a duplicate of this issue. ***
Comment 2 alcmontejo 2008-08-30 12:35:46 UTC

*** This issue has been marked as a duplicate of 145669 ***
Comment 3 ulfzibis 2008-08-31 10:25:13 UTC
Please let the NetBeans guy's decide.
Comment 4 Jan Lahoda 2008-08-31 17:27:57 UTC
A solution that comes to my mind is that the project would delete the marking file
(${build.dir}/.netbeans_automatic_build) when the compile on save is disabled and the project properties dialog closed.

I do not think this qualifies as P1 - there is a simple workaround: Clean & Build the project (also any of Build, Clean
and Run should suffice in the case of J2SE Project).
Comment 5 ulfzibis 2008-08-31 20:47:30 UTC
I'm OK with P2.

I tried your simple workaround: Clean & Build the project (J2SE Project), then disabled CoS.
I modified some java file.
After Save All the the changed class was compile newly. :-(

The marker file is still there, but it's at ${build.dir}/classes/, not at ${build.dir}/ ???


Comment 6 ulfzibis 2008-09-01 12:41:08 UTC
After ~20 minutes the marker was disappeared by itself. :-)(
Comment 7 Tomas Zezula 2008-09-01 16:51:32 UTC
There are several things:
1) The issue is reproduceable only on Windows, the COS sets timestamps of generated files to 1.1.1970 0:0 which doesn't work on Windows.
     This causes that the COS class file is always overwritten by the ant build script.
2) Cleaning the .netbeans_automatic_* file doesn't help since the check is not done for run single. So the build script needs to be changed to
call verify-automatic even for run single and debug single.

Comment 8 Tomas Zezula 2008-09-01 18:34:02 UTC
Unfortunately on Windows cleaning the .netbeans_automatic_build makes the situation even worse since the COS generated files are not  cleaned and become 
part of deployed application.
Comment 9 ulfzibis 2008-09-01 18:59:43 UTC
You are any more sure, this issue is only P2 ? ;-)
-Ulf
Comment 10 Tomas Zezula 2008-09-01 19:00:42 UTC
The solution seems to be cleaning the project when user closes customizer and (s)he disabled the COS.
I will try.
Comment 11 ulfzibis 2008-09-01 19:41:44 UTC
Suggestion:
possible Clean of the project should be notified to the user in the customizer!
Comment 12 Tomas Zezula 2008-09-02 09:22:52 UTC
>possible Clean of the project should be notified to the user in the customizer
Not probably needed, disabling of COS always forced clean (by ant script), the problem was that it was later than needed.
But it's no problem to add it, except of it needs an ui review.

Comment 13 Tomas Zezula 2008-09-02 09:59:28 UTC
I have the fix ready to integrate.
Now I need to approve the following UI change:
The Compile tab will display a warning message (in the bottom) when the COS changed state from yes to no.
Message:
Disabling of Compile on Save will cause clean of the project.

Comment 14 ulfzibis 2008-09-02 10:18:48 UTC
>possible Clean of the project should be notified to the user in the customizer
Yes, it should be simple:
Instead:
   X Compile on Save
Better:
   X Compile on Save (Note: Change forces Clean of the Project after OK)

BTW:
1. In build 200808260201, disabling of CoS didn't force clean on my system.
2. It's curious, that in NetBeans dialogues (but not in Help!) nouns are capitalized like in German. Is it like that
also in Czech? I found some inconsistencies, e.g. in Project Properties->Libraries: "Compile-time libraries are
propagated to all categories."
Comment 15 ulfzibis 2008-09-02 10:21:25 UTC
Also see my comment (IMHO:) at issue 145790
Comment 16 ulfzibis 2008-09-02 10:25:46 UTC
Oops, cross-posting!
I correct:
   X Compile on Save (Note: Disabling [forces|will cause] Clean of the Project after OK)

... additional bottom line is not needed. ;-)

Comment 17 ulfzibis 2008-09-02 10:32:43 UTC
What's about 'Track Java Dependencies'?
Shouldn't it force a clean too?
Comment 18 Tomas Zezula 2008-09-02 10:38:29 UTC
>1. In build 200808260201, disabling of CoS didn't force clean on my system.
 When you disable the COS and run the build script the Ant check existence of .netbeans_automatic_build, if it exists it does the clean,
unfortunately there was a issue that the checks is not done in compile-single, so if you invoke run file the project is not cleaned, i've fixed it
as part of fix of this issue.
>2. It's curious, that in NetBeans dialogues (but not in Help!) nouns are capitalized like in German. Is it like that
>also in Czech? I found some inconsistencies, e.g. in Project Properties->Libraries: "Compile-time libraries are
>propagated to all categories."
No, in Czech nouns start with lower case. An UI rule suggest start nouns with upper case, but it should be consistent.
Comment 19 ulfzibis 2008-09-02 10:49:54 UTC
> When you disable the COS and run the build script ...
OK, clean is processed after 1st "Build Main Project", ... but not directly after disabling CoS.
Comment 20 Tomas Zezula 2008-09-02 11:43:06 UTC
Track Java Dependencies doesn't need to clean project, it just doesn't call ant depend task when disabled.
Comment 21 Patrick Keegan 2008-09-02 12:03:46 UTC
I'm not sure a message is really needed to notify people that the project will be cleaned. In fact, I think putting that
parenthetical message after the Compile on Save checkbox would be confusing as it mixes general behavior (no Compile on
Save) with one-time behavior (project will be cleaned this one time). Are there any clear use cases where it would be a
nasty surprise for users that their project has been cleaned?

If there are some use cases where it is important that the user know about the cleaning, maybe it would be better to
provide a warning dialog or text directly in the Project Properties that appears after deselecting Compile on Save.
Ondra would know better than me.

Such text could be something like "After you disable Compile on Save, the project is cleaned."
Comment 22 ulfzibis 2008-09-02 12:05:42 UTC
Hm, I must admit, that I don't understand why clean is a *must* after disabling CoS, but not after enabling 'Track Java
Dependencies'
In both cases just a property in private.properties will be changed which doesn't need an Ant run.
In both cases not until the first build run, the state of the project/build is according the property settings.
Comment 23 ulfzibis 2008-09-02 12:16:58 UTC
> Such text could be something like "After you disable Compile on Save, the project is cleaned."
Better (IMHO): "If you disable Compile on Save, the project will be cleaned by the first build run after."
(According to: "When you disable the COS _and_ run the build script ... it does the clean")
Comment 24 Tomas Zezula 2008-09-02 12:18:40 UTC
The clean is needed since the .netbeans_automatic_build file + all the created files which may come from uncompilable code has to be deleted.
The question is if we should do it quietly or warn a user about it. Currently the clean was quietly done when the user firstly called build (run, debug,...)
Turning off the COS is not just changing state of single property it's much more. In case of depend (Track Java Dependencies) there is no need to clean the
class files, they come from compilable code which may become part of final distribution.
I have no strong opinion about the need of warning. Another solution is to display a warning in the bottom of customizer when the user disables the COS, but 
maybe no warning is needed at all.
Comment 25 Tomas Zezula 2008-09-02 12:21:50 UTC
>"If you disable Compile on Save, the project will be cleaned by the first build run after"
This is the current behavior which doesn't work, the project needs to be cleaned immediately when you accept the options (OK) otherwise the
class files will be generated by saving java file until the clean.
Comment 26 Ondrej Langr 2008-09-02 12:43:51 UTC
I talked to tzezula and pkeegan and none of us is aware of any real-life situation when not warning the user could pose
a problem. So let's go with the no-warning option and just run clean silently on the background after user hits the OK
button. The warning can be added later if it proves to be a problem in some marginal cases.
Comment 27 ulfzibis 2008-09-02 13:10:45 UTC
> This is the current behavior ...
Ok, I misunderstood your "When you disable the COS _and_ run the build script ... it does the clean" as meant for the
current behaviour, not for the future fix.

How is CoS designed? Does it always force, that no file remains in "Needs compile", or does it just compile the modified
file (which only includes minimal dependencies)?
I often had the case, that is was beneficial, that I had "Compile File" + "Run File" when trying some modifications,
without the need of adapting the whole project (to be completely compilable) to my current work in some single file.
... but I assume, since ~ NB 4.1 (see issue 58122) it's unfortunatly no more possible to run-single without having *all*
files compiled.
Comment 28 Tomas Zezula 2008-09-02 13:47:15 UTC
While running COS enabled, the IDE compiles just the saved files, when you do run (run single) nothing is needed to compile.
But when you disable COS you don't want to use compile on save anymore, but there can be files which come from sources which are
not compilable (which is impossible when COS is disabled), so the project needs to clean the classes to get into the consistent state.
The classes are deleted only in situation when you disable COS.

Comment 29 Tomas Zezula 2008-09-02 14:03:25 UTC
http://hg.netbeans.org/main/rev/2cd160b17fd9
Comment 30 Quality Engineering 2008-09-03 17:28:35 UTC
Integrated into 'main-golden', will be available in build *200809031401* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/2cd160b17fd9
User: Tomas Zezula <tzezula@netbeans.org>
Log: #145671:after disabling, CoS is still in action