Skip to content

[Feature] read Ecore generics (EGenericType/ETypeParameter) and operation exceptions; fixes #97#102

Merged
samatstariongroup merged 1 commit into
developmentfrom
GH97
Jul 5, 2026
Merged

[Feature] read Ecore generics (EGenericType/ETypeParameter) and operation exceptions; fixes #97#102
samatstariongroup merged 1 commit into
developmentfrom
GH97

Conversation

@samatstariongroup

Copy link
Copy Markdown
Member

Summary

Fixes #97. EcoreNetto silently dropped the Ecore generics facility, and EOperation.EExceptions
was declared but never populated — a model using bounded/parameterized types or operation exceptions
lost that information with no diagnostic. EMF's own Ecore.ecore uses generics, so EcoreNetto could
read it (post #96) but discarded the generic type information.

What's added

Two new model classes and deserialization of every generic containment:

  • EGenericTypeeClassifier, eTypeParameter, eTypeArguments, eUpperBound, eLowerBound.
  • ETypeParametereBounds.
  • Containers wired up: ETypedElement.eGenericType (features/operations/parameters),
    EClass.eGenericSuperTypes, EClassifier.eTypeParameters, EOperation.eTypeParameters,
    EOperation.eGenericExceptions, and the eExceptions attribute.

Design notes

  • EGenericType is not an ENamedElement, so it is not registered in the resource cache and the
    second-pass loop never visits it directly. Its cross-references (eClassifier, eTypeParameter) are
    resolved by the containing element propagating SetProperties into it (the same pattern
    EModelElement uses for EAnnotations); EGenericType recurses into its own nested generic types.
  • eClassifier, eTypeParameter and eExceptions are added to the reference-attribute rewrite so
    implicit #// references get the resource segment prepended and resolve like eType/eSuperTypes.
  • ETypeParameter is name-based (<container>#//Class/E), so type-variable references resolve by
    direct cache hit.
  • Erased views kept complete: EType is derived from a generic type's raw classifier when the type
    is expressed only generically; generic super types also feed ESuperTypes; generic exceptions also
    feed EExceptions. So existing consumers of EType/ESuperTypes/EExceptions keep working.
  • No existing identifiers or behaviour change — models without generics are unaffected.

Changes

  • New: ECoreNetto/ModelElement/EGenericType.cs, ECoreNetto/ModelElement/NamedElement/ETypeParameter.cs.
  • Edited: EObject.cs (reference-attribute list), ETypedElement.cs (eGenericType + EType
    derivation), EClassifier.cs (eTypeParameters), EClass.cs (eGenericSuperTypes + ESuperTypes
    derivation), EOperation.cs (EExceptions, eTypeParameters, eGenericExceptions).
  • New test: ECoreNetto.Tests/Resource/GenericTypeTestFixture.cs (6 tests).

Verification

Full solution test suite is green:

Passed! - ECoreNetto.Tests.dll: 99
Passed! - ECoreNetto.Extensions.Tests.dll: 30
Passed! - ECoreNetto.HandleBars.Tests.dll: 43
Passed! - ECoreNetto.Reporting.Tests.dll: 48
Passed! - ECoreNetto.Tools.Tests.dll: 42

End-to-end: ecoretools inspect -i <EMF>/model/Ecore.ecore completes (exit 0) — EcoreNetto reads the
canonical Ecore metamodel, now including its eTypeParameters/eGenericType/eTypeArguments.

Closes #97

EcoreNetto silently dropped the Ecore generics facility (EGenericType/ETypeParameter and the
eGenericType/eGenericSuperTypes/eTypeParameters/eGenericExceptions/eBounds containments), and
EOperation.EExceptions was declared but never populated. Models using bounded or parameterized types
lost that information without any diagnostic.

Adds the EGenericType and ETypeParameter model classes and deserializes all generic containments:
- ETypedElement.eGenericType (features, operations, parameters)
- EClass.eGenericSuperTypes
- EClassifier.eTypeParameters and EOperation.eTypeParameters
- EOperation.eGenericExceptions and the eExceptions attribute
- ETypeParameter.eBounds and nested EGenericType eTypeArguments/eUpperBound/eLowerBound

EGenericType is not an ENamedElement (not cached), so its cross-references (eClassifier,
eTypeParameter) are resolved in the second pass by the containing element propagating SetProperties
into it. eClassifier/eTypeParameter/eExceptions are added to the reference-attribute rewrite so
implicit '#//' references resolve. The erased views are kept complete: EType is derived from a
generic type's raw classifier, generic super types feed ESuperTypes, and generic exceptions feed
EExceptions.

Adds GenericTypeTestFixture (type parameters + bounds, generic feature type + type-parameter
argument, wildcard upper/lower bounds, generic super types + erased ESuperTypes, exceptions from both
the attribute and generic forms, operation type parameters). Verified end-to-end: EcoreNetto now
reads EMF's canonical Ecore.ecore (which uses eTypeParameters/eGenericType/eTypeArguments) without
error.
@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor
Package Line Rate Branch Rate Complexity Health
ECoreNetto 90% 86% 539
ECoreNetto.Extensions 99% 92% 101
ECoreNetto.HandleBars 99% 97% 60
ECoreNetto.Reporting 83% 71% 181
ECoreNetto.Tools 95% 92% 58
Summary 91% (2434 / 2675) 84% (611 / 724) 939

@sonarqubecloud

sonarqubecloud Bot commented Jul 5, 2026

Copy link
Copy Markdown

@samatstariongroup
samatstariongroup merged commit c1446cd into development Jul 5, 2026
14 checks passed
@samatstariongroup
samatstariongroup deleted the GH97 branch July 5, 2026 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ecore generics (EGenericType/ETypeParameter) are silently dropped; EOperation.EExceptions is never populated

1 participant