Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pivot] Intermittent loading of *.oclas in the wrong (not AS) ResourceSet #2339

Open
eclipse-ocl-bot opened this issue Sep 26, 2024 · 7 comments

Comments

@eclipse-ocl-bot
Copy link
Collaborator

| --- | --- |
| Bugzilla Link | 583185 |
| Status | NEW |
| Importance | P3 normal |
| Reported | Apr 23, 2024 06:07 EDT |
| Modified | May 27, 2024 07:37 EDT |
| See also | 583043, 583197 |
| Reporter | Ed Willink |

Description

Whike debuigging issues around the Validation Tutotial and Validfity View bad things sometimes hapen and it appears that a contrtibutory factor is the load or a *.oclas in the external rather than AS ResourceSet.

This should never happen for clean OCL usage, but could happen if a user explicitly use e.g the SAmple Ecore Editor to open a *.oclas.

Bug 583043 work creates a repro via testValidate_Validate_completeocl resolving a Complete OCL import proxy badly.

@eclipse-ocl-bot
Copy link
Collaborator Author

By Ed Willink on Apr 23, 2024 06:23

(In reply to Ed Willink from comment #0)

Bug 583043 work creates a repro via testValidate_Validate_completeocl
resolving a Complete OCL import proxy badly.

The problem arises during the new code to install the AS from the already parsed CS content.

The Complete OCL ImportCS.referredNamespace has a file:/E:/Development/Workspace/_OCL_ValidateTests__testValidate_Validate_completeocl/Validate.ecore.oclas#/ proxy that is resolved within the ResourceSet of the containing CompleteOCLCSResource for file:/E:/Development/Workspace/_OCL_ValidateTests__testValidate_Validate_completeocl/Validate.ocl

the load therefore goes in the wrong ResourceSet.

a) ?? find a way to use the other ResourceSet

b) ?? find a way to convert the AS proxy to ES.

c) ?? use an ES rather than AS proxy

(This bug is intermittent because *.oclas proxies are rarely resolved.)

@eclipse-ocl-bot
Copy link
Collaborator Author

By Ed Willink on Apr 23, 2024 06:57

*** Bug 582947 has been marked as a duplicate of this bug. ***

@eclipse-ocl-bot
Copy link
Collaborator Author

By Ed Willink on Apr 23, 2024 07:01

The 'bad' proxy only occurs if an unload causes an AS reference to be proxified.

The use of Validate.ecore.oclas as the AS proxy for Validate.oclinecore perhaps contribvutes to extra problems that arise when PivotMetamodelManager.loadResource does an unload.

Bug 582947 identified this problem as a potential issue.

@eclipse-ocl-bot
Copy link
Collaborator Author

By Ed Willink on Apr 23, 2024 07:30

While parsing the ImportCS.referredNMamespace resolves the Xtext proxy:
file:/E:/Development/Workspace/_OCL_ValidateTests__testValidate_Validate_completeocl/Validate.ocl#|0
for the line import 'Validate.oclinecore'

Un loading sets the proxy to
file:/E:/Development/Workspace/_OCL_ValidateTests__testValidate_Validate_completeocl/Validate.ecore.oclas#/

Maybe we just need unloading to set the proxy to

file:/E:/Development/Workspace/_OCL_ValidateTests__testValidate_Validate_completeocl/Validate.ecore#/

(and of course review why unloading occurred at all.)

@eclipse-ocl-bot
Copy link
Collaborator Author

By Ed Willink on Apr 25, 2024 06:10

(In reply to Ed Willink from comment #1)

b) ?? find a way to convert the AS proxy to ES.

(In reply to Ed Willink from comment #4)

Maybe we just need unloading to set the proxy to

file:/E:/Development/Workspace/
_OCL_ValidateTests__testValidate_Validate_completeocl/Validate.ecore#/

For #/ it is relatively easy to provide a PivotObjectImpl.eSetProxyURI overload to strip the extra AS extension. But for deeper references the fragment needs conversion from AS to CS and in AS context ElementUtil is not accessible.

But ElementUtil.getCsElement us static and mostly uses ICSI2ASMapping which is a pivot interface. An extra ICSI2ASMapping.getCsElement() method and we could be good, provided the EnvironmentFactory is not already dispose.

BUg 583197 identifies a confusion between Validate.oclinecore.oclas abd Validate.ecore.oclas.

@eclipse-ocl-bot
Copy link
Collaborator Author

By Ed Willink on May 20, 2024 07:19

*** Bug 583182 has been marked as a duplicate of this bug. ***

@eclipse-ocl-bot
Copy link
Collaborator Author

By Ed Willink on May 27, 2024 07:37

Once we try to support re-use of a CSResource, we open a new can of worms when the externalResourceSet is shared concurrently or sequentially with multiple OCLs.

The EMF aspect of CSResource content can only referen ce the AS for a single OCL.

The extended OCL as of a CSResource content needs EnvironmentFactory-dependent AS references.


Consider the Validation tutorial lifecycle.

Open Sample Ecore Model Editor
Load one or more .ecore/.xmi
Load OCL documents

  • these CS resources are user visible so legitimately exist in the Editing domain ResourceSet aided by an OCL

Validate on a worker thread creates a new OCL re-using the external resource set and CS.

Re-use of ecore etc is ok since there is no AS reference.

Re-use of CS is not. We either redesign the CS to avoid AS references -painful and rippling, or force a CS reload.

Perhaps the externalResourceSet re-use, does not re-use the ResourceSet, rather a new ResourceSet re-uses non-CS via the uriResourceMap and clones the CS with unresolved proxies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant