Skip to content

Remove legacy RefObject/OutObject wrappers and finalize Java-idiomatic refactor#27

Merged
micycle1 merged 4 commits intomasterfrom
copilot/refactor-remove-wrapper-usage
Mar 3, 2026
Merged

Remove legacy RefObject/OutObject wrappers and finalize Java-idiomatic refactor#27
micycle1 merged 4 commits intomasterfrom
copilot/refactor-remove-wrapper-usage

Conversation

Copy link
Contributor

Copilot AI commented Mar 1, 2026

This project still carried Tangible wrapper classes used to emulate C# ref/out semantics. This PR completes the migration to Java-idiomatic value/return flow by removing remaining wrapper usage and deleting the obsolete wrapper types.

  • Ref/out emulation removal in core paths

    • ClipperBase: replaced wrapper-based swaps and out-params with direct local swaps and typed return values (PopHorz() return, HorzDirection result).
    • ClipperOffset: replaced RefObject<Integer> index threading with int in/out via method return.
    • RectClip64 / RectClipLines64: replaced mutable RefObject call patterns with explicit result carriers (LocationResult, IntersectionResult, NextLocationResult) and state assignment at call sites.
  • Wrapper class removal

    • Deleted:
      • src/main/java/tangible/RefObject.java
      • src/main/java/tangible/OutObject.java
    • Updated src/main/java9/module-info.java to remove exports tangible; after package deletion.
  • Test alignment

    • TestPolytree: converted recursive counter propagation from wrapper mutation to int return flow.
// before
RefObject<Integer> kRef = new RefObject<>(0);
for (int i = 1; i < highI; i++) {
    OffsetPoint(group, path, i, kRef);
}

// after
int k = 0;
for (int i = 1; i < highI; i++) {
    k = OffsetPoint(group, path, i, k);
}

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Copilot AI and others added 2 commits March 1, 2026 15:48
Co-authored-by: micycle1 <9304234+micycle1@users.noreply.github.com>
Co-authored-by: micycle1 <9304234+micycle1@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor to eliminate wrapper usage for Java-style references Refactor C#-style ref/out wrappers to Java return/value patterns Mar 1, 2026
Co-authored-by: micycle1 <9304234+micycle1@users.noreply.github.com>
Copilot AI changed the title Refactor C#-style ref/out wrappers to Java return/value patterns Remove legacy RefObject/OutObject wrappers and finalize Java-idiomatic refactor Mar 1, 2026
@micycle1 micycle1 marked this pull request as ready for review March 3, 2026 20:41
@micycle1 micycle1 merged commit 2c46be5 into master Mar 3, 2026
1 check passed
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.

2 participants