Cleanup: fix some compiler warnings (mostly deprecations, javaClass)
This commit is contained in:
@@ -120,7 +120,7 @@ fun interpreterLoop(
|
||||
return exceptionCaught(exceptionValue) {
|
||||
exceptionType ->
|
||||
try {
|
||||
val exceptionClass = exception.javaClass
|
||||
val exceptionClass = exception::class.java
|
||||
val _class = Class.forName(
|
||||
exceptionType.internalName.replace('/', '.'),
|
||||
true,
|
||||
@@ -222,7 +222,7 @@ fun interpreterLoop(
|
||||
}
|
||||
catch (e: ThrownFromEvalExceptionBase) {
|
||||
val exception = e.cause!!
|
||||
val exceptionValue = ObjectValue(exception, Type.getType(exception.javaClass))
|
||||
val exceptionValue = ObjectValue(exception, Type.getType(exception::class.java))
|
||||
val handled = handler.exceptionThrown(frame, currentInsn,
|
||||
exceptionValue)
|
||||
if (handled != null) return handled
|
||||
|
||||
@@ -48,7 +48,7 @@ fun makeInitialFrame(methodNode: MethodNode, arguments: List<Value>): Frame<Valu
|
||||
frame.setReturn(makeNotInitializedValue(Type.getReturnType(methodNode.desc)))
|
||||
|
||||
var index = 0
|
||||
for ((i, arg) in arguments.withIndex()) {
|
||||
for (arg in arguments) {
|
||||
frame.setLocal(index++, arg)
|
||||
if (arg.size == 2) {
|
||||
frame.setLocal(index++, NOT_A_VALUE)
|
||||
|
||||
@@ -160,7 +160,7 @@ object REFLECTION_EVAL : Eval {
|
||||
Type.OBJECT,
|
||||
Type.ARRAY -> {
|
||||
val value = JArray.get(arr, ind)
|
||||
if (value == null) NULL_VALUE else ObjectValue(value, Type.getType(value.javaClass))
|
||||
if (value == null) NULL_VALUE else ObjectValue(value, Type.getType(value::class.java))
|
||||
}
|
||||
else -> throw UnsupportedOperationException("Unsupported array element type: $elementType")
|
||||
}
|
||||
@@ -204,7 +204,7 @@ object REFLECTION_EVAL : Eval {
|
||||
}
|
||||
}
|
||||
catch (e: Throwable) {
|
||||
throw ThrownFromEvaluatedCodeException(ObjectValue(e, Type.getType(e.javaClass)))
|
||||
throw ThrownFromEvaluatedCodeException(ObjectValue(e, Type.getType(e::class.java)))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -262,7 +262,7 @@ object REFLECTION_EVAL : Eval {
|
||||
}
|
||||
|
||||
fun findInstanceField(obj: Any, fieldDesc: FieldDescription): Field {
|
||||
val _class = obj.javaClass
|
||||
val _class = obj::class.java
|
||||
val field = _class.findField(fieldDesc)
|
||||
assertNotNull("Field not found: $fieldDesc", field)
|
||||
return field!!
|
||||
@@ -287,7 +287,7 @@ object REFLECTION_EVAL : Eval {
|
||||
}
|
||||
}
|
||||
val obj = instance.obj().checkNull()
|
||||
val method = obj.javaClass.findMethod(methodDesc)
|
||||
val method = obj::class.java.findMethod(methodDesc)
|
||||
assertNotNull("Method not found: $methodDesc", method)
|
||||
val args = mapArguments(arguments, methodDesc.parameterTypes).toTypedArray()
|
||||
val result = mayThrow {method!!.invoke(obj, *args)}
|
||||
@@ -322,7 +322,7 @@ class ReflectionLookup(val classLoader: ClassLoader) {
|
||||
}
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
fun Class<Any>.findMethod(methodDesc: MethodDescription): Method? {
|
||||
fun Class<out Any>.findMethod(methodDesc: MethodDescription): Method? {
|
||||
for (declared in declaredMethods) {
|
||||
if (methodDesc.matches(declared)) return declared
|
||||
}
|
||||
@@ -369,7 +369,7 @@ fun MethodDescription.matches(method: Method): Boolean {
|
||||
}
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
fun Class<Any>.findField(fieldDesc: FieldDescription): Field? {
|
||||
fun Class<out Any>.findField(fieldDesc: FieldDescription): Field? {
|
||||
for (declared in declaredFields) {
|
||||
if (fieldDesc.matches(declared)) return declared
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ private fun buildTestCase(ownerClass: Class<TestData>,
|
||||
}
|
||||
catch (e: Throwable) {
|
||||
val cause = e.cause ?: e
|
||||
expected = ExceptionThrown(objectToValue(cause, Type.getType(cause.javaClass)) as ObjectValue, ExceptionThrown.ExceptionKind.FROM_EVALUATOR)
|
||||
expected = ExceptionThrown(objectToValue(cause, Type.getType(cause::class.java)) as ObjectValue, ExceptionThrown.ExceptionKind.FROM_EVALUATOR)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user