Extract method - find duplicates behaviour

Hi there,

When extracting a method, IDEA attempts to find similar pieces of code that
can be replaced with an invocation to the new method. This is great. However,
if there are similar pieces of code that have different comments IDEA fails
to recognize them as being the same stuff. Is this by design? If so, can
we have an option to ignore the comments when looking for duplicate code
blocks?

I'll create a jira request if you find it worthwhile (and if there isn't
one there already).

Thx,
Andrei


7 comments

I have been just investigating this, and need your opinion if fragments differing by comments only should be considered equivalent.

0

Eugene Vigdorchik wrote:

I have been just investigating this, and need your opinion if fragments differing by comments only should be considered equivalent.

IMHO they should, because Idea asks anyway if it should extract each fragment.
Still, if it could alert me in an (unobstrusive way) to the fact that it differs in comments, all the better ;)

0

Wow, that was quick.

Thx,
Andrei


EV> Fixed.


0

Welcome to the heaven that is the EAP phase :)

0

Please sign in to leave a comment.