public void implementsInterfaces(String names[]) { MethodDef def = new MethodDef(0, clazz.getFQN(), "<implements>", "()V"); for (String interfaceName : names) { interfaceName = Clazz.internalToFqn(interfaceName); for (Map.Entry<MethodDef, List<MethodDef>> entry : catalog .entrySet()) { String catalogClass = entry.getKey().clazz; List<MethodDef> references = entry.getValue(); if (catalogClass.equals(interfaceName)) { references.add(def); } } } }
MethodDef getMethodDef(int access, int methodRefPoolIndex) { Object o = pool[methodRefPoolIndex]; if (o != null && o instanceof Assoc) { Assoc assoc = (Assoc) o; if (assoc.tag == 10) { int string_index = intPool[assoc.a]; String className = (String) pool[string_index]; int name_and_type_index = assoc.b; Assoc name_and_type = (Assoc) pool[name_and_type_index]; if (name_and_type.tag == 12) { // Name and Type int name_index = name_and_type.a; int type_index = name_and_type.b; String method = (String) pool[name_index]; String descriptor = (String) pool[type_index]; return new MethodDef(access, className, method, descriptor); } else throw new IllegalArgumentException( "Invalid class file (or parsing is wrong), assoc is not type + name (12)"); } else throw new IllegalArgumentException( "Invalid class file (or parsing is wrong), Assoc is not method ref! (10)"); } else throw new IllegalArgumentException( "Invalid class file (or parsing is wrong), Not an assoc at a method ref"); }
String descriptor = pool[descriptor_index].toString(); if (cd != null) { MethodDef mdef = new MethodDef(access_flags, className, name, descriptor); last = mdef; cd.method(mdef);