private static final int NO_CODE = -1;
private static final int FINISHED = -2;
-
+
+ private final ClassFile owner;
private final CPGen cp;
private final String name;
private final Type ret;
// FIXME: attrs, body
}
- MethodGen(CPGen cp, DataInput in) throws IOException {
+ MethodGen(CPGen cp, DataInput in, ClassFile owner) throws IOException {
this.cp = cp;
+ this.owner = owner;
flags = in.readShort();
name = cp.getUtf8ByIndex(in.readShort());
String descriptor = cp.getUtf8ByIndex(in.readShort());
this.ret = ret;
this.args = args;
this.flags = flags;
+ this.owner = owner;
attrs = new ClassFile.AttrGen(cp);
codeAttrs = new ClassFile.AttrGen(cp);
cp.addUtf8(name);
- cp.addUtf8(getDescriptor());
+ cp.addUtf8(owner.getType().method(name, ret, args).getDescriptor());
if((owner.flags & ACC_INTERFACE) != 0 || (flags & (ACC_ABSTRACT|ACC_NATIVE)) != 0) size = capacity = -1;
maxLocals = Math.max(args.length + (flags&ACC_STATIC)==0 ? 1 : 0, 4);
}
- /** Returns the descriptor string for this method */
- public String getDescriptor() { return new MethodRef(null, name, ret, args).getDescriptor(); }
-
private class ExnTableEnt {
public int start;
public int end;
void dump(DataOutput o) throws IOException {
o.writeShort(flags);
o.writeShort(cp.getUtf8Index(name));
- o.writeShort(cp.getUtf8Index(getDescriptor()));
+ o.writeShort(cp.getUtf8Index(owner.getType().method(name, ret, args).getDescriptor()));
o.writeShort(attrs.size());
attrs.dump(o);
}