Skip to content

Clarify that Kotlin's split(';') preserves trailing empty segments in mapName()#1969

Closed
Copilot wants to merge 1 commit intomainfrom
copilot/sub-pr-1967-again
Closed

Clarify that Kotlin's split(';') preserves trailing empty segments in mapName()#1969
Copilot wants to merge 1 commit intomainfrom
copilot/sub-pr-1967-again

Conversation

Copy link
Contributor

Copilot AI commented Mar 12, 2026

The reviewer suggested using split(';', limit = -1) to prevent trailing semicolons from being dropped in JVM descriptor strings. Investigation showed the suggested fix is invalid in Kotlin (IllegalArgumentException: Limit must be non-negative) and the concern itself doesn't apply — Kotlin's split() with default limit = 0 already preserves trailing empty segments, unlike Java's String.split().

  • Relocators.kt: Replace the terse // Maybe a list of types. comment with one that explicitly documents the Kotlin vs Java split behavior, preventing future confusion about whether a "fix" is needed.

Verified behavior:

"Lorg/package/ClassA;".split(';')  // → ["Lorg/package/ClassA", ""] (size=2)
// rejoined: "Lorg/package/ClassA;" ✓ trailing ';' preserved

Existing tests in RelocatorsTest.kt (e.g. "Lorg/package/ClassA;""Lshadow/org/package/ClassA;") already provide regression coverage.


  • CHANGELOG's "Unreleased" section has been updated, if applicable.

🔒 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.

This comment was marked as outdated.

Copilot AI changed the title [WIP] [WIP] Address feedback on "Split relocators remapping" PR Clarify that Kotlin's split(';') preserves trailing empty segments in mapName() Mar 12, 2026
Base automatically changed from g/20260312/extract-remapper to main March 12, 2026 08:45
@Goooler Goooler force-pushed the copilot/sub-pr-1967-again branch from 37cc2f0 to de214c1 Compare March 12, 2026 08:54
@Goooler Goooler marked this pull request as ready for review March 12, 2026 08:55
…ts unlike Java

Co-authored-by: Goooler <10363352+Goooler@users.noreply.github.com>
@Goooler Goooler force-pushed the copilot/sub-pr-1967-again branch from de214c1 to e1ba3c1 Compare March 12, 2026 08:56
@Goooler
Copy link
Member

Goooler commented Mar 12, 2026

There's no need to make a note of it; it's covered by the tests.

@Goooler Goooler closed this Mar 12, 2026
@Goooler Goooler deleted the copilot/sub-pr-1967-again branch March 12, 2026 08:56
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