From 72db7005348c86edca89fb7f9bb5abf9e962c395 Mon Sep 17 00:00:00 2001 From: Graham Date: Sun, 15 Dec 2019 16:46:25 +0000 Subject: [PATCH] Remove capitalize() method Kotlin already has a capitalize() method - we don't need to define our own. --- .../main/java/dev/openrs2/deob/remap/TypedRemapper.java | 4 ++-- util/src/main/java/dev/openrs2/util/StringUtils.kt | 7 ------- util/src/test/java/dev/openrs2/util/StringUtilsTest.kt | 7 ------- 3 files changed, 2 insertions(+), 16 deletions(-) diff --git a/deob/src/main/java/dev/openrs2/deob/remap/TypedRemapper.java b/deob/src/main/java/dev/openrs2/deob/remap/TypedRemapper.java index 0027aca1..086682a7 100644 --- a/deob/src/main/java/dev/openrs2/deob/remap/TypedRemapper.java +++ b/deob/src/main/java/dev/openrs2/deob/remap/TypedRemapper.java @@ -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) { diff --git a/util/src/main/java/dev/openrs2/util/StringUtils.kt b/util/src/main/java/dev/openrs2/util/StringUtils.kt index 125e5425..def60820 100644 --- a/util/src/main/java/dev/openrs2/util/StringUtils.kt +++ b/util/src/main/java/dev/openrs2/util/StringUtils.kt @@ -9,10 +9,3 @@ fun CharSequence.indefiniteArticle(): String { else -> "a" } } - -object StringUtils { - @JvmStatic - fun capitalize(str: String): String { - return str.capitalize() - } -} diff --git a/util/src/test/java/dev/openrs2/util/StringUtilsTest.kt b/util/src/test/java/dev/openrs2/util/StringUtilsTest.kt index a62e7479..c780e20d 100644 --- a/util/src/test/java/dev/openrs2/util/StringUtilsTest.kt +++ b/util/src/test/java/dev/openrs2/util/StringUtilsTest.kt @@ -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("")) - } }