How to disable error message from Composite EValidator [message #1754273] |
Wed, 15 February 2017 22:03  |
Eclipse User |
|
|
|
I am getting this error message whenever there is an invalid cross-reference configuration.
1 [main] ERROR text.validation.CompositeEValidator - Error executing EValidator
java.lang.NullPointerException
at org.prscDeveloper.impl.TestImpl.getSName(Unknown Source)
at org.prscDeveloper.impl.TestImpl.eIsSet(Unknown Source)
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObjectImpl.java:1241)
at org.eclipse.emf.ecore.util.EObjectValidator.validate_DataValueConforms(EObjectValidator.java:832)
at org.eclipse.emf.ecore.util.EObjectValidator.validate_EveryDataValueConforms(EObjectValidator.java:820)
at org.eclipse.emf.ecore.util.EObjectValidator.validate_EveryDefaultConstraint(EObjectValidator.java:363)
at org.eclipse.emf.ecore.util.EObjectValidator$DynamicEClassValidator.validate(EObjectValidator.java:1420)
at org.eclipse.emf.ecore.util.EObjectValidator.validate(EObjectValidator.java:333)
at org.eclipse.xtext.validation.CompositeEValidator.validate(CompositeEValidator.java:151)
at org.eclipse.emf.ecore.util.Diagnostician.doValidate(Diagnostician.java:171)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:158)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:137)
at org.eclipse.xtext.validation.CancelableDiagnostician.validate(CancelableDiagnostician.java:39)
at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:181)
at org.eclipse.xtext.validation.CancelableDiagnostician.doValidateContents(CancelableDiagnostician.java:70)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:161)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:137)
at org.eclipse.xtext.validation.CancelableDiagnostician.validate(CancelableDiagnostician.java:39)
at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:181)
at org.eclipse.xtext.validation.CancelableDiagnostician.doValidateContents(CancelableDiagnostician.java:70)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:161)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:137)
at org.eclipse.xtext.validation.CancelableDiagnostician.validate(CancelableDiagnostician.java:39)
at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:181)
at org.eclipse.xtext.validation.CancelableDiagnostician.doValidateContents(CancelableDiagnostician.java:70)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:161)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:137)
at org.eclipse.xtext.validation.CancelableDiagnostician.validate(CancelableDiagnostician.java:39)
at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:185)
at org.eclipse.xtext.validation.CancelableDiagnostician.doValidateContents(CancelableDiagnostician.java:70)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:161)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:137)
at org.eclipse.xtext.validation.CancelableDiagnostician.validate(CancelableDiagnostician.java:39)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:120)
at org.eclipse.xtext.validation.ResourceValidatorImpl.validate(ResourceValidatorImpl.java:146)
at org.eclipse.xtext.validation.ResourceValidatorImpl.validate(ResourceValidatorImpl.java:124)
at org.eclipse.xtext.validation.ResourceValidatorImpl.validate(ResourceValidatorImpl.java:90)
at org.generator.Main.runValidator(Unknown Source)
at org.generator.Main.main(Unknown Source)
As the "Couldn't resolve reference to... " error message is already being displayed, why does this have to show up? Can I disable this?
|
|
|
|
|
Re: How to disable error message from Composite EValidator [message #1754301 is a reply to message #1754290] |
Thu, 16 February 2017 04:29   |
Eclipse User |
|
|
|
its actually not redundant, its redundant on how you implement your sname thingy right? by making it nullsafe?
but why dont you use a op instead of a derived in your xcore?
class Greeting {
refers Test sample
int age
op String getSname() {
sample.SName
}
}
of course you can do disable the validation completely or partially
public class CustomCompositeEValidator extends CompositeEValidator {
@Override
protected void initDefaults() {
if (isUseEObjectValidator()) {
this.addValidator(new EObjectValidator() {
@Override
public boolean validate_EveryProxyResolves(EObject eObject, DiagnosticChain diagnostics,
Map<Object, Object> context) {
// don't check, we have our own implementation, which creates nicer messages
return true;
}
@Override
public boolean validate_NoCircularContainment(EObject eObject, DiagnosticChain diagnostics,
Map<Object, Object> context) {
// don't check
return true;
}
@Override
protected boolean validate_DataValueConforms(EObject eObject, EAttribute eAttribute,
DiagnosticChain diagnostics, Map<Object, Object> context) {
//maybe some custom logic, maybe always, depends on the cases where you want to disable the validation
if (1==1) return true;
return super.validate_DataValueConforms(eObject, eAttribute, diagnostics, context);
}
});
}
}
}
def Class<? extends org.eclipse.xtext.validation.CompositeEValidator> bindCompositeEValidator() {
return Custom CompositeEValidator
}
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.28139 seconds