Problem with Create method function

Hi,

I am trying to switch from Eclipse to IDEA and have problem with "Create method" function. From time, to time after using this feature a new method is created in incorrect place, e.g. inside another method or outside the class body. Usually it works correctly when the IDEA is started. When I am working with it some time, the problem is more and more frequent. Below is example of the result - a new method (2) is put inside the other (1).


2015-10-10_14-13-51.jpg
I have been looking for solution in the internet but couldn't find any. Can someone give me some tip how to solve it?

7 comments
Comment actions Permalink

Could you please prepare and provide a small sample project illustrating the problem and
the exact steps to reproduce (complete zipped source tree and project files)?

Does it happen with IDEA 15 EAP: https://confluence.jetbrains.com/display/IDEADEV/IDEA+15+EAP ?

0
Comment actions Permalink

Sure, I will try. Maybe it will be a bit difficult, since this problem is not repeatable. I have tried to show it to my co-workers and it hasn't happened :).

Usually the case is like following:
- there are classes A and B
- class B has reference to class A
- class B is edited and a new A's method is call. This method doesn't exist, so the Alt+Enter is pressed and then Create method is selected. Cursor is moved to class A and sometimes everything is correct, but in many cases this new method is created in incorrect place.

I was trying with new project and something similar appeared:
- new line (23) in classB was added: System.out.println()
- another new line was added to create ClassC before it (still in 23 line)
- test2 = new ClassC() was put and Create local variable... was selected -> As a result this line was moved to line 25, after }.

I thought that after it the problem with Create method will apear but not this time :)

Zip with this project and state describe above is added.



Attachment(s):
ideproblem.zip
0
Comment actions Permalink

Hi,

I am comming back to this problem since it is also in 15.x - much less often, but it happens. Attached files demonstrate this case. IDEA version 15.0.2.
As a result a new method was created inside the last, existing method in the target class.

As I observe it happens less often if I activate this action after hitting Ctrl+S.



Attachment(s):
newMethodProblem.jpg
codeWhenActionRun.jpg
0
Comment actions Permalink

Please attach idea.log (Help|Show log). Thanks

0
Comment actions Permalink

Log from the day when the described problem was happened in the attachment.



Attachment(s):
log-06.01.zip
0
Comment actions Permalink

Could you please reproduce the problem and attach all idea.log files? The attached log is empty and I can't reproduce the issue from the description. Sorry for the inconvenuence.

0
Comment actions Permalink

Problem is still occuring but I'm afraid that log is as this previous one - consider this issue just empty, no special messagges.

 

 

0

Please sign in to leave a comment.