Skip to content

[Fix] Guard unsafe casts on GetEObject(...) results; fixes #32#69

Merged
samatstariongroup merged 1 commit into
developmentfrom
GH32
Jun 1, 2026
Merged

[Fix] Guard unsafe casts on GetEObject(...) results; fixes #32#69
samatstariongroup merged 1 commit into
developmentfrom
GH32

Conversation

@samatstariongroup
Copy link
Copy Markdown
Member

@samatstariongroup samatstariongroup commented Jun 1, 2026

Prerequisites

  • I have written a descriptive pull-request title
  • I have verified that there are no overlapping pull-requests open
  • I have verified that I am following the EcoreNetto code style guidelines
  • I have provided test coverage for my change (where applicable)

Description

  • Resource.GetEObject(string) now honors its documented "or null if it can't be resolved" contract (returns EObject?) and guards against self-recursion, eliminating the stack overflow.
    • New Resource.GetEObject() resolves and type-checks in one step, throwing a descriptive InvalidOperationException that names the offending fragment (covers both unresolved and wrong-type).
  • EClass (eSuperTypes), ETypedElement (eType) and EReference (eOpposite) now use the typed resolver instead of raw casts.
  • Adds GuardedGetEObjectTestFixture covering unresolved + incorrect-type at each affected location both at the resolver level and end-to-end via Resource.Load.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

Package Line Rate Branch Rate Complexity Health
ECoreNetto 85% 77% 407
ECoreNetto.Extensions 99% 93% 101
ECoreNetto.HandleBars 99% 98% 60
ECoreNetto.Reporting 83% 71% 181
ECoreNetto.Tools 94% 87% 59
Summary 89% (2133 / 2407) 81% (486 / 602) 808

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jun 1, 2026

@samatstariongroup samatstariongroup merged commit be2b710 into development Jun 1, 2026
14 checks passed
@samatstariongroup samatstariongroup deleted the GH32 branch June 2, 2026 05:45
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.

1 participant