Good idea, but it sounds hard.  The block of code would have to be reduced into a 
more abstract notation to compare with other parts of the code. (not all that hard), 
but searching the other code sounds very time consuming.  Unless IDEA has pre-
parsed the rest of the code, I'm not sure this would be very efficient.

A simple text compare I don't think would do the trick.  The entire reason the same 
code exists in multiple places is because the user has entered it twice.  Probabaly 
with slightly different formatting / notation.  

Mike


On 26 Nov 2001 at 10:19, [EMAIL PROTECTED] wrote:

> Hi,
> 
> I have a request / suggestion (as if IDEA wasn't good enough already!):
> When doing 'extract method' it would be great if the IDE could tell me
> where that code block existed in the whole of my source tree, not just the
> current class.  Or if that's too complex, a search tool that could show me
> where all duplicate lines / code chunks were.  Quite often I find the same
> 'helper' methods in multiple classes, and it would be great if there was a
> tool to help me look, so the duplication can be factored out into the
> correct place.  As an example, we have a reasonable amount of legacy code
> that often returns nulls when it should probably return empty strings.  As
> a result, I have the following code in several places:
> 
> private String emptyIfNull (String input) {
>   if (input == null) return "";
> return input;
> }
> 
> It would be great if there was a 'Find Duplication in Source' tool that
> would find all instances of this and all other duplications.
> 
> Regards,
> 
> -Darren
> 
> 
> _______________________________________________
> Eap-list mailing list
> [EMAIL PROTECTED]
> http://www.intellij.com/mailman/listinfo/eap-list
> 

---
[EMAIL PROTECTED]
To obtain my PGP public key, mail "SEND PUB KEY" in the 
subject to "[EMAIL PROTECTED]"


_______________________________________________
Eap-list mailing list
[EMAIL PROTECTED]
http://www.intellij.com/mailman/listinfo/eap-list

Reply via email to