Cannot serialize a Boolean false value [message #1037510] |
Tue, 09 April 2013 12:42  |
Eclipse User |
|
|
|
Hi,
I'm having a problem when setting the "config" property in the grammar below to false. It seems that XText doesn't allow booleans to be set to false, true works fine. Is there a trick to this? Am I missing some specific property setting on my EAttribute?
My example is I have a "config" property which is of type EBooleanObject in my Ecore file. When I set the value to false in ATL I get an XText exception as follows:
org.eclipse.xtext.parsetree.reconstr.XtextSerializationException: Serialization failed
<# of serialized tokens>: <EObject path> "<serializable fragment, starting from the end>":
-> <possible reasons for not continuing>
31:SubModule'X'.statements[0]->List'ManagedElement'.children[0]->Leaf'managedElementId': "leaf managedElementId { type string ; mandatory tru...":
-> Can not leave rule 'Leaf' since the current object 'Leaf' has features with unconsumed values: 'config':1
29:SubModule'X'.statements[0]->List'ManagedElement'.children[0]->Leaf'managedElementId'.type->DataType'string': ": string ; mandatory true ; } } }":
-> DataType_NamespaceAssignment_0_0: DataType.namespace is not set.
27:SubModule'X'.statements[0]->List'ManagedElement'.children[0]->Leaf'managedElementId': "leaf managedElementId { type string ; } } }":
-> Can not leave rule 'Leaf' since the current object 'Leaf' has features with unconsumed values: 'mandatory':1, 'config':1
25:SubModule'X'.statements[0]->List'ManagedElement'.children[0]->Leaf'managedElementId'.type->DataType'string': ": string ; } } }":
-> DataType_NamespaceAssignment_0_0: DataType.namespace is not set.
23:SubModule'X'.statements[0]->List'ManagedElement'.children[0]->Leaf'managedElementId'.type->DataType'string': ": string ; } } }":
-> DataType_NamespaceAssignment_0_0: DataType.namespace is not set.
22:SubModule'X': "submodule XX { belongs-to XX { prefix ...":
-> Can not leave rule 'SubModule' since the current object 'SubModule' has features with unconsumed values: 'statements':1
21:SubModule'X': "; belongs-to XX { prefix XX ; } descr...":
-> SubModule_YangVersionAssignment_3_1: AbstractModule(SubModule).yangVersion is not set.
20:SubModule'X': "submodule X { belongs-to XX { prefix ...":
-> Can not leave rule 'SubModule' since the current object 'SubModule' has features with unconsumed values: 'statements':1
19:SubModule'X': "; belongs-to XX { prefix XX ; } descr...":
-> SubModule_YangVersionAssignment_3_1: AbstractModule(SubModule).yangVersion is not set.
18:SubModule'X'.statements[0]->List'ManagedElement'.children[0]->Leaf'managedElementId': "; } } }":
-> Leaf_ReferenceAssignment_14_1: ModuleStatement(Leaf).reference is not set.
at org.eclipse.xtext.parsetree.reconstr.impl.AbstractParseTreeConstructor.serialize(Unknown Source)
at org.eclipse.xtext.parsetree.reconstr.impl.AbstractParseTreeConstructor.serialize(Unknown Source)
at org.eclipse.xtext.parsetree.reconstr.impl.AbstractParseTreeConstructor.serializeSubtree(Unknown Source)
at org.eclipse.xtext.parsetree.reconstr.Serializer.serialize(Unknown Source)
at org.eclipse.xtext.parsetree.reconstr.Serializer.serialize(Unknown Source)
at org.eclipse.xtext.resource.XtextResource.doSave(Unknown Source)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Unknown Source)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Unknown Source)
at org.eclipse.m2m.atl.core.emf.EMFExtractor.extract(Unknown Source)
at org.eclipse.m2m.atl.core.service.LauncherService.launch(Unknown Source)
at org.eclipse.m2m.atl.core.ui.launch.AtlLaunchConfigurationDelegate.launchOrDebug(Unknown Source)
at org.eclipse.m2m.atl.core.ui.launch.AtlLaunchConfigurationDelegate.launch(Unknown Source)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(Unknown Source)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(Unknown Source)
at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(Unknown Source)
at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(Unknown Source)
at org.eclipse.core.internal.jobs.Worker.run(Unknown Source)
I had expected to see the property "config false" in my XText output. If I generate to XMI the value shows up correctly i.e. config="false"
I have a grammer as follows:
Leaf returns yang::Leaf:
'leaf' name=(ID|STRING|KEYWORD) '{'
( when=When )?
( ifFeature=IfFeature )?
'type' type=Type
('mandatory' mandatory?=('true'|'false') ';')?
(musts+=Must)*
( 'default' defaultValue=Value ';' )?
( 'units' units=STRING ';' )?
( 'config' config?=('true'|'false') ';' )?
( 'status' status=StatusKind ';' )?
( 'description' description=STRING ';' )?
( 'reference' reference=STRING ';' )?
( properties+=Property )*
'}'
;
Note: EAttribute "config" is changeable, unique, ordered. All the other settings are false.
Thanks,
Ronan
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03425 seconds