#804 NPE while moving a class once a refactoring listener has been installed

The listener will do another move on another class through a MoveClassAndPackageProcessor.run(null);
If I do not call the processor I do not get the exception.
Could you help me see if I do something wrong or if there is a bug here?
Hopefully the stack trace is enough. I provide the plugin as well.

Jacques

3 comments
Comment actions Permalink

Jacques,

Jacques Morel wrote:

The listener will do another move on another class through a
MoveClassAndPackageProcessor.run(null);


The short answer is: do NOT do it.
Please do not use com.intellij.refactoring..*Processor. This is not
a part of OpenAPI, and in current form will never be.

Friendly,
Dmitry

--
Dmitry Lomov
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0
Comment actions Permalink

BTW I found my problem. I assumed wrongly that the elementMoved was in a WriteAction already. Now that I make sure I am in one, it works!

Sorry for the trouble.

Jacques

0
Comment actions Permalink

Jacques,
in fact, elementMoved and friends are invoked from inside WriteAction - even
from inside command. I guess there is some other problem in your code,
which you have hidden (not fixed) by adding a runWriteAction (with
an invokeLater probably, am I right?).

I strongly urge you not to use RenameProcessor and Move*Processor in
your plugins.

Sorry if this is a disappointment, but that is how it is for now.

Friendly,
Dmitry

Jacques Morel wrote:

BTW I found my problem. I assumed wrongly that the elementMoved was in a
WriteAction already. Now that I make sure I am in one, it works!

Sorry for the trouble.

Jacques


--
Dmitry Lomov
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0

Please sign in to leave a comment.