+ public abstract class Body extends HasAttributes {
+ public abstract java.util.Hashtable getThrownExceptions();
+ public abstract void debugBodyToString(StringBuffer sb);
+ public Method getMethod() { return Method.this; }
+ public Body(int flags, ClassFile.AttrGen attrs) {
+ super(flags, attrs);
+ if ((flags & ~VALID_METHOD_FLAGS) != 0) throw new IllegalArgumentException("invalid flags");
+ }
+ public boolean isConcrete() { return !isAbstract() && !isNative() /*FIXME: !inAnInterface*/; }
+ public void toString(StringBuffer sb, String constructorName) {
+ int flags = getFlags();
+ sb.append(" ").append(ClassFile.flagsToString(flags,false));
+ sb.append(Method.this.toString());
+ java.util.Hashtable thrownExceptions = getThrownExceptions();
+ if (thrownExceptions.size() > 0) {
+ sb.append("throws");
+ for(java.util.Enumeration e = thrownExceptions.keys();e.hasMoreElements();)
+ sb.append(" ").append(((Type.Class)e.nextElement()).toString()).append(",");
+ sb.setLength(sb.length()-1);
+ sb.append(" ");
+ }
+ if ((flags & (NATIVE|ABSTRACT))==0) {
+ sb.append("{\n");
+ debugBodyToString(sb);
+ sb.append(" }\n");
+ } else {
+ sb.append(";");
+ }
+ }
+ }
+ public int hashCode() {
+ int h = returnType.hashCode() ^ name.hashCode() ^ getDeclaringClass().hashCode();
+ for(int i=0;i<argTypes.length;i++) h ^= argTypes[i].hashCode();
+ return h;
+ }
+ public boolean equals(Object o_) {
+ if(o_ == this) return true;
+ if(!(o_ instanceof Method)) return false;
+ Method o = (Method) o_;
+ if(!(o.getDeclaringClass() == getDeclaringClass() && o.returnType == returnType && o.name.equals(name))) return false;
+ if(o.argTypes.length != argTypes.length) return false;
+ for(int i=0;i<argTypes.length;i++)
+ if(o.argTypes[i] != argTypes[i]) return false;
+ return true;
+ }