|
|
@ -26,9 +26,14 @@ import java.lang.reflect.InvocationTargetException; |
|
|
|
* invoke methods, etc. <br> |
|
|
|
* invoke methods, etc. <br> |
|
|
|
* |
|
|
|
* |
|
|
|
* The objects used in this runtime environment need not to be of the |
|
|
|
* The objects used in this runtime environment need not to be of the |
|
|
|
* real class, but could also be of some wrapper class. The only |
|
|
|
* real type, but can be some other type of your choice. But some |
|
|
|
* exception are arrays, which must be arrays (but not necessarily of |
|
|
|
* mappings must be preserved, since they are used inside the |
|
|
|
* the real element type). <br> |
|
|
|
* Interpreter: |
|
|
|
|
|
|
|
* <ul> <li>boolean, byte, short, char and int are mapped to Integer. </li> |
|
|
|
|
|
|
|
* <li> float, long, double are mapped to Float, Long, Double resp. </li> |
|
|
|
|
|
|
|
* <li> array of primitive type is mapped to itself (not array of Integer)</li> |
|
|
|
|
|
|
|
* <li> array of other types are mapped to array of mapped other type </li> |
|
|
|
|
|
|
|
* </ul> |
|
|
|
* |
|
|
|
* |
|
|
|
* @author Jochen Hoenicke */ |
|
|
|
* @author Jochen Hoenicke */ |
|
|
|
public interface RuntimeEnvironment { |
|
|
|
public interface RuntimeEnvironment { |
|
|
@ -65,28 +70,52 @@ public interface RuntimeEnvironment { |
|
|
|
* @param isVirtual true, iff the call is virtual |
|
|
|
* @param isVirtual true, iff the call is virtual |
|
|
|
* @param cls the object on which the method should be called, null |
|
|
|
* @param cls the object on which the method should be called, null |
|
|
|
* if the method is static. |
|
|
|
* if the method is static. |
|
|
|
* @param params the params of the method. Primitive types are |
|
|
|
* @param params the params of the method. |
|
|
|
* wrapped to Object. |
|
|
|
* @return the return value of the method. Void type is ignored, |
|
|
|
* @return the return value of the method. Primitive types are |
|
|
|
* may be null. |
|
|
|
* wrapped to Object, void type is ignored, may be null. |
|
|
|
|
|
|
|
* @exception InterpreterException if the field does not exists, the |
|
|
|
* @exception InterpreterException if the field does not exists, the |
|
|
|
* object is not supported etc. */ |
|
|
|
* object is not supported etc. */ |
|
|
|
public Object invokeMethod(Reference methodRef, boolean isVirtual, |
|
|
|
public Object invokeMethod(Reference methodRef, boolean isVirtual, |
|
|
|
Object cls, Object[] params) |
|
|
|
Object cls, Object[] params) |
|
|
|
throws InterpreterException, InvocationTargetException; |
|
|
|
throws InterpreterException, InvocationTargetException; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Create a new instance of an object. |
|
|
|
|
|
|
|
* @param methodRef the reference of the constructor to invoke |
|
|
|
|
|
|
|
* @param params the params of the method. |
|
|
|
|
|
|
|
* @return the new object. |
|
|
|
|
|
|
|
*/ |
|
|
|
public Object invokeConstructor(Reference methodRef, Object[] params) |
|
|
|
public Object invokeConstructor(Reference methodRef, Object[] params) |
|
|
|
throws InterpreterException, InvocationTargetException; |
|
|
|
throws InterpreterException, InvocationTargetException; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Check if obj is an instance of className |
|
|
|
|
|
|
|
* @param className the type signature of the class. |
|
|
|
|
|
|
|
* @return true, if obj is an instance of className, false otherwise. |
|
|
|
|
|
|
|
*/ |
|
|
|
public boolean instanceOf(Object obj, String className) |
|
|
|
public boolean instanceOf(Object obj, String className) |
|
|
|
throws InterpreterException; |
|
|
|
throws InterpreterException; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Create a new multidimensional Array. |
|
|
|
|
|
|
|
* @param type the type of the elements. |
|
|
|
|
|
|
|
* @param dimensions the size in every dimension. |
|
|
|
|
|
|
|
* @return the new array (this must be an array, see class comment). |
|
|
|
|
|
|
|
*/ |
|
|
|
public Object newArray(String type, int[] dimensions) |
|
|
|
public Object newArray(String type, int[] dimensions) |
|
|
|
throws InterpreterException; |
|
|
|
throws InterpreterException; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Enter a monitor. |
|
|
|
|
|
|
|
* @param object the object whose monitor should be taken. |
|
|
|
|
|
|
|
*/ |
|
|
|
public void enterMonitor(Object obj) |
|
|
|
public void enterMonitor(Object obj) |
|
|
|
throws InterpreterException; |
|
|
|
throws InterpreterException; |
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Exit a monitor. |
|
|
|
|
|
|
|
* @param object the object whose monitor should be freed. |
|
|
|
|
|
|
|
*/ |
|
|
|
public void exitMonitor(Object obj) |
|
|
|
public void exitMonitor(Object obj) |
|
|
|
throws InterpreterException; |
|
|
|
throws InterpreterException; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|