I agree. Even the simple snippet below:
> private String emptyIfNull (String input) {
> if (input == null) return "";
> return input;
> }
could just as easily be:
private String emptyIfNull (String input) {
return (input != null) ? input : "";
}
or again with the != as an == and the ?: values swapped.
It wouldn't be practical to find all the code fragments that "sort of" do
the same thing. Although I'd be the first to use it if there were!
Cheers,
Dan.
> -----Original Message-----
> From: Michael Kirby [mailto:[EMAIL PROTECTED]]
> Sent: 26 November 2001 12:26
> To: [EMAIL PROTECTED]
> Subject: Re: [Eap-list] Feature request
>
>
> 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
>
***************************************************************************************
This email and any files transmitted with it are confidential and intended
solely for the use of the individual or entity to whom they are addressed.
If you have received this email in error please notify [EMAIL PROTECTED]
immediately.
This footnote also confirms that this email message has been swept for the
presence of computer viruses.
***************************************************************************************
_______________________________________________
Eap-list mailing list
[EMAIL PROTECTED]
http://www.intellij.com/mailman/listinfo/eap-list