You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomee.apache.org by Svetlin Zarev <sv...@gmail.com> on 2016/09/16 07:27:26 UTC

String equality checks in JAXB classes

Hi,

The static code analysis revealed that in all JAXB classes strings are
being compared using == and !=. Obviously TomEE works, so this is not such
a big issue, but I cannot explain to myself why it works :) I know that the
string literals are interned by default, but how do you guarantee that the
various XML parsers will return the interned instances and not different
instances ? Is the performance boost that big to make that hack worth it ?
Are you interested in converting all !=/== to using equals() ?

Kind regards,
Svetlin

Re: String equality checks in JAXB classes

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Le 16 sept. 2016 09:27, "Svetlin Zarev" <sv...@gmail.com> a
écrit :
>
> Hi,
>
> The static code analysis revealed that in all JAXB classes strings are
> being compared using == and !=. Obviously TomEE works, so this is not such
> a big issue, but I cannot explain to myself why it works :) I know that
the
> string literals are interned by default, but how do you guarantee that the
> various XML parsers will return the interned instances and not different
> instances ?

We heavily test it in our build for the provided parsers

>  Is the performance boost that big to make that hack worth it ?

No

> Are you interested in converting all !=/== to using equals() ?
>

Dont think so

> Kind regards,
> Svetlin