Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 319637

Summary: ModeledConstraintProvider.getBatchConstraints() does not invoke IConstraintDescriptor.targetsTypeOf(EObject)
Product: [Modeling] EMF Services Reporter: Horacio Blanco <hblanco>
Component: ValidationAssignee: EMF Services Validation inbox <emfservices.validation-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: pierre-charles.david
Version: unspecified   
Target Milestone: ---   
Hardware: Macintosh   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description Horacio Blanco CLA 2010-07-12 17:18:22 EDT
Build Identifier: I20100608-0911

The XmlConstraintProvider used when a constraint is defined inside plugin.xml filters the constraints returned by getBatchConstraints() by invoking IConstraintDescriptor.targetsTypeOf(EObject). ModeledConstraintProvider does not perform this filtering, as a result modeled constraints are evaluated against all the model elements instead of the targeted types.

Reproducible: Always

Steps to Reproduce:
1. Create a targeted Java constraint and set a breakpoint on its validate(IValidationContext) method
2. Add a reference to the Java constraint inside plugin.xml, note that context.getTarget() returns an EObject of the expected EClass and the breakpoint is only executed once
3. Add a reference to the Java constraint in a model.validation, note that context.getTarget() returns every model element and the breakpoint is reached multiple times
Comment 1 Pierre-Charles David CLA 2022-05-14 09:53:15 EDT
Eclipse EMF Validation is moving away from this bugs.eclipse.org issue tracker to https://github.com/eclipse/emf-validation.

If this issue is relevant to you and still present in the latest release:

* Create a new issue at https://github.com/eclipse/emf-validation/issues/.
  * Use as title in GitHub the title of this Bugzilla ticket (may include the bug number or not, at your own convenience)
  * In the GitHub description, start with a link to this bugzilla ticket
  * Optionally add new content to the description if it can helps towards resolution
* Update bugzilla ticket
  * Add to "See also" property (up right column) the link to the newly created GitHub issue
  * Add a comment "Migrated to <link-to-newly-created-GitHub-issue>"
  * Set status as CLOSED MOVED

All issues that remain open will be automatically closed next week or so. Then the Bugzilla component for EMF Validation will be archived and made read-only.
Comment 2 Pierre-Charles David CLA 2022-05-26 15:30:34 EDT
EMF Validation is in maintenance mode and has very few resources available.
If you feel this issue is still relevant and important enough, and are willing to actively contribute yourself (or fund someone to work on it), please re-open on GitHub at https://github.com/eclipse/emf-validation/issues