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 236004 - Problem handling library changes and source delete & renames
Summary: Problem handling library changes and source delete & renames
Status: RESOLVED WONTFIX
Alias: None
Product: java
Classification: Unclassified
Component: Project (show other bugs)
Version: 8.0
Hardware: All Linux
: P3 normal with 1 vote (vote)
Assignee: Tomas Zezula
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-16 02:27 UTC by blake1024
Modified: 2016-07-07 07:16 UTC (History)
0 users

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 blake1024 2013-09-16 02:27:05 UTC
Three similar issues.  When any of the following changes are made through the IDE:

1.  Library (Jar) file changes

2.  Java source file delete 

3.  Java source file rename

The build directory is left erroneous, often without the programmer knowing what is going on.  This often leads to hours of unnecessary work to discover the problem.  This is something the IDE can handle trivially.

For example, let's say you have a huge project with 15K classes.  You rename one of the Java files.  NetBeans compiles the renamed Java file into an associated class file in the build directory but leaves the old class file there!

Also, let's say you change the library files you use (JAR files) or change their order, NetBeans doesn't update the build directory causing the old JAR files to be loaded very unexpectedly.

Same thing with Java file deletes.

I know a clean & rebuild fixes the problem but on large projects this is rarely done.  The IDE does so much automatically, it is unexpected that it would correctly handle such simple cases.

NetBeans should:

1.  Delete all the JAr files from the build directory whenever a library change is made through the IDE.  This way the next time the app is started or built, the new libraries will be copied (without leaving copies of the old ones).

2.  Whenever a source file is renamed, the compiled version with the old name should be deleted from the build path.  This way the new one will be compiled without leaving the old one unexpectedly present.

3.  Whenever a source file is deleted, the compiled version in the build directory should be deleted too.  

Since each of these three operations occurs from within NetBeans, NetBeans knows what is happening and what logically needs to be done yet it isn't doing it.  This can cause an unsuspecting programmer many hours of unnecessary work.
Comment 1 Tomas Zezula 2013-09-19 14:58:33 UTC
Please which project are you using (J2SE Application, Maven, Web application).
The clean up is project specific and also affected by the Compile Os Save feature.
Is Compile On Save enabled?
Thanks!
Comment 2 blake1024 2013-09-19 15:10:24 UTC
The app I have is a Web Service / Tomcat application.  Please read the following:  The problem is not with the 'clean' or the 'clean & rebuild' feature of NetBeans.  The problem is when you perform one of the three functions I indicate and then try to 'build' or 'run' it without a 'clean'.  I explain it in my text.

I happen to have 'Compile on Save' off but that wouldn't matter at all.
Comment 3 Tomas Zezula 2013-09-19 16:25:00 UTC
>The problem is not with the 'clean' or the 'clean & rebuild' feature of NetBeans.
Yes, the clean clears all files in build.

>I happen to have 'Compile on Save' off but that wouldn't matter at all.
In the Java Application Project (Compile On Save Enabled) the class file for renamed (deleted) file is removed. When Compile On Save is Disabled the class file remains. However the Compile On Save on Web Project may behave differently as it's web project specific.
Comment 4 blake1024 2013-09-19 16:35:35 UTC
While it is good that NetBeans gives you a choice on whether or not to compile or not on save, in either case the actions I describe should occur.  So, the change is unrelated to that setting.
Comment 5 Martin Balin 2016-07-07 07:16:39 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss