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 106452 - ISE in Move Class refactoring
Summary: ISE in Move Class refactoring
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 6.x
Hardware: Macintosh All
: P2 blocker (vote)
Assignee: issues@java
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-06-13 05:08 UTC by _ tboudreau
Modified: 2007-08-14 12:36 UTC (History)
1 user (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 _ tboudreau 2007-06-13 05:08:03 UTC
I added a package to openide/text, org.netbeans.modules.openide.text, and I moved the indentation engine beaninfo and editor from core to this package.

Then I created a bridge module openide/text/indentation-bridge.  I moved the indentation engine beaninfo and editor from core to this module.

Then I realized I didn't need the bridge module if I killed IndentEngineEditor (well, removed its custom editor and inheritance from ServiceTypeEditor).

So I recreated o.n.m.o.text and moved the sources back there.

The following exception was thrown:

java.lang.IllegalStateException: Cannot call getTreeMaker before toPhase.
	at org.netbeans.api.java.source.WorkingCopy.getTreeMaker(WorkingCopy.java:124)
	at org.netbeans.modules.refactoring.java.spi.RefactoringVisitor.setWorkingCopy(RefactoringVisitor.java:50)
	at org.netbeans.modules.refactoring.java.plugins.MoveTransformer.setWorkingCopy(MoveTransformer.java:52)
	at org.netbeans.modules.refactoring.java.spi.JavaRefactoringPlugin$TransformTask.run(JavaRefactoringPlugin.java:253)
	at org.netbeans.modules.refactoring.java.spi.JavaRefactoringPlugin$TransformTask.run(JavaRefactoringPlugin.java:240)
	at org.netbeans.api.java.source.JavaSource.runModificationTask(JavaSource.java:795)
	at org.netbeans.modules.refactoring.java.spi.JavaRefactoringPlugin.processFiles(JavaRefactoringPlugin.java:217)
	at org.netbeans.modules.refactoring.java.spi.JavaRefactoringPlugin.createAndAddElements(JavaRefactoringPlugin.java:229)
	at org.netbeans.modules.refactoring.java.plugins.MoveRefactoringPlugin.prepare(MoveRefactoringPlugin.java:224)
	at org.netbeans.modules.refactoring.api.AbstractRefactoring.pluginsPrepare(AbstractRefactoring.java:316)
	at org.netbeans.modules.refactoring.api.AbstractRefactoring.prepare(AbstractRefactoring.java:173)
	at org.netbeans.modules.refactoring.spi.impl.ParametersPanel$Prepare.run(ParametersPanel.java:708)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:539)
[catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:964)
Comment 1 _ tboudreau 2007-06-13 18:31:13 UTC
Raising to p2 - this appears to happen with any use of Move Class on multiple classes when moving between modules.  Afterwards, memory usage remains 
high and the UI has very poor responsiveness until a restart.
Comment 2 Jan Becicka 2007-06-14 14:57:31 UTC
Cannot reproduce.
Moreover it cannot happen:
    public void setWorkingCopy(WorkingCopy workingCopy) {
        this.workingCopy = workingCopy;
        try {
            this.workingCopy.toPhase(JavaSource.Phase.RESOLVED);
        } catch (IOException ioe) {
            ErrorManager.getDefault().notify(ioe);
        }
        this.make = workingCopy.getTreeMaker();
   }

Anyone able to reproduce it?
Comment 3 _ tboudreau 2007-06-14 15:32:57 UTC
Is it possible to have some kind of race condition here?  Or for getTreeMaker() to return the wrong one?

What I am left with after this exception is that the files are copied, but their package statements are wrong.  So I think when the files are being parsed, they 
have been moved to a new package on disk, but the package statements are wrong.  I've noticed some weird behavior with the java editor when the package 
statement is incorrect on a java source - perhaps this is a clue of how it can happen?

