struct search: what's wrong

I would love to use this feature - if it would work ;)

What's my mistake here:
I have a few statements like this:
Rectangle2D rec = new Rectangle2D.Double(
drec.getX(),
drec.getY(),
drec.getWidth(),
drec.getWidth());

and I need each params to be changed like this:
drec.getX() -> OtherClass.round(drec.get(x),5)

so I call struct replace, copy existing template "method call" and write:
$Instance$.$MethodCall$()
->
OtherClass.round($Instance$.$MethodCall$(),5)

is it correct?
I do search in selection, IDEA reports everything,
and if I choose "replace everything", IDEA cleanly
refactors all my params away ...

2 comments

Hi,

Your approach is correct and the behavior is a bug, I will fix it ASAP.

Michael Damberger wrote:

I would love to use this feature - if it would work ;)

What's my mistake here:
I have a few statements like this:
Rectangle2D rec = new Rectangle2D.Double(
drec.getX(),
drec.getY(),
drec.getWidth(),
drec.getWidth());

and I need each params to be changed like this:
drec.getX() -> OtherClass.round(drec.get(x),5)

so I call struct replace, copy existing template "method call" and write:
$Instance$.$MethodCall$()
->
OtherClass.round($Instance$.$MethodCall$(),5)

is it correct?
I do search in selection, IDEA reports everything,
and if I choose "replace everything", IDEA cleanly
refactors all my params away ...



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

0

Hi,

What IDEA version you are using?
Once I was able to reproduce the issue but ten next times I was not :(

Maxim Mossienko wrote:

Hi,

Your approach is correct and the behavior is a bug, I will fix it ASAP.

Michael Damberger wrote:

>> I would love to use this feature - if it would work ;)
>>
>> What's my mistake here: I have a few statements like this:
>> Rectangle2D rec = new Rectangle2D.Double(
>> drec.getX(),
>> drec.getY(),
>> drec.getWidth(), drec.getWidth());
>>
>> and I need each params to be changed like this:
>> drec.getX() -> OtherClass.round(drec.get(x),5)
>>
>> so I call struct replace, copy existing template "method call" and write:
>> $Instance$.$MethodCall$()
>> ->
>> OtherClass.round($Instance$.$MethodCall$(),5)
>>
>> is it correct?
>> I do search in selection, IDEA reports everything,
>> and if I choose "replace everything", IDEA cleanly
>> refactors all my params away ...




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

0

Please sign in to leave a comment.