ref.getClazz is now type sig

git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@580 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 26 years ago
parent 3ca944a9d5
commit 5c6b8a7eb5
  1. 7
      jode/jode/expr/PutFieldOperator.java
  2. 14
      jode/jode/jvm/SimpleRuntimeEnvironment.java

@ -35,7 +35,7 @@ public class PutFieldOperator extends StoreInstruction {
this.codeAnalyzer = codeAnalyzer;
this.staticFlag = staticFlag;
this.ref = ref;
this.classType = Type.tClass(ref.getClazz());
this.classType = Type.tType(ref.getClazz());
if (staticFlag)
classType.useType();
}
@ -50,8 +50,7 @@ public class PutFieldOperator extends StoreInstruction {
* allow super class
*/
public boolean isThis() {
return (classType.equals(Type.tClass(codeAnalyzer.getClazz().
getName())));
return (classType.equals(Type.tClass(codeAnalyzer.getClazz())));
}
public FieldAnalyzer getField() {
@ -92,7 +91,7 @@ public class PutFieldOperator extends StoreInstruction {
public String getLValueString(String[] operands) {
String fieldName = getFieldName();
return staticFlag
? (classType.equals(Type.tClass(codeAnalyzer.getClazz().getName()))
? (classType.equals(Type.tClass(codeAnalyzer.getClazz()))
&& codeAnalyzer.findLocal(fieldName) == null
? fieldName
: classType.toString() + "." + fieldName)

@ -24,11 +24,17 @@ import java.lang.reflect.*;
public class SimpleRuntimeEnvironment implements RuntimeEnvironment {
public Class findClazz(String clName) throws ClassNotFoundException {
if (clName.charAt(0) == 'L')
clName = clName.substring(1, clName.length()-1);
return Class.forName(clName.replace('/','.'));
}
public Object getField(Reference ref, Object obj)
throws InterpreterException {
Field f;
try {
Class clazz = Class.forName(ref.getClazz());
Class clazz = findClazz(ref.getClazz());
try {
f = clazz.getField(ref.getName());
} catch (NoSuchFieldException ex) {
@ -55,7 +61,7 @@ public class SimpleRuntimeEnvironment implements RuntimeEnvironment {
throws InterpreterException {
Field f;
try {
Class clazz = Class.forName(ref.getClazz());
Class clazz = findClazz(ref.getClazz());
try {
f = clazz.getField(ref.getName());
} catch (NoSuchFieldException ex) {
@ -83,7 +89,7 @@ public class SimpleRuntimeEnvironment implements RuntimeEnvironment {
throws InterpreterException, InvocationTargetException {
Constructor c;
try {
Class clazz = Class.forName(ref.getClazz());
Class clazz = findClazz(ref.getClazz());
MethodType mt = (MethodType) Type.tType(ref.getType());
Class[] paramTypes = mt.getParameterClasses();
try {
@ -122,7 +128,7 @@ public class SimpleRuntimeEnvironment implements RuntimeEnvironment {
("Can't invoke nonvirtual Method " + ref + ".");
MethodType mt = (MethodType) Type.tType(ref.getType());
try {
Class clazz = Class.forName(ref.getClazz());
Class clazz = findClazz(ref.getClazz());
Class[] paramTypes = mt.getParameterClasses();
try {
m = clazz.getMethod(ref.getName(), paramTypes);

Loading…
Cancel
Save