|
Re: Strange-looking code in EMF [message #422945 is a reply to message #422938] |
Fri, 19 September 2008 13:22 |
Eclipse User |
|
|
|
Originally posted by: cdamus.zeligsoft.com
Hi, Stefan,
This works because EClassifiers intern() their instance-class names, and
Java ensures that string constants are interned, so this is actually
more efficient than .equals() and it's correct.
Cheers,
Christian
-----8<-----
protected void basicSetInstanceClassName(String value)
{
if (instanceClassName == null && generatedInstanceClassName != null)
{
instanceClassName = generatedInstanceClassName;
generatedInstanceClassName = null;
}
setInstanceClassNameGen(value == null ? null : value.intern());
if (instanceClass != null)
{
setInstanceClassGen(null);
}
}
----->8-----
Stefan Winkler wrote:
> Hi,
>
> just by chance I came over this code:
>
> if (eType.getInstanceClassName() == "java.util.Map$Entry")
> [EStoreEObjectImpl:694]
>
> I haven't worked with maps in EMF, but this looks strongly suspicious?
>
> shouldn't == be .equals() ?!
>
> Cheers,
> Stefan
|
|
|
Powered by
FUDForum. Page generated in 0.01749 seconds