Structural Search&Replace

Hi,

I've been trying to replace some code fragments like

if (foo instanceof Foo) {
((Foo)foo).$method$(this);
} else {
super.doSomething(this);
}

with

foo.$method$(this);

However, this does not replace the whole code fragment, just the line
"((Foo)foo).myMethod(this);"

with "foo.myMethod(this);".

Should I file a bug or is there something wrong with the query?

BTW: This exception http://www.intellij.net/tracker/idea/viewSCR?publicId=44897
keeps popping up after the failed replace-attempt. Maybe this is the reason
why it doesn't work?

Thanks,
Sascha

2 comments
Comment actions Permalink

Hi,

Query seems correct so, please, submit the issue to JIRA. It would be
very very nice if you also provide some java code you want to modify and
parameter constraints.

Sascha Weinreuter wrote:

Hi,

I've been trying to replace some code fragments like

if (foo instanceof Foo) {
((Foo)foo).$method$(this);
} else {
super.doSomething(this);
}

with

foo.$method$(this);

However, this does not replace the whole code fragment, just the line
"((Foo)foo).myMethod(this);"

with "foo.myMethod(this);".

Should I file a bug or is there something wrong with the query?

BTW: This exception
http://www.intellij.net/tracker/idea/viewSCR?publicId=44897
keeps popping up after the failed replace-attempt. Maybe this is the reason
why it doesn't work?

Thanks,
Sascha



--
Best regards,
Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0
Comment actions Permalink

Hmm, that's odd. I cannot reproduce this on my home-PC, but with the same
code. There's no exception either. I'll let you know if I manage to find
the reason. :)

Sascha

0

Please sign in to leave a comment.