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.
I am using NetBeans 6.0 m3. When I try to compile a single file, the deps-jar task does a dependency check and deletes other class files for classes that depend on the one I am compiling. However, the compile-single action only compiles the file I am on. Therefore, compile-single is useless. Based on a discussion on the nbusers mailing list, I would like to suggest two possible courses of action. a) Allow for deleting the out of date class files to be turned off b) Compile the deleted class files from their java source again As it is right now, my fellow developers want to revert back to NetBeans 5.0, even though it does not have Subversion support.
Wrong component. Please use 'ide' if unsure which component to file a bug report in.
(a) is a workaround requiring GUI changes, which is not really acceptable. (b) is not a good idea either, since one of the primary use cases for compile-single to begin with is to permit the user to compile only certain classes or packages and leave others completely untouched. So I would rather suggest (c) Modify the -do-compile-single and -do-compile-test-single targets to always recompile the selected file(s), regardless of any existing .class files, and not call <depend>. Right now I am not sure what build-impl.xsl modification to suggest; would like to retain <depend> in -init-macrodef-javac, but Ant's <macrodef> and <sequential> are too weak to permit a subtask to be conditionally run. Could perhaps pass a bogus destdir to <depend>, making it a no-op, but this is rather ugly. Also need to use <pathconvert> or the like to forcibly remove the target .class file corresponding to the source, since <javac> cannot be forced to recompile a source for which the .class file exists. Workaround for current builds is trivial: edit build.xml to override -init-macrodef-javac to be the same but not include <depend>. Or, override -do-compile-{,test-}single to call <javac> rather than <j2seproject3:javac> and insert appropriate attributes instead.
The depend clause of init-macrodef-javac will only work properly if the user is doing a project build. Even then, it may not work "correctly" because of the issue of public static final primitive fields, as described in the Ant documentation. It is completely useless if the user is doing a clean/build cycle, and is positively harmful if they are doing a compile-single. It appears that the solution to this would require for the depends task to be modified to pass back to Ant a list of all of the files it impacted.
Re. compile-time constants (primitives or String's) - yes, these can break any classfile-based dependency tracker, but in practice changes to the values of, or removals of, existing constants are relatively uncommon compared to other kinds of code edits. (Creators of public APIs should be especially wary of such changes because they can have unexpected effects on unrecompiled binary client code.) When in doubt do a clean build. Re. clean-build cycle - useless but (AFAIK) harmless. Re. modifying <depend> task - not going to happen. I reiterate that the best approach would probably be to skip using <depend> at all for the -single targets. The question remains how best to express this in build-impl.xml. Perhaps use the original macrodef to mean just javac but add a new macrodef to mean javac plus depend; should be compatible for 5.x users with modified build.xml's.
Make sure this is not forgotten...
Jesse, I agree with your suggested fix. I think that would work really well.
I am going to fix it as Jesse sugested (adding new macrodefs with depend).
I can take this one.
Note that there is a subtle danger. If you have class A, and class B depends on A, and you F11; then make an incompatible change in class A and press F9 on it; then press F11 - you will quietly get a JAR file with an unloadable version of B.class: B is not recompiled. It seems that <depend> really expects to be used each time you compile. I guess the upshot is: if you want dependency tracking, use only F11, never F9.
Looks like I also need to change run-single (and debug-single) to depend on compile, not compile-single. Else they will recompile the selected file needlessly. Anyway consistent with recent change of test-single to depend on compile-test rather than compile-test-single (issue #97053). The main argument for run-single -> compile-single is anyway mostly obsoleted by issue #49026.
Checking in test/unit/src/org/netbeans/modules/java/j2seproject/BuildImplTest.java; /shared/data/ccvs/repository/java/j2seproject/test/unit/src/org/netbeans/modules/java/j2seproject/BuildImplTest.java,v <-- BuildImplTest.java new revision: 1.10; previous revision: 1.9 done Checking in src/org/netbeans/modules/java/j2seproject/resources/build-impl.xsl; /shared/data/ccvs/repository/java/j2seproject/src/org/netbeans/modules/java/j2seproject/resources/build-impl.xsl,v <-- build-impl.xsl new revision: 1.87; previous revision: 1.86 done