|
|
Re: Incomplete and invalid serialization of Ecore elements [message #1692950 is a reply to message #1692943] |
Mon, 20 April 2015 15:18   |
Eclipse User |
|
|
|
Dear Christian,
For extending our agent-oriented programming language (SARL), several of your users and designers have requested to include some object-oriented definitions as internal data structures (inner classes) in the agents. I'm trying to extend our language with OO statements coming from Xtend since the syntax and the operational semantic of Xtend are close to the ones of SARL. Moreover, we benefit of the developments on Xtend that are beyond the scope of SARL strictly speaking. The extension of SARL with OO from Xtend is a proof of concept that may be selected as the standard way by the agent-oriented programmers. Additionnally, the pair SARL+Xtend may becomes an alternative to Scala+Actor extension.
The parsed model seems to be correct. I have explored the Ecore elements by hand (with the debugger), and they seems to be correctly parsed.
I have started to debug the serializer and the SARLSemanticSequencer, but unfortunatelly, I have not detected any exception.
I'm still exploring, instruction per instruction, the execution of the serializer. I will give you more details when I obtain them from my exploration.
[Updated on: Mon, 20 April 2015 16:17] by Moderator
|
|
|
Re: Incomplete and invalid serialization of Ecore elements [message #1692962 is a reply to message #1692950] |
Mon, 20 April 2015 17:08  |
Eclipse User |
|
|
|
I found the problem: the types pointed by the JvmTypeReference cannot be resolved (especially "foo.ecore.SubAgent").
I solve the problem by forcing the validation of the code, and specifying the classpath URI context on the XtextResourceSet.
protected SarlAgent agent(String string) throws Exception {
List<XtendTypeDeclaration> decls = file(string, true).getXtendTypes();
return (SarlAgent) decls.get(decls.size() - 1);
}
protected XtendFile file(String string, boolean validate) throws Exception {
XtendFile script = this.parser.parse(string);
if (validate) {
Resource resource = script.eResource();
ResourceSet resourceSet = resource.getResourceSet();
if (resourceSet instanceof XtextResourceSet) {
((XtextResourceSet) resourceSet).setClasspathURIContext(getClass());
}
assertEquals(resource.getErrors().toString(), 0, resource.getErrors().size());
Collection<Issue> issues = Collections2.filter(issues(resource), new Predicate<Issue>() {
@Override
public boolean apply(Issue input) {
return input.getSeverity() == Severity.ERROR;
}
});
assertTrue("Resource contained errors : " + issues.toString(), issues.isEmpty());
}
return script;
}
|
|
|
Powered by
FUDForum. Page generated in 0.03706 seconds