admin@glassfish.java.net

Re: CODE REVIEW: FindBugs: admin-ee/jes-mf

From: Bill Shannon <bill.shannon_at_sun.com>
Date: Fri, 04 May 2007 10:52:45 -0700

Lloyd L Chambers wrote:
> Bill,
>
> Please include the *file name*, and preferably the diffs when commenting
> on a change.

Sorry, most of your messages included the filename in the Subject so I
got lazy as the night got later...

> I think you are referring to ObjectNames.java. I used intern() to avoid
> changing every line, though in the 2nd case, I apparently changed my
> mind and used equals(), forgetting to remove the call to intern().
>
> If you prefer, I can change all uses to equals().

Well, first you need to resolve the issue about whether these files are
ever regenerated.

But, I would probably use intern for consistency with the other similar
code unless they're all going to be changed.

> Is there something *wrong* with using intern()? (other than the mild
> surprise the comparisons produce)?

That's a good question for a performance expert. I've always assumed there
was a cost to doing the intern that was only worth it if you were doing a
lot of comparisons in a performance critical piece of code. But I don't
really know.