Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » copier.copyReferences() causes stack overflow
copier.copyReferences() causes stack overflow [message #71507] Wed, 14 February 2007 19:20 Go to next message
Mark Geib is currently offline Mark GeibFriend
Messages: 432
Registered: July 2009
Senior Member
I have the following code...trying to copy a resource.
I have no idea how to proceed at this point..??

Copier copier = new Copier();
RootObj newRoot = (RootObj) copier.copy(oldRoot);
copier.copyReferences();

The call to copyReferences() produces a stackoverflow with the following
repeated many many time...

java.lang.StackOverflowError
at org.eclipse.emf.ecore.impl.EObjectImpl.eClass(EObjectImpl.ja va:210)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:828)
at srd.impl.LinkImpl.eIsSet(LinkImpl.java:201)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:818)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:832)
at srd.impl.LinkImpl.eIsSet(LinkImpl.java:201)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:818)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:832)
at srd.impl.LinkImpl.eIsSet(LinkImpl.java:201)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:818)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:832)
at srd.impl.LinkImpl.eIsSet(LinkImpl.java:201)
Re: copier.copyReferences() causes stack overflow [message #71545 is a reply to message #71507] Wed, 14 February 2007 19:47 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

This is a multi-part message in MIME format.
--------------060107030400010303050208
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Mark,

It's bouncing back and forth between these

public boolean eIsSet(EStructuralFeature eFeature)
{
int featureID = eDerivedStructuralFeatureID(eFeature);
if (featureID >= 0)
{
return *eIsSet(featureID);*
}
else
{
return eOpenIsSet(eFeature);
}
}

public boolean eIsSet(int featureID)
{
EStructuralFeature eFeature =
eClass().getEStructuralFeature(featureID);
int dynamicFeatureID = featureID - eStaticFeatureCount();

return dynamicFeatureID < 0 ?
*eIsSet(eFeature)* /* backward compatibility with old
generated overrides */ :
eSettingDelegate(eFeature).dynamicIsSet(this, eSettings(),
dynamicFeatureID);
}

This suggests to me that you have a class that's generated with the new
ID-based pattern but has a base class that's generated with the old
feature-based pattern.


mark wrote:
> I have the following code...trying to copy a resource.
> I have no idea how to proceed at this point..??
>
> Copier copier = new Copier();
> RootObj newRoot = (RootObj) copier.copy(oldRoot);
> copier.copyReferences();
>
> The call to copyReferences() produces a stackoverflow with the following
> repeated many many time...
>
> java.lang.StackOverflowError
> at
> org.eclipse.emf.ecore.impl.EObjectImpl.eClass(EObjectImpl.ja va:210)
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:828)
>
> at srd.impl.LinkImpl.eIsSet(LinkImpl.java:201)
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:818)
>
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:832)
>
> at srd.impl.LinkImpl.eIsSet(LinkImpl.java:201)
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:818)
>
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:832)
>
> at srd.impl.LinkImpl.eIsSet(LinkImpl.java:201)
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:818)
>
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:832)
>
> at srd.impl.LinkImpl.eIsSet(LinkImpl.java:201)
>
>


