Change method return type without error

Hi, I want to change setter method to return this (for chaining like jQuery):

     method.getReturnTypeElement().replace(<new return type>);
     method.getBody().add(<return this;>);

but this code causes "Assertion failed: RETURN_KEYWORD" error, because this double-change must be performed together (not one-by-one).
Is there something for this? Like transacation: 1) do-changes-without-check 2) commit changes with check???

2 comments
Comment actions Permalink

Hello Karel,

Where exactly does the assertion come from? It should be perfectly OK to
perform such operations that have the code in inconsistent state, so the
problem is most likely somewhere else.

Hi, I want to change setter method to return this (for chaining like
jQuery):

method.getReturnTypeElement().replace(<new return type>);

method.getBody().add(<return this;>);

but this code causes "Assertion failed: RETURN_KEYWORD" error, because
this double-change must be performed together (not one-by-one).

Is there something for this? Like transacation: 1)
do-changes-without-check 2) commit changes with check???

---
Original message URL:
http://www.jetbrains.net/devnet/message/5228122#5228122

--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0
Comment actions Permalink

Unbelievable fast answer Dmitry! Thanks very much!
You are absolutely right - exception was raised before (when constructing return statement).

I am very sorry to disturb you with my stupid mistake.

Go ahead with perfect IDEA product...
Karel

0

Please sign in to leave a comment.