Add missing public modifiers in project code
This commit is contained in:
@@ -32,25 +32,25 @@ import org.jetbrains.org.objectweb.asm.tree.IincInsnNode
|
||||
|
||||
class UnsupportedByteCodeException(message: String) : RuntimeException(message)
|
||||
|
||||
trait Eval {
|
||||
fun loadClass(classType: Type): Value
|
||||
fun loadString(str: String): Value
|
||||
fun newInstance(classType: Type): Value
|
||||
fun isInstanceOf(value: Value, targetType: Type): Boolean
|
||||
public trait Eval {
|
||||
public fun loadClass(classType: Type): Value
|
||||
public fun loadString(str: String): Value
|
||||
public fun newInstance(classType: Type): Value
|
||||
public fun isInstanceOf(value: Value, targetType: Type): Boolean
|
||||
|
||||
fun newArray(arrayType: Type, size: Int): Value
|
||||
fun newMultiDimensionalArray(arrayType: Type, dimensionSizes: List<Int>): Value
|
||||
fun getArrayLength(array: Value): Value
|
||||
fun getArrayElement(array: Value, index: Value): Value
|
||||
fun setArrayElement(array: Value, index: Value, newValue: Value)
|
||||
public fun newArray(arrayType: Type, size: Int): Value
|
||||
public fun newMultiDimensionalArray(arrayType: Type, dimensionSizes: List<Int>): Value
|
||||
public fun getArrayLength(array: Value): Value
|
||||
public fun getArrayElement(array: Value, index: Value): Value
|
||||
public fun setArrayElement(array: Value, index: Value, newValue: Value)
|
||||
|
||||
fun getStaticField(fieldDesc: FieldDescription): Value
|
||||
fun setStaticField(fieldDesc: FieldDescription, newValue: Value)
|
||||
fun invokeStaticMethod(methodDesc: MethodDescription, arguments: List<Value>): Value
|
||||
public fun getStaticField(fieldDesc: FieldDescription): Value
|
||||
public fun setStaticField(fieldDesc: FieldDescription, newValue: Value)
|
||||
public fun invokeStaticMethod(methodDesc: MethodDescription, arguments: List<Value>): Value
|
||||
|
||||
fun getField(instance: Value, fieldDesc: FieldDescription): Value
|
||||
fun setField(instance: Value, fieldDesc: FieldDescription, newValue: Value)
|
||||
fun invokeMethod(instance: Value, methodDesc: MethodDescription, arguments: List<Value>, invokespecial: Boolean = false): Value
|
||||
public fun getField(instance: Value, fieldDesc: FieldDescription): Value
|
||||
public fun setField(instance: Value, fieldDesc: FieldDescription, newValue: Value)
|
||||
public fun invokeMethod(instance: Value, methodDesc: MethodDescription, arguments: List<Value>, invokespecial: Boolean = false): Value
|
||||
}
|
||||
|
||||
class SingleInstructionInterpreter(private val eval: Eval) : Interpreter<Value>(ASM5) {
|
||||
|
||||
@@ -28,29 +28,29 @@ import org.jetbrains.org.objectweb.asm.tree.TryCatchBlockNode
|
||||
import java.util.ArrayList
|
||||
import org.jetbrains.eval4j.ExceptionThrown.ExceptionKind
|
||||
|
||||
trait InterpreterResult {
|
||||
public trait InterpreterResult {
|
||||
override fun toString(): String
|
||||
}
|
||||
|
||||
class ExceptionThrown(val exception: Value, val kind: ExceptionKind): InterpreterResult {
|
||||
public class ExceptionThrown(public val exception: Value, public val kind: ExceptionKind): InterpreterResult {
|
||||
override fun toString(): String = "Thrown $exception: $kind"
|
||||
|
||||
enum class ExceptionKind {
|
||||
public enum class ExceptionKind {
|
||||
FROM_EVALUATED_CODE
|
||||
FROM_EVALUATOR
|
||||
BROKEN_CODE
|
||||
}
|
||||
}
|
||||
|
||||
data class ValueReturned(val result: Value): InterpreterResult {
|
||||
public data class ValueReturned(public val result: Value): InterpreterResult {
|
||||
override fun toString(): String = "Returned $result"
|
||||
}
|
||||
|
||||
class AbnormalTermination(val message: String): InterpreterResult {
|
||||
public class AbnormalTermination(public val message: String): InterpreterResult {
|
||||
override fun toString(): String = "Terminated abnormally: $message"
|
||||
}
|
||||
|
||||
trait InterpretationEventHandler {
|
||||
public trait InterpretationEventHandler {
|
||||
|
||||
class object {
|
||||
object NONE : InterpretationEventHandler {
|
||||
@@ -78,7 +78,7 @@ class ThrownFromEvaluatedCodeException(val exception: Value): RuntimeException()
|
||||
override fun toString(): String = "Thrown from evaluated code: $exception"
|
||||
}
|
||||
|
||||
fun interpreterLoop(
|
||||
public fun interpreterLoop(
|
||||
m: MethodNode,
|
||||
initialState: Frame<Value>,
|
||||
eval: Eval,
|
||||
|
||||
@@ -27,7 +27,7 @@ import com.sun.jdi.Method
|
||||
val CLASS = Type.getType(javaClass<Class<*>>())
|
||||
val BOOTSTRAP_CLASS_DESCRIPTORS = setOf("Ljava/lang/String;", "Ljava/lang/ClassLoader;", "Ljava/lang/Class;")
|
||||
|
||||
class JDIEval(
|
||||
public class JDIEval(
|
||||
private val vm: jdi.VirtualMachine,
|
||||
private val classLoader: jdi.ClassLoaderReference,
|
||||
private val thread: jdi.ThreadReference,
|
||||
|
||||
@@ -23,7 +23,7 @@ import org.jetbrains.org.objectweb.asm.Type
|
||||
import org.jetbrains.org.objectweb.asm.Opcodes.*
|
||||
import com.sun.jdi
|
||||
|
||||
fun makeInitialFrame(methodNode: MethodNode, arguments: List<Value>): Frame<Value> {
|
||||
public fun makeInitialFrame(methodNode: MethodNode, arguments: List<Value>): Frame<Value> {
|
||||
val isStatic = (methodNode.access and ACC_STATIC) != 0
|
||||
|
||||
val params = Type.getArgumentTypes(methodNode.desc)
|
||||
@@ -51,7 +51,7 @@ class JDIFailureException(message: String?, cause: Throwable? = null): RuntimeEx
|
||||
|
||||
fun <T: Any> T?.sure(message: String? = null): T = this ?: throw JDIFailureException(message)
|
||||
|
||||
fun jdi.Value?.asValue(): Value {
|
||||
public fun jdi.Value?.asValue(): Value {
|
||||
return when (this) {
|
||||
null -> NULL_VALUE
|
||||
is jdi.VoidValue -> VOID_VALUE
|
||||
@@ -76,7 +76,7 @@ val Value.jdiObj: jdi.ObjectReference?
|
||||
val Value.jdiClass: jdi.ClassObjectReference?
|
||||
get() = this.jdiObj as jdi.ClassObjectReference?
|
||||
|
||||
fun Value.asJdiValue(vm: jdi.VirtualMachine, expectedType: Type): jdi.Value? {
|
||||
public fun Value.asJdiValue(vm: jdi.VirtualMachine, expectedType: Type): jdi.Value? {
|
||||
return when (this) {
|
||||
NULL_VALUE -> null
|
||||
VOID_VALUE -> vm.mirrorOfVoid()
|
||||
|
||||
@@ -53,7 +53,7 @@ val MethodDescription.parameterTypes: List<Type>
|
||||
get() = Type.getArgumentTypes(desc).toList()
|
||||
|
||||
|
||||
class FieldDescription(
|
||||
public class FieldDescription(
|
||||
ownerInternalName: String,
|
||||
name: String,
|
||||
desc: String,
|
||||
|
||||
@@ -19,9 +19,9 @@ package org.jetbrains.eval4j
|
||||
import org.jetbrains.org.objectweb.asm.Type
|
||||
import org.jetbrains.org.objectweb.asm.tree.LabelNode
|
||||
|
||||
trait Value : org.jetbrains.org.objectweb.asm.tree.analysis.Value {
|
||||
val asmType: Type
|
||||
val valid: Boolean
|
||||
public trait Value : org.jetbrains.org.objectweb.asm.tree.analysis.Value {
|
||||
public val asmType: Type
|
||||
public val valid: Boolean
|
||||
override fun getSize(): Int = asmType.getSize()
|
||||
|
||||
override fun toString(): String
|
||||
@@ -57,7 +57,7 @@ abstract class AbstractValueBase<V>(
|
||||
override val asmType: Type
|
||||
) : Value {
|
||||
override val valid = true
|
||||
abstract val value: V
|
||||
public abstract val value: V
|
||||
|
||||
override fun toString() = "$value: $asmType"
|
||||
|
||||
@@ -81,7 +81,7 @@ class IntValue(value: Int, asmType: Type): AbstractValue<Int>(value, asmType)
|
||||
class LongValue(value: Long): AbstractValue<Long>(value, Type.LONG_TYPE)
|
||||
class FloatValue(value: Float): AbstractValue<Float>(value, Type.FLOAT_TYPE)
|
||||
class DoubleValue(value: Double): AbstractValue<Double>(value, Type.DOUBLE_TYPE)
|
||||
class ObjectValue(value: Any?, asmType: Type): AbstractValue<Any?>(value, asmType)
|
||||
public class ObjectValue(value: Any?, asmType: Type): AbstractValue<Any?>(value, asmType)
|
||||
class NewObjectValue(asmType: Type): AbstractValueBase<Any?>(asmType) {
|
||||
override var value: Any? = null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user