Skip to content

ctf: fix struct member duplicating issue#408

Open
arfio wants to merge 1 commit into
eclipse-tracecompass:masterfrom
arfio:ctf2-error-struct
Open

ctf: fix struct member duplicating issue#408
arfio wants to merge 1 commit into
eclipse-tracecompass:masterfrom
arfio:ctf2-error-struct

Conversation

@arfio

@arfio arfio commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

What it does

Constructing the member field only as the constructor already adds the member to its parent. Previously the struct member was added twice causing an error. Fixes #375

How to test

Opening the trace that it provided in the issue.

Follow-ups

N/A

Review checklist

  • As an author, I have thoroughly tested my changes and carefully followed the instructions in this template

Summary by CodeRabbit

  • Refactor
    • Streamlined internal metadata parsing to simplify how structural metadata elements are created and attached during JSON processing, reducing code complexity and improving maintainability without changing outward behavior.

@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2f270279-ec6c-49e5-9361-0687d23b5659

📥 Commits

Reviewing files that changed from the base of the PR and between 7ae34c3 and 815f532.

📒 Files selected for processing (1)
  • ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/event/metadata/tsdl/struct/StructParser.java
🚧 Files skipped from review as they are similar to previous changes (1)
  • ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/event/metadata/tsdl/struct/StructParser.java

📝 Walkthrough

Walkthrough

StructParser.parse now instantiates JsonStructureFieldMemberMetadataNode inline when iterating JSON memberClasses; the node's constructor attaches it to the parent, removing the prior local-child creation plus explicit addChild call.

Changes

Node instantiation refactoring

Layer / File(s) Summary
Member node constructor attachment
ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/event/metadata/tsdl/struct/StructParser.java
During JSON memberClasses iteration, JsonStructureFieldMemberMetadataNode is instantiated inline with the constructor automatically attaching to parent, replacing the intermediate local variable and explicit addChild() call.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

Suggested reviewers

  • MatthewKhouzam

Poem

🐰 A node hops in with gentle cheer,
The parent holds it, ever near.
No extra step, no tethered thread,
Cleaner paths where code is led.
Tiny change — a lighter cheer!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'ctf: fix struct member duplicating issue' directly matches the core change: preventing duplicate struct member registration during JSON parsing.
Linked Issues check ✅ Passed The code change prevents duplicate node registration by relying on the constructor to attach nodes instead of explicit addition, which directly addresses issue #375's duplicate type definition error.
Out of Scope Changes check ✅ Passed The change is narrowly focused on the struct member parsing logic in StructParser.java, containing only necessary modifications to fix the duplicate node issue without unrelated alterations.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@arfio arfio changed the title ctf: fix issue #375 ctf: fix struct member duplicating issue Jun 8, 2026
Signed-off-by: Arnaud Fiorini <fiorini.arnaud@gmail.com>
@arfio arfio force-pushed the ctf2-error-struct branch from 7ae34c3 to 815f532 Compare June 12, 2026 03:42
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.

CTF2 metadata seems to read the same json node twice

1 participant