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 44713 - umbrella: all remarks/problems I discovered concerning Refactoring
Summary: umbrella: all remarks/problems I discovered concerning Refactoring
Alias: None
Product: editor
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 4.x
Hardware: PC Other
: P2 blocker (vote)
Assignee: issues@java
Keywords: UMBRELLA
Depends on: 41252 42245 44714 44716 44718 44720 44721 44722 44723 45346 45694 45695 45698 45699 45700
  Show dependency tree
Reported: 2004-06-10 20:55 UTC by vbrabant
Modified: 2007-04-03 18:02 UTC (History)
1 user (show)

See Also:
Issue Type: TASK
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description vbrabant 2004-06-10 20:55:56 UTC
Please find in attach a step by step description
of how I used refactoring and all problems I

I will create one issue per problems and this
issue will depend on other.

So that issue will be used as umbrella.
Comment 1 vbrabant 2004-06-10 21:03:41 UTC
I runned the 20040608 trunk release to test refactoring and MDR.

I created a totally new JS2E Application Project.
I called it Tiger, because it will be a Tiger Application.
But when I clicked on finish, it begins to Scan the Structure of the
Finally, after 5 minutes, I had possibility to edit the Main Class.
The problem is that I wanted a JDK1.5 project, and not the default one
(JDK 1.4.2).
So, I right-click on the Tiger Project and select Properties.
I added a new Java Platform (JDK 1.5) and select it.

I was really surprised that nothing occurs.
At least it would rescan the project, to update the MDR with JDK1.5

So, now my project is using JDK 1.5, but MDR has been builded with JDK
1.4 data. Really Strange as situation.

I add a System.out.println("Hello World"); into the main method.
And click on F6 to execute it.

I can see the following:
Created dir: D:\Test_20040608_NB40\j2seTigerApplication\build\classes
Compiling 1 source file to
Hello World

BUILD SUCCESSFUL (total time: 11 seconds)

Remark: It would be nice is what is printed on the console from the
program appears in a different colours than what is printed by Ant.

Now, I looked at the Refactoring menu, and noted that I can Move the
So, I decided to move the class to the default package:
But I do it by using drag and drop via the mouse.
I am positively surpised that Refactoring dialog box appeared.
Everythings happened correctly.

But when I click on F6, nb asked me to select a main class.

Remark: it seems that Refactoring module forget to update project

I selected the class Main.
Nb recompiled the source and execute it.

Remark the java source file continue to be marked as uncompiled. Even
after a Build Main Project and Clean and Build Main Project. Strange

Remark: the package tiger continue to be present, but is now empty.

Now, I decided to do inverse operation, but via the refactoring menu,
and not drag and drop.
And I received the following message:
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
	at java.lang.String.substring(

So, I decided to continue with the drag and drop procedure, and it
worked like a charm.

Really stange as situation, because, now, I was able to Move Class via
the Refactoring menu.
I choosed to move it to a new package, called tiger.newpackage.
But it refused, because it's impossible to create a new package via
that way. What a lost of time for the user.

So, I created the new package, and moved the class.

Remark the package tiger has been dropped now. It's not more present
in the Project view.

I decided to move anew that class into the defaut directory, via the
refactoring menu.

I obtained a Dialog box, with a Please Wait message, and nothing else.
I decided to accept the invitation and waited.
But finally, I stopped to wait and close the window.
I tryed to run the project, by pressing F6, but I received the
following message:
java.lang.AssertionError: Class not found in index: tiger.newpackage.Main

At this moment I closed Nb and decided to restart it, by hoping that
all will be ok.
After restarting, the first thing nb did is rescanning the project;
Waiting for long 5 minutes.
Now, I can press F6, select the tiger.newpackage.Main class and it runs.

Now, I will start with other refactoring stuffs.

I  wanted to rename the class Main to MainClass via the main menu..
Everything was ok.

Now, i do the inverse operation, but by clicking on the node.

But at that moment, I received the following message:
Cannot rename, class Main already exists in package tiger.newpackage.
And I clicked on Cancel.

But the node is named Main, the tab is named Main, but the content of
the java source file is the following

public class MainClass {
    /** Creates a new instance of Main */
    public MainClass() {

And problems begins:
Impossible to undo the rename operation.
Impossible to rename into Main. It says that it already exists.
I modified manually the code.
I select Run, Run Other Run Main and it worked.
I press F6. It says that no main class has been setted for the project
and it propose as classes, only MainClass.
Note that no node named Main appears in the Source Packages.
I select MainClass, click on OK.
And the same window appears.I can loop until I click on Cancel.

I decided to move the class to another package (Refactoring, Move Class)
A dialog box appears with the following:
	Move class Main
		To Package
I select another package and click on finish.

The following appears
Move Class Main to j2setigerapplication package
    Move source to package j2setigerapplication 
After that operation, everything was ok.
So, I redo the sames operations but with other manner:
1. Refactoring, Move Class
2. select a empty target package
3. click on finish.
4. confirm refactoring.

after a lot of treatment, source disappeared completely from the disk.

So I recreated the MainClass in the default package.
I press F9 and NB hangs. Finally, I received a NPE.
The only solution was to restart NB (and wait 5 minutes that it
finishs to rescan the structure of the project).

Now, I was able to run my project (after reselecting the main class).

So, I decided to retry the rename of the class:

But it failed with error: 

Annotation: Exception occurred in Request Processor
	at java.lang.String.startsWith(
	at java.lang.String.startsWith(
	at org.netbeans.jmi.javamodel.JavaClass$Impl.setName(Unknown Source)

That's my first experience with refactoring.
Comment 2 psuk 2004-06-11 11:50:00 UTC
Increasing to P1 as it resulted in data loss (Issue 44722 )
Comment 3 Jan Becicka 2004-06-14 18:52:26 UTC
Changing priority to P2 since max priority of dependent (opened)
issues is P2.
Comment 4 Jan Becicka 2004-06-21 09:43:51 UTC
Max. priority of opened dependent issues is P3.
Comment 5 Martin Matula 2004-06-25 16:00:14 UTC
All issues associated with this umbrella issue were fixed.
Comment 6 vbrabant 2004-06-28 19:13:48 UTC
I reopened it, because that issue was depending of other that are
noted as resolved duplicate.

Concerned issues are 44716 & 44723.

I will add 41252 & 42245.

Comment 7 vbrabant 2004-06-28 19:18:14 UTC
Set as P2 because 41252 is marked as P2
Comment 8 Jesse Glick 2004-06-28 20:24:48 UTC
#41252 is not related to refactoring in the least and it is just
confusing to have it listed here, IMHO. Anyway umbrellas are not
generally marked DEFECT since there is nothing in the umbrella issue
itself to fix; just confuses the bug count unnecessarily.
Comment 9 Martin Matula 2004-06-28 21:47:03 UTC
Changing this issue to task to not confuse the bugcounts.
Comment 10 vbrabant 2004-06-29 21:59:42 UTC
I decided to redo all steps I did, but now with build 20040628.
And my impression is that it's stabler than before: less assertion
error, never lost source. But somes problems I noted in the past are
not yet resolved. But I forgot to create specific issues for those
specific problems. So, now, it's done. I created issues 45694, 45695,
45698, 45699 and 45700. I hope descriptions of problems will help you
to solve them.

Comment 11 Tomas Hurka 2005-05-16 13:05:40 UTC
All refactoring issues associated with this umbrella issue were fixed.