[#25] Enable strict Kotlin compiler warnings
Fixed existing warnings, which included: - Suppressing a deprecation warning for Java 9, as we have to maintain compatibility with Java 8 for Android - Using a new Kotlin API introduced in Kotlin 1.5 - Removed unused local variables
This commit is contained in:
parent
570e273635
commit
90aa3eaf79
|
@ -8,7 +8,7 @@ org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m
|
||||||
|
|
||||||
kotlin.mpp.stability.nowarn=true
|
kotlin.mpp.stability.nowarn=true
|
||||||
|
|
||||||
BIP39_IS_TREAT_WARNINGS_AS_ERRORS=false
|
BIP39_IS_TREAT_WARNINGS_AS_ERRORS=true
|
||||||
|
|
||||||
JVM_TOOLCHAIN=17
|
JVM_TOOLCHAIN=17
|
||||||
JVM_TARGET=1.8
|
JVM_TARGET=1.8
|
||||||
|
|
|
@ -13,6 +13,9 @@ import javax.crypto.spec.SecretKeySpec
|
||||||
* service provider. This provides a bridge to a commonly used Java implementation that has been
|
* service provider. This provides a bridge to a commonly used Java implementation that has been
|
||||||
* moderately adapted to Kotlin.
|
* moderately adapted to Kotlin.
|
||||||
*/
|
*/
|
||||||
|
// Constructor was deprecated in Java 9, but for compatibility with Android (Java 8, effectively) the old constructor
|
||||||
|
// must continue to be used.
|
||||||
|
@Suppress("DEPRECATION")
|
||||||
class FallbackProvider : Provider(
|
class FallbackProvider : Provider(
|
||||||
"FallbackProvider",
|
"FallbackProvider",
|
||||||
1.0,
|
1.0,
|
||||||
|
|
|
@ -35,7 +35,7 @@ object Pbkdf2Sha512 {
|
||||||
ByteArrayOutputStream().use { baos ->
|
ByteArrayOutputStream().use { baos ->
|
||||||
val dkLenBytes = dkLen/8
|
val dkLenBytes = dkLen/8
|
||||||
val pBytes = p.foldIndexed(ByteArray(p.size)) { i, acc, c ->
|
val pBytes = p.foldIndexed(ByteArray(p.size)) { i, acc, c ->
|
||||||
acc.apply { this[i] = c.toByte() }
|
acc.apply { this[i] = c.code.toByte() }
|
||||||
}
|
}
|
||||||
val hLen = 20.0
|
val hLen = 20.0
|
||||||
// note: dropped length check because it's redundant, given the size of an int in kotlin
|
// note: dropped length check because it's redundant, given the size of an int in kotlin
|
||||||
|
|
|
@ -102,7 +102,7 @@ class MnemonicsTest : BehaviorSpec({
|
||||||
row(18, "d5bcbf62dea1a07ab1abb0144b299300137168a7939f3071f112b557", "stick tourist suffer run borrow diary shop invite begin flock gospel ability damage reform oxygen initial corn moon dwarf height image"),
|
row(18, "d5bcbf62dea1a07ab1abb0144b299300137168a7939f3071f112b557", "stick tourist suffer run borrow diary shop invite begin flock gospel ability damage reform oxygen initial corn moon dwarf height image"),
|
||||||
row(15, "e06ce21369dc09eb2bda66510a76f65ab3f947cce90fcb10", "there grow luggage squirrel scene void quarter error extra father rural rely display physical crisp capable slam lumber"),
|
row(15, "e06ce21369dc09eb2bda66510a76f65ab3f947cce90fcb10", "there grow luggage squirrel scene void quarter error extra father rural rely display physical crisp capable slam lumber"),
|
||||||
row(12, "0b01c3c0b0590faf45fc171da17cfb22", "arch asthma usual gaze movie stumble blood load buffalo armor disagree earth")
|
row(12, "0b01c3c0b0590faf45fc171da17cfb22", "arch asthma usual gaze movie stumble blood load buffalo armor disagree earth")
|
||||||
) { count, entropy, mnemonic ->
|
) { _, entropy, mnemonic ->
|
||||||
val code = MnemonicCode(entropy.fromHex())
|
val code = MnemonicCode(entropy.fromHex())
|
||||||
String(code.chars) shouldBe mnemonic
|
String(code.chars) shouldBe mnemonic
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,6 @@ import io.kotest.matchers.string.shouldContain
|
||||||
class ReadmeExamplesTest : ShouldSpec({
|
class ReadmeExamplesTest : ShouldSpec({
|
||||||
val validPhrase =
|
val validPhrase =
|
||||||
"still champion voice habit trend flight survey between bitter process artefact blind carbon truly provide dizzy crush flush breeze blouse charge solid fish spread"
|
"still champion voice habit trend flight survey between bitter process artefact blind carbon truly provide dizzy crush flush breeze blouse charge solid fish spread"
|
||||||
val validPhraseChars = validPhrase.toCharArray()
|
|
||||||
context("Example: Create 24-word mnemonic phrase") {
|
context("Example: Create 24-word mnemonic phrase") {
|
||||||
val mnemonicCode = MnemonicCode(WordCount.COUNT_24)
|
val mnemonicCode = MnemonicCode(WordCount.COUNT_24)
|
||||||
should("result in a valid 24-word phrase") {
|
should("result in a valid 24-word phrase") {
|
||||||
|
|
Loading…
Reference in New Issue