Remove capitalize() method

Kotlin already has a capitalize() method - we don't need to define our
own.
bzip2
Graham 5 years ago
parent db971f6b2b
commit 72db700534
  1. 4
      deob/src/main/java/dev/openrs2/deob/remap/TypedRemapper.java
  2. 7
      util/src/main/java/dev/openrs2/util/StringUtils.kt
  3. 7
      util/src/test/java/dev/openrs2/util/StringUtilsTest.kt

@ -10,9 +10,9 @@ import dev.openrs2.asm.MemberDesc;
import dev.openrs2.asm.MemberRef;
import dev.openrs2.asm.classpath.ClassMetadata;
import dev.openrs2.asm.classpath.ClassPath;
import dev.openrs2.util.StringUtils;
import dev.openrs2.util.StringUtilsKt;
import dev.openrs2.util.collect.DisjointSet;
import kotlin.text.StringsKt;
import org.objectweb.asm.Type;
import org.objectweb.asm.commons.Remapper;
import org.slf4j.Logger;
@ -166,7 +166,7 @@ public final class TypedRemapper extends Remapper {
throw new IllegalArgumentException("Unknown field type " + type);
}
prefix = StringUtilsKt.indefiniteArticle(prefix) + StringUtils.capitalize(prefix);
prefix = StringUtilsKt.indefiniteArticle(prefix) + StringsKt.capitalize(prefix);
var mappedName = generateName(prefixes, prefix);
for (var field : partition) {

@ -9,10 +9,3 @@ fun CharSequence.indefiniteArticle(): String {
else -> "a"
}
}
object StringUtils {
@JvmStatic
fun capitalize(str: String): String {
return str.capitalize()
}
}

@ -1,6 +1,5 @@
package dev.openrs2.util
import dev.openrs2.util.StringUtils.capitalize
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertFailsWith
@ -14,10 +13,4 @@ object StringUtilsTest {
"".indefiniteArticle()
}
}
@Test
fun testCapitalize() {
assertEquals("Hello", capitalize("hello"))
assertEquals("", capitalize(""))
}
}

Loading…
Cancel
Save