openEHR / archie

OpenEHR library implementing ADL 2, AOM 2, BMM, RM 1.0.4 and many tools
Apache License 2.0
53 stars 25 forks source link

Error in term binding checking #634

Open wolandscat opened 1 month ago

wolandscat commented 1 month ago

See here.

This line of code:

                        } else if (AOMUtils.isValidCode(constraintCodeOrPath) &&
                                !terminology.hasCode(constraintCodeOrPath) &&
                                !(archetype.isSpecialized() && flatParent != null && !flatParent.getTerminology().hasCode(constraintCodeOrPath))
                        ) {

incorrectly has a negation of both the final expression and the final term (flatParent.getTerminology()...). The effect of this is that bindings to terms defined in the flat parent (but not locally) are invalid.

Either could be removed, but it would seem more obvious to remove the final !.

Raising here, in case I don't get time to do a PR, since it's quite a bad bug.