Skip to content

Commit de214c1

Browse files
CopilotGoooler
andcommitted
Add comment explaining Kotlin split() preserves trailing empty segments unlike Java
Co-authored-by: Goooler <10363352+Goooler@users.noreply.github.com>
1 parent 8d995b2 commit de214c1

File tree

1 file changed

+2
-0
lines changed
  • src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/internal

1 file changed

+2
-0
lines changed

src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/internal/Relocators.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ internal fun Set<Relocator>.mapName(
1414
onModified: () -> Unit,
1515
): String {
1616
// Maybe a list of types.
17+
// Unlike Java's String.split(), Kotlin's split() with the default limit = 0 preserves trailing empty segments,
18+
// so descriptor strings ending with ';' (e.g. "Lorg/package/ClassA;") round-trip correctly.
1719
val newName = name.split(';').joinToString(";") { realMap(it, mapLiterals) }
1820
if (newName != name) {
1921
onModified()

0 commit comments

Comments
 (0)