EObjectValidator.validate() is called multiple times for models that are based on several packages [message #1117290] |
Thu, 26 September 2013 05:26  |
Eclipse User |
|
|
|
Hello,
I am using models that are based on multiple ecore packages.
For each package I have multiple (combined) EVL validation rules registered.
The combined EVL rules start off with the default EObjectValidator.
Since I have multiple ecore packages, not all rules are combined since they are registered to their corresponding package. (Which is a good thing!)
I manually find the used packages, and invoke the validation rules of each of these packages.
This results in the EObjectValidator rules getting activated multiple times. This is a waste of time and this result in errors on circular contained objects (because EObjectValidator does not expect to be called multiple times with the same context).
EObjectValidator sets ROOT_OBJECT to detect these circular containment problems.
When CompositeEValidator#validate(EClass, EObject, DiagnosticChain, Map<Object, Object>) gets modifies to check for this context entry just before the EObjectValidator gets invoked, so it can be skipped, the problem is solved.
Is this an acceptable solution and should I open a bug report and provide such a patch? Or is this too much of a 'hack'?
Regards,
Maarten
|
|
|
|
Re: EObjectValidator.validate() is called multiple times for models that are based on several packag [message #1121134 is a reply to message #1117833] |
Mon, 30 September 2013 05:54  |
Eclipse User |
|
|
|
Hello Dimitris,
> > I manually find the used packages, and invoke the validation rules of each
> > of these packages.
> I'm not sure I understand what "manually" means in this context
Manually as in, my application determines (somehow) all meta-models/packages
that are used for a model. In contrast to some provided EMF/Ecore method to
grab all packages. (Which does not seem to exist..?)
> > This is a waste of time and this result in errors on circular contained
> > objects (because EObjectValidator does not expect to be called multiple
> > times with the same context).
> "circular contained objects" sounds scary
It should be..!
But in this case it is not, as the detection algorithms (EObjectValidator) for
these kinds of errors do not expect that it is called twice.
Which is the actual problem here.
> > Is this an acceptable solution and should I open a bug report and provide
> > such a patch? Or is this too much of a 'hack'?
> I'm not sure I can fully appreciate the nature of the problem. A minimal
> example and a description of what's expected/observed in the bugzilla would
> help a lot - a patch would be fantastic
A minimal example is tricky, it requires some complexity to manifest.
A more detailed (and careful) explanation is given at Bug #418308
Hopefully it is more understandable now...
The patch will (probably) follow soon.
Regards,
Maarten
|
|
|
Powered by
FUDForum. Page generated in 0.05933 seconds