Cleanup: fix some compiler warnings (mostly deprecations, javaClass)
This commit is contained in:
+2
-1
@@ -52,7 +52,8 @@ abstract class BinaryVersion(vararg val numbers: Int) {
|
||||
}
|
||||
|
||||
override fun equals(other: Any?) =
|
||||
this.javaClass == other?.javaClass &&
|
||||
other != null &&
|
||||
this::class.java == other::class.java &&
|
||||
major == (other as BinaryVersion).major && minor == other.minor && patch == other.patch && rest == other.rest
|
||||
|
||||
override fun hashCode(): Int{
|
||||
|
||||
@@ -92,7 +92,7 @@ fun <T : Any> constant(calculator: () -> T): T {
|
||||
if (cached != null) return cached as T
|
||||
|
||||
// safety check
|
||||
val fields = calculator.javaClass.declaredFields.filter { it.modifiers.and(Modifier.STATIC) == 0 }
|
||||
val fields = calculator::class.java.declaredFields.filter { it.modifiers.and(Modifier.STATIC) == 0 }
|
||||
assert(fields.isEmpty()) {
|
||||
"No fields in the passed lambda expected but ${fields.joinToString()} found"
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ private val ALWAYS_NULL: (Any?) -> Any? = { null }
|
||||
fun <T, R: Any> alwaysNull(): (T) -> R? = ALWAYS_NULL as (T) -> R?
|
||||
|
||||
val DO_NOTHING: (Any?) -> Unit = { }
|
||||
val DO_NOTHING_2: (Any?, Any?) -> Unit = { x, y -> }
|
||||
val DO_NOTHING_3: (Any?, Any?, Any?) -> Unit = { x, y, z -> }
|
||||
val DO_NOTHING_2: (Any?, Any?) -> Unit = { _, _ -> }
|
||||
val DO_NOTHING_3: (Any?, Any?, Any?) -> Unit = { _, _, _ -> }
|
||||
|
||||
fun <T> doNothing(): (T) -> Unit = DO_NOTHING
|
||||
|
||||
Reference in New Issue
Block a user