Exact steps to reproduce:
Open core.
Create a new module project, core/property-editors
Select all the property editors which are *not* NB-specific in org.netbeans.beaninfo.editors (i.e. editors for jdk classes - rectangle, point, dimension, etc.)
Move them to the new package.
Comment 4 Jan Becicka 2007-06-18 13:04:37 UTC
Jirko, can you reproduce it?
Comment 5 Jiri Prox 2007-06-18 17:09:04 UTC
I can remember, I've seen it once, while developing tests, but I cannot reproduce it in current build
Comment 6 Jan Lahoda 2007-06-19 10:27:33 UTC
BTW: Honzo, you should be checking the return value of the toPhase method - it may happen that there is not enough
memory to parser/attribute the file - the toPhase method will then return the phase that was reached. If the phase you
need was not reached, you should finish the Task immediately - it should be called again for the same file.
Comment 7 Jan Becicka 2007-06-20 10:32:47 UTC
Checking in spi/RefactoringVisitor.java;
/cvs/refactoring/java/src/org/netbeans/modules/refactoring/java/spi/RefactoringVisitor.java,v  <--  RefactoringVisitor.java
new revision: 1.3; previous revision: 1.2
done
RCS file: /cvs/refactoring/java/src/org/netbeans/modules/refactoring/java/spi/ToPhaseException.java,v
done
Checking in spi/ToPhaseException.java;
/cvs/refactoring/java/src/org/netbeans/modules/refactoring/java/spi/ToPhaseException.java,v  <--  ToPhaseException.java
initial revision: 1.1
done
Checking in spi/JavaRefactoringPlugin.java;
/cvs/refactoring/java/src/org/netbeans/modules/refactoring/java/spi/JavaRefactoringPlugin.java,v  <-- 
JavaRefactoringPlugin.java
new revision: 1.7; previous revision: 1.6
done
Checking in plugins/CopyTransformer.java;
/cvs/refactoring/java/src/org/netbeans/modules/refactoring/java/plugins/CopyTransformer.java,v  <--  CopyTransformer.java
new revision: 1.6; previous revision: 1.5
done
Checking in plugins/FindVisitor.java;
/cvs/refactoring/java/src/org/netbeans/modules/refactoring/java/plugins/FindVisitor.java,v  <--  FindVisitor.java
new revision: 1.2; previous revision: 1.1
done
Checking in plugins/JavaWhereUsedQueryPlugin.java;
/cvs/refactoring/java/src/org/netbeans/modules/refactoring/java/plugins/JavaWhereUsedQueryPlugin.java,v  <-- 
JavaWhereUsedQueryPlugin.java
new revision: 1.20; previous revision: 1.19
done
Checking in plugins/InnerToOuterTransformer.java;
/cvs/refactoring/java/src/org/netbeans/modules/refactoring/java/plugins/InnerToOuterTransformer.java,v  <-- 
InnerToOuterTransformer.java
new revision: 1.6; previous revision: 1.5
done
Checking in plugins/VarUsagesVisitor.java;
/cvs/refactoring/java/src/org/netbeans/modules/refactoring/java/plugins/VarUsagesVisitor.java,v  <--  VarUsagesVisitor.java
new revision: 1.5; previous revision: 1.4
done
Checking in plugins/PullUpTransformer.java;
/cvs/refactoring/java/src/org/netbeans/modules/refactoring/java/plugins/PullUpTransformer.java,v  <-- 
PullUpTransformer.java
new revision: 1.10; previous revision: 1.9
done
Checking in plugins/MoveTransformer.java;
/cvs/refactoring/java/src/org/netbeans/modules/refactoring/java/plugins/MoveTransformer.java,v  <--  MoveTransformer.java
new revision: 1.11; previous revision: 1.10
done
Checking in plugins/UseSuperTypeRefactoringPlugin.java;
/cvs/refactoring/java/src/org/netbeans/modules/refactoring/java/plugins/UseSuperTypeRefactoringPlugin.java,v  <-- 
UseSuperTypeRefactoringPlugin.java
new revision: 1.9; previous revision: 1.8
done