Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Adding validation errors (and handling exceptions) in JvmModelInferrer
Adding validation errors (and handling exceptions) in JvmModelInferrer [message #937891] Tue, 09 October 2012 10:54
Alexey Romanov is currently offline Alexey RomanovFriend
Messages: 263
Registered: May 2010
Senior Member
How can I add validation errors found while trying to infer the JVM model (after cross-indexing, so they can't be checked in the validator)? I've tried injecting first ValidationMessageAcceptor (which couldn't be found) and then IDLJavaValidator. But it inherits this implementation from AbstractDeclarativeValidator:
	public void acceptError(String message, EObject object, EStructuralFeature feature, int index, String code, String... issueData) {
		this.state.get().hasErrors = true;
		state.get().chain.add(createDiagnostic(Severity.ERROR, message, object, feature, index, code, issueData));

and state.get() returns null. While I've found I could initialize the state threadLocal by doing validation.setMessageAcceptor(validation).getState() 1) this is obviously wrong Smile 2) it still didn't work because state.get().chain was null.

So is there a proper mechanism for reporting errors from inferring the model?
Previous Topic:Generation of field initializers and methods body at JVM Inferring
Next Topic:Provide model at runtime
Goto Forum:

Current Time: Mon Feb 08 21:30:49 GMT 2016

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

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