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 48198 - *.class should be deleted from source folders when creating new j2seproject from existing sources
Summary: *.class should be deleted from source folders when creating new j2seproject f...
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Project (show other bugs)
Version: 4.x
Hardware: All All
: P3 blocker (vote)
Assignee: Jiri Rechtacek
URL: http://projects.netbeans.org/nonav/bu...
Keywords: UI
: 48788 (view as bug list)
Depends on:
Blocks: 41537 48048
  Show dependency tree
 
Reported: 2004-08-30 23:17 UTC by Jesse Glick
Modified: 2004-10-04 15:14 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
proposed patch (10.59 KB, patch)
2004-09-20 12:15 UTC, Jiri Rechtacek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2004-08-30 23:17:30 UTC
See issue #48048 for background.
Comment 1 Jesse Glick 2004-09-09 18:44:51 UTC
*** Issue 48788 has been marked as a duplicate of this issue. ***
Comment 2 Jiri Rechtacek 2004-09-10 09:04:13 UTC
Jesse, don't you see a little dangerous to delete *.class from user's
directory? Should I find all *.class in project's src and delete them?
Shouldn't we add a check box to decide Yes/No to delete?
Comment 3 Jesse Glick 2004-09-10 16:47:34 UTC
"Jesse, don't you see a little dangerous to delete *.class from user's
directory?" - slightly, but I think *.class files are generally
treated as disposable.

"Should I find all *.class in project's src and delete them?" - right.
Ideally just those *.class which correspond to a known *.java, though
this is hard to do accurately in the case of top-level private
classes. (You would need to scan the actual bytecode to find the
source attribute.) So I would just recommend all ${src.dir}/**/*.class
and ${test.src.dir}/**/*.class.

"Shouldn't we add a check box to decide Yes/No to delete?" - only if
necessary. I guess only if there are some to delete, otherwise it
should be disabled or invisible?
Comment 4 Milan Kubec 2004-09-13 09:11:03 UTC
IMO user must be explicitly warned about deleting any classes from the
folder in any cases. Invisible deletion of anything doesn't seem right
to me at all.

There can be situation when user might unjar required jar file into
src folder where he keeps sources and classes (not using nb yet) and
those classes will be deleted. If user exactly follows new-nb-project
workflow classes look disposable but it's not the only workflow. I'm
sure users will have another cases where deleting their classes won't
be good idea.
Comment 5 Jesse Glick 2004-09-13 16:02:36 UTC
OK, but this is more important for D than for E, because of users with
existing 3.6 projects.
Comment 6 jrojcek 2004-09-14 09:17:27 UTC
Re. "There can be situation when user might unjar required jar file into
src folder where he keeps sources and classes (not using nb yet) and
those classes will be deleted."

How does the user perform the clean build then?

Anyway, we should probably warn the user that we delete the class files as it doesn't seem 
to be very safe. But I don't think the checkbox is the right approach. I think we should 
show a question alert (after clicking the Finish button) saying something like:

------
*The provided source folder contain class files (compiled java sources).*

The class files should be deleted because NetBeans keeps the class files in a separate 
output folder. Do you want to delete the class files?

[ Delete Class Files ] [ Keep Class Files ]
------

Or similar wording. If you agree with this solution, I will work with John on the right 
wording.
Comment 7 Milan Kubec 2004-09-14 09:32:32 UTC
Re "How does the user perform the clean build then?"
Classes can be in different packages and e.g. NB 3.6 allows user to do
clean rebuild of selected folder and its sub folders, so there can
easily live untouched classes with user sources/classes.
Comment 8 Jesse Glick 2004-09-14 18:23:30 UTC
Re. question alert (appearing only in case there are some *.class): I
like this.

Re. user keeping unpacked *.class in special folders that he/she
carefully avoids cleaning: we should probably throw a
StupidUserException in this case.
Comment 9 Milan Kubec 2004-09-15 09:16:18 UTC
"Re. user keeping unpacked *.class in special folders that he/she
carefully avoids cleaning: we should probably throw a
StupidUserException in this case."

I must disagree here. Not every single developer is senior experinced
developer using VCS, junit, EJBs ... and I don't know what else.
Remembering me when I saw Java first time, had no idea about jar files
and classpaths - so I simply unpacked required jars together with my
code and hapilly compile and run everything together. In that case I
didn't need/want any special project management systems that pretended
being more clever than me. -- This was just example how somebody could
think.

So if somebody has different setup than we can understand doesn't mean
it's a stupid user.
Comment 10 Jiri Rechtacek 2004-09-16 07:25:00 UTC
I'm going try implement it, before commit I'll consult with Jano.
Comment 11 Jiri Rechtacek 2004-09-20 12:15:15 UTC
Created attachment 17752 [details]
proposed patch
Comment 12 Jiri Rechtacek 2004-09-20 12:19:15 UTC
Jano. please consult the texts in Bundle with documentors. Thanks
Comment 13 Jesse Glick 2004-09-20 19:48:03 UTC
I guess in PanelSourceFolders,

//deleteClassFiles (folder);

should not be commented out.
Comment 14 jrojcek 2004-09-23 16:06:35 UTC
The URL field contains link to the spec.
Comment 15 Jiri Rechtacek 2004-10-04 15:14:13 UTC
implemented in
src/org/netbeans/modules/java/j2seproject/ui/wizards/Bundle.properties;
/cvs/java/j2seproject/src/org/netbeans/modules/java/j2seproject/ui/wizards/Bundle.properties,v
 <--  Bundle.properties
new revision: 1.36; previous revision: 1.35
done
Checking in
src/org/netbeans/modules/java/j2seproject/ui/wizards/PanelConfigureProject.java;
/cvs/java/j2seproject/src/org/netbeans/modules/java/j2seproject/ui/wizards/PanelConfigureProject.java,v
 <--  PanelConfigureProject.java
new revision: 1.9; previous revision: 1.8
done
Checking in
src/org/netbeans/modules/java/j2seproject/ui/wizards/PanelConfigureProjectVisual.java;
/cvs/java/j2seproject/src/org/netbeans/modules/java/j2seproject/ui/wizards/PanelConfigureProjectVisual.java,v
 <--  PanelConfigureProjectVisual.java
new revision: 1.14; previous revision: 1.13
done
Checking in
src/org/netbeans/modules/java/j2seproject/ui/wizards/PanelOptionsVisual.java;
/cvs/java/j2seproject/src/org/netbeans/modules/java/j2seproject/ui/wizards/PanelOptionsVisual.java,v
 <--  PanelOptionsVisual.java
new revision: 1.17; previous revision: 1.16
done
Checking in
src/org/netbeans/modules/java/j2seproject/ui/wizards/PanelProjectLocationVisual.java;
/cvs/java/j2seproject/src/org/netbeans/modules/java/j2seproject/ui/wizards/PanelProjectLocationVisual.java,v
 <--  PanelProjectLocationVisual.java
new revision: 1.26; previous revision: 1.25
done
Checking in
src/org/netbeans/modules/java/j2seproject/ui/wizards/PanelSourceFolders.java;
/cvs/java/j2seproject/src/org/netbeans/modules/java/j2seproject/ui/wizards/PanelSourceFolders.java,v
 <--  PanelSourceFolders.java
new revision: 1.29; previous revision: 1.28
done
Checking in
src/org/netbeans/modules/java/j2seproject/ui/wizards/SettingsPanel.java;
/cvs/java/j2seproject/src/org/netbeans/modules/java/j2seproject/ui/wizards/SettingsPanel.java,v
 <--  SettingsPanel.java
new revision: 1.2; previous revision: 1.1
done