Structural Search - find/replace method calls of an interface

Hi

I'd like to find all occurences of java.util.List.remove(Object o) and replace them with java.util.List.remove(0) (just a dummy example).

For example:

list.remove("x") -> list.remove(0)
getList().remove("x) -> getList().remove(0)
arrayList.remove("x") -> arrayList.remove(0)
Object o = list.remove("x"); -> Object o = list.remove(0);

How can I achieve this? I'm pretty sure Maxim would know the answer ;)

Thanks for your help!

--Etienne

2 comments
Comment actions Permalink

$list$.remove("0") -> $list".remove(0)
expr type for list is List, check constraint within type hierarchy
should be checked

etienne wrote:

Hi

I'd like to find all occurences of java.util.List.remove(Object o) and replace them with java.util.List.remove(0) (just a dummy example).

For example:

list.remove("x") -> list.remove(0)
getList().remove("x) -> getList().remove(0)
arrayList.remove("x") -> arrayList.remove(0)
Object o = list.remove("x"); -> Object o = list.remove(0);

How can I achieve this? I'm pretty sure Maxim would know the answer ;)

Thanks for your help!

--Etienne



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

0
Comment actions Permalink

Great. That was easy and I should have found it out myself...

Thanks a lot!

--Etienne

0

Please sign in to leave a comment.