getMethod / getField

git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@259 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 26 years ago
parent 7080788ef4
commit d55fadbcc6
  1. 23
      jode/jode/decompiler/ClassAnalyzer.java

@ -26,7 +26,7 @@ import jode.bytecode.ConstantPool;
import jode.bytecode.ClassFormatException;
import jode.expr.Expression;
import jode.flow.TransformConstructors;
import java.util.NoSuchElementException;
import java.lang.reflect.Modifier;
public class ClassAnalyzer implements Analyzer {
@ -48,15 +48,24 @@ public class ClassAnalyzer implements Analyzer {
this.env = env;
}
public boolean setFieldInitializer(String fieldName, Type fieldType,
Expression expr) {
public FieldAnalyzer getField(String fieldName, Type fieldType) {
for (int i=0; i< fields.length; i++) {
if (fields[i].getName().equals(fieldName)
&& fields[i].getType().isOfType(fieldType))
return fields[i].setInitializer(expr);
&& fields[i].getType().equals(fieldType))
return fields[i];
}
throw new NoSuchElementException
("Field "+fieldType+" "+clazz.getName()+"."+fieldName);
}
public MethodAnalyzer getMethod(String methodName, MethodType methodType) {
for (int i=0; i< methods.length; i++) {
if (methods[i].getName().equals(methodName)
&& methods[i].getType().equals(methodType))
return methods[i];
}
System.err.println("Can't find field "+fieldType+" "+fieldName+".");
return false;
throw new NoSuchElementException
("Method "+methodType+" "+clazz.getName()+"."+methodName);
}
public ClassInfo getClazz() {

Loading…
Cancel
Save