3

i have an EMF model where some objects contain IDs, and others don't. The id attribute is configured like this:

enter image description here

I use the java Diagnostician to check if any of the OCL Constraints are violated:

protected Diagnostic validateModel(EObject modelRoot) {
    return Diagnostician.INSTANCE.validate(modelRoot);
}

Which works just fine in most cases. But as soon as there are duplicate Ids the Validator throws a ClassCastException, where he tries to cast one of the two objects to the type of the other. What can i do to aviod this? Would an OCL constraint that checks for duplicate Ids help somehow?

Simon Eismann
  • 273
  • 1
  • 5
  • 17
  • Okay, i managed to find what exactly causes the issue. if there is a proxy that points towards a duplicate id, the diagnostican gets confused. Will upload MWE as soon as i get around to it – Simon Eismann Oct 09 '15 at 00:31

0 Answers0