| Summary: | [editor] cannot refer to external type in oclIsKindOf | ||
|---|---|---|---|
| Product: | [Modeling] OCL | Reporter: | Ed Willink <ed> |
| Component: | Core | Assignee: | OCL Inbox <mdt-ocl-inbox> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | ||
| Version: | 3.2.0 | ||
| Target Milestone: | M1 | ||
| Hardware: | PC | ||
| OS: | Windows Vista | ||
| Whiteboard: | |||
| Bug Depends on: | |||
| Bug Blocks: | 353793 | ||
A similar repro for ImportTests not using Ecore files at all.
public void testImport_OCLinEcore_Bug353793() throws Exception {
String testFileA =
"package packA : packA = 'packA'{\n" +
" class A;\n" +
"}\n";
createFile("TBug353793A.oclinecore", testFileA);
String testFileB =
"import packA : 'TBug353793A.oclinecore';\n" +
"package packB : packB = 'packB'\n" +
"{\n" +
" class B extends packA::A;\n" +
"}\n";
doLoadFromString("Bug353793B.oclinecore", testFileB);
}
fails on "Unresolved type 'A'" in "packA::A".
(In reply to comment #1) > A similar repro for ImportTests not using Ecore files at all. > > public void testImport_OCLinEcore_Bug353793() throws Exception { This is nothing to do with this problem. Bug 353793 is solved by itself. (In reply to comment #0) > On reload, the package qualification is lost. This is initially a problem with the PrettyPrinter that fails to generate qualified names corrected. Once fixed the serialisation is ref.oclIsKindOf(_'xxxx.ecore'::aa::A2) where xxxx is the source file name segment that named the root package. This avoids the loss but is not readable. Option 1: replace _'xxxx.ecore' by an alias that maps to a URI and is propagated as an additional EPackage EAnnotation. This requires an additional EAnnotation to be documented and handled. It also requires reification during Ecore2Pivot even though the OpaqueExpression is still opaque. Option 2: redefine _'xxxx.ecore' as a URI, and allow the use of URIs as the first segment of a qualified name. No EAnnotations, no aliases to keep unique, a potentially useful facility. User is required to keep URIs unique. PrettyPrinter qualified names fixed. First name in qualified name now resolved as URI relative to primary document if nothing else matches. Pushed to master. CLOSED after a year in the RESOLVED state. |
With the Indigo OclInEcore editor: import aa : 'a.ecore#/'; package b : bb = 'bbb' { class B1 { property ref : aa::A1[1] { ordered }; } class B2 extends B1 { invariant : ref.oclIsKindOf(aa::A2); } class Root { property as : aa::A1[*] { composes }; property ab : B1[*] { composes }; } } fails to save and reload, since the oclIsKindOf is saved in textual form in the Ecore and that has no corresponding import statement. On reload, the package qualification is lost.