EMF

Children elements are not validated

In the generated EMF validator example adapter (EValidatorAdapter), there seems to be a weird bug where children elements are not validated correctly. One solution to this is to modify the generated hasProcessed() method, as I did in this revision:

private boolean hasProcessed(EObject eObject, Map<Object, Object> context) {
    // for some reason, the default adapter was returning "true"
    // for children objects of a given object. as a hack, this method
    // now <em>always</em> returns false regardless.
    return false;
  }

org.eclipse.ocl.SemanticException: Cannot find operation (eContainer()) for the type (BuiltinProperty)

See the MDT/OCL FAQ, in particular “How do I invoke methods such as eContainer(), eContents(), eGet()?”:

ParsingOptions.setOption(ocl.getEnvironment(),
    ParsingOptions.implicitRootClass(ocl.getEnvironment()),
    EcorePackage.Literals.EOBJECT);

(This of course assumes you have a handle to the OCL environment, which may not be available if you are simply extending the default generated EMF OCL validator adapter.)

Related: Bug 152003