--------------060107030400010303050208
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Mark,<br>
<br>
It's bouncing back and forth between these <br>
<blockquote><small>
Re: copier.copyReferences() causes stack overflow [message #71601 is a reply to message #71545] Wed, 14 February 2007 20:29 Go to previous messageGo to next message
Mark Geib is currently offline Mark GeibFriend
Messages: 432
Registered: July 2009
Senior Member
Ed,

Thanks for the quick reply.

I did make a minor model change recently. If I delete all the generated
code and re-generate will that fix this issue.??

Mark.
Re: copier.copyReferences() causes stack overflow [message #71620 is a reply to message #71601] Wed, 14 February 2007 20:32 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

This is a multi-part message in MIME format.
--------------000504040500020506060005
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Mark,

Is there a base class generated with the old pattern that was not being
regenerated? If the whole model *and *all its base classes are
consistently regenerated using the new pattern you definitely shouldn't
see this problem...


mark wrote:
> Ed,
>
> Thanks for the quick reply.
>
> I did make a minor model change recently. If I delete all the
> generated code and re-generate will that fix this issue.??
>
> Mark.
>


--------------000504040500020506060005
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Mark,<br>
<br>
Is there a base class generated with the old pattern that was not being
regenerated?
FIXED: copier.copyReferences() causes stack overflow [message #71655 is a reply to message #71620] Wed, 14 February 2007 20:58 Go to previous message
Mark Geib is currently offline Mark GeibFriend
Messages: 432
Registered: July 2009
Senior Member
Re-gen of all the model code fixed the problem.

Thanks,
Mark.
Re: copier.copyReferences() causes stack overflow [message #602537 is a reply to message #71507] Wed, 14 February 2007 19:47 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------060107030400010303050208
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Mark,

It's bouncing back and forth between these

public boolean eIsSet(EStructuralFeature eFeature)
{
int featureID = eDerivedStructuralFeatureID(eFeature);
if (featureID >= 0)
{
return *eIsSet(featureID);*
}
else
{
return eOpenIsSet(eFeature);
}
}

public boolean eIsSet(int featureID)
{
EStructuralFeature eFeature =
eClass().getEStructuralFeature(featureID);
int dynamicFeatureID = featureID - eStaticFeatureCount();

return dynamicFeatureID < 0 ?
*eIsSet(eFeature)* /* backward compatibility with old
generated overrides */ :
eSettingDelegate(eFeature).dynamicIsSet(this, eSettings(),
dynamicFeatureID);
}

This suggests to me that you have a class that's generated with the new
ID-based pattern but has a base class that's generated with the old
feature-based pattern.


mark wrote:
> I have the following code...trying to copy a resource.
> I have no idea how to proceed at this point..??
>
> Copier copier = new Copier();
> RootObj newRoot = (RootObj) copier.copy(oldRoot);
> copier.copyReferences();
>
> The call to copyReferences() produces a stackoverflow with the following
> repeated many many time...
>
> java.lang.StackOverflowError
> at
> org.eclipse.emf.ecore.impl.EObjectImpl.eClass(EObjectImpl.ja va:210)
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:828)
>
> at srd.impl.LinkImpl.eIsSet(LinkImpl.java:201)
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:818)
>
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:832)
>
> at srd.impl.LinkImpl.eIsSet(LinkImpl.java:201)
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:818)
>
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:832)
>
> at srd.impl.LinkImpl.eIsSet(LinkImpl.java:201)
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:818)
>
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:832)
>
> at srd.impl.LinkImpl.eIsSet(LinkImpl.java:201)
>
>


--------------060107030400010303050208
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Mark,<br>
<br>
It's bouncing back and forth between these <br>
<blockquote><small>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: copier.copyReferences() causes stack overflow [message #602557 is a reply to message #71545] Wed, 14 February 2007 20:29 Go to previous message
Mark Geib is currently offline Mark GeibFriend
Messages: 432
Registered: July 2009
Senior Member
Ed,

Thanks for the quick reply.

I did make a minor model change recently. If I delete all the generated
code and re-generate will that fix this issue.??

Mark.
Re: copier.copyReferences() causes stack overflow [message #602564 is a reply to message #71601] Wed, 14 February 2007 20:32 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------000504040500020506060005
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Mark,

Is there a base class generated with the old pattern that was not being
regenerated? If the whole model *and *all its base classes are
consistently regenerated using the new pattern you definitely shouldn't
see this problem...


mark wrote:
> Ed,
>
> Thanks for the quick reply.
>
> I did make a minor model change recently. If I delete all the
> generated code and re-generate will that fix this issue.??
>
> Mark.
>


--------------000504040500020506060005
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Mark,<br>
<br>
Is there a base class generated with the old pattern that was not being
regenerated?


Ed Merks
Professional Support: https://www.macromodeling.com/
FIXED: copier.copyReferences() causes stack overflow [message #602575 is a reply to message #71620] Wed, 14 February 2007 20:58 Go to previous message
Mark Geib is currently offline Mark GeibFriend
Messages: 432
Registered: July 2009
Senior Member
Re-gen of all the model code fixed the problem.

Thanks,
Mark.
Previous Topic:How to let jet/emf codegen generate incorrect java files?
Next Topic:Teneo and java.util.Calendar
Goto Forum:
  


Current Time: Fri Mar 29 15:32:20 GMT 2024

Powered by FUDForum. Page generated in 0.03097 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top