Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » error "Could not serialize EObject via backtracking"
error "Could not serialize EObject via backtracking" [message #754950] Sat, 05 November 2011 19:00 Go to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
Hi

after updating to Xtext 2.1, I find that my unit tests all fail when
they parse my model with such an error:

java.lang.RuntimeException: Could not serialize EObject via backtracking.
Constraint: null name=ID? ePackage=[EPackage|STRING] genModel=STRING?
judgmentDescriptions+=JudgmentDescription* rules+=Rule* null
Values: ePackage(1), ePackageURI(1)
Semantic Object: TypeSystemDefinition''
Context: TypeSystemDefinition

I noted that in AbstractXtextTests, after loading the resource there is
this code

if (expectedErrors == 0 && resource.getContents().size() > 0 &&
shouldTestSerializer(resource)) {
SerializerTester tester = get(SerializerTester.class);
EObject obj = resource.getContents().get(0);
tester.assertSerializeWithNodeModel(obj);
tester.assertSerializeWithoutNodeModel(obj);
}

and this line fails:

tester.assertSerializeWithNodeModel(obj);

of course I could disable this (by redefining shouldTestSerializer, but
I'd like to understand why I get this error and how could I fix it

by the way, ePackageURI attribute above is not part of the grammar (it
is added in the ecore by postprocessing); can this be the source of the
problem?

thanks in advance
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


Re: error "Could not serialize EObject via backtracking" [message #755013 is a reply to message #754950] Sun, 06 November 2011 20:53 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Lorenzo,

yes that is the reason for the failing test. Please implement a
transient value service or mark the attribute as transient in your ecore
model.

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com


On 05.11.11 20:00, Lorenzo Bettini wrote:
> Hi
>
> after updating to Xtext 2.1, I find that my unit tests all fail when
> they parse my model with such an error:
>
> java.lang.RuntimeException: Could not serialize EObject via backtracking.
> Constraint: null name=ID? ePackage=[EPackage|STRING] genModel=STRING?
> judgmentDescriptions+=JudgmentDescription* rules+=Rule* null
> Values: ePackage(1), ePackageURI(1)
> Semantic Object: TypeSystemDefinition''
> Context: TypeSystemDefinition
>
> I noted that in AbstractXtextTests, after loading the resource there is
> this code
>
> if (expectedErrors == 0 && resource.getContents().size() > 0 &&
> shouldTestSerializer(resource)) {
> SerializerTester tester = get(SerializerTester.class);
> EObject obj = resource.getContents().get(0);
> tester.assertSerializeWithNodeModel(obj);
> tester.assertSerializeWithoutNodeModel(obj);
> }
>
> and this line fails:
>
> tester.assertSerializeWithNodeModel(obj);
>
> of course I could disable this (by redefining shouldTestSerializer, but
> I'd like to understand why I get this error and how could I fix it
>
> by the way, ePackageURI attribute above is not part of the grammar (it
> is added in the ecore by postprocessing); can this be the source of the
> problem?
>
> thanks in advance
> Lorenzo
>
Re: error "Could not serialize EObject via backtracking" [message #755434 is a reply to message #755013] Tue, 08 November 2011 13:54 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 11/06/2011 09:53 PM, Sebastian Zarnekow wrote:
> Hi Lorenzo,
>
> yes that is the reason for the failing test. Please implement a
> transient value service or mark the attribute as transient in your ecore
> model.

Hi Sebastian

I did that, and that solves one problem (the one with ePackageURI);
however, I still have another problem now:

java.lang.RuntimeException: No EObjectDescription could be found in
Scope TypeSystemDefinition.ePackage for EPackage'fj'
Semantic Object: TypeSystemDefinition''

I think that is due to

ePackage=[ecore::EPackage|STRING]

in my DSL I specify the epackage reference through a URI; during the
serialization though the ePackage gives problems since when it tries to
serialize the ePackage it gets its 'name'... at least, this is what I
figured...

these problem take place only during unit testing (plain junit tests)...
again I can turn off serialization tests...

cheers
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


Re: error "Could not serialize EObject via backtracking" [message #755503 is a reply to message #755434] Tue, 08 November 2011 16:36 Go to previous message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Lorenzo,

the resource descriptions for EPackages contain user data about the type
of the name. Your scope should only return the EPackages that are
available by URI if your really want to use the URI. See
EcoreResourceDescriptionStrategy.

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

On 08.11.11 14:54, Lorenzo Bettini wrote:
> On 11/06/2011 09:53 PM, Sebastian Zarnekow wrote:
>> Hi Lorenzo,
>>
>> yes that is the reason for the failing test. Please implement a
>> transient value service or mark the attribute as transient in your ecore
>> model.
>
> Hi Sebastian
>
> I did that, and that solves one problem (the one with ePackageURI);
> however, I still have another problem now:
>
> java.lang.RuntimeException: No EObjectDescription could be found in
> Scope TypeSystemDefinition.ePackage for EPackage'fj'
> Semantic Object: TypeSystemDefinition''
>
> I think that is due to
>
> ePackage=[ecore::EPackage|STRING]
>
> in my DSL I specify the epackage reference through a URI; during the
> serialization though the ePackage gives problems since when it tries to
> serialize the ePackage it gets its 'name'... at least, this is what I
> figured...
>
> these problem take place only during unit testing (plain junit tests)...
> again I can turn off serialization tests...
>
> cheers
> Lorenzo
>
Previous Topic:How to validate broken crosslinks
Next Topic:Problem with compatible feature type when redefining variable declaration from xbase
Goto Forum:
  


Current Time: Fri Apr 19 01:31:18 GMT 2024

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

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

Back to the top