|
|
@ -1,4 +1,4 @@ |
|
|
|
/* MethodType Copyright (C) 1997-1998 Jochen Hoenicke. |
|
|
|
/* MethodType Copyright (C) 1998-1999 Jochen Hoenicke. |
|
|
|
* |
|
|
|
* |
|
|
|
* This program is free software; you can redistribute it and/or modify |
|
|
|
* This program is free software; you can redistribute it and/or modify |
|
|
|
* it under the terms of the GNU General Public License as published by |
|
|
|
* it under the terms of the GNU General Public License as published by |
|
|
@ -16,6 +16,7 @@ |
|
|
|
* |
|
|
|
* |
|
|
|
* $Id$ |
|
|
|
* $Id$ |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
package jode; |
|
|
|
package jode; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -23,14 +24,13 @@ package jode; |
|
|
|
* |
|
|
|
* |
|
|
|
* @author Jochen Hoenicke |
|
|
|
* @author Jochen Hoenicke |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public class MethodType { |
|
|
|
public class MethodType extends Type { |
|
|
|
final String signature; |
|
|
|
final String signature; |
|
|
|
final Type[] parameterTypes; |
|
|
|
final Type[] parameterTypes; |
|
|
|
final Type returnType; |
|
|
|
final Type returnType; |
|
|
|
final boolean staticFlag; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public MethodType(boolean isStatic, String signature) { |
|
|
|
public MethodType(String signature) { |
|
|
|
this.staticFlag = isStatic; |
|
|
|
super(TC_METHOD); |
|
|
|
this.signature = signature; |
|
|
|
this.signature = signature; |
|
|
|
int index = 1, types = 0; |
|
|
|
int index = 1, types = 0; |
|
|
|
while (signature.charAt(index) != ')') { |
|
|
|
while (signature.charAt(index) != ')') { |
|
|
@ -58,8 +58,11 @@ public class MethodType { |
|
|
|
returnType = Type.tType(signature.substring(index+1)); |
|
|
|
returnType = Type.tType(signature.substring(index+1)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public boolean isStatic() { |
|
|
|
public final int stackSize() { |
|
|
|
return staticFlag; |
|
|
|
int size = returnType.stackSize(); |
|
|
|
|
|
|
|
for (int i=0; i<parameterTypes.length; i++) |
|
|
|
|
|
|
|
size -= parameterTypes[i].stackSize(); |
|
|
|
|
|
|
|
return size; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public Type[] getParameterTypes() { |
|
|
|
public Type[] getParameterTypes() { |
|
|
@ -81,7 +84,6 @@ public class MethodType { |
|
|
|
public boolean equals(Object o) { |
|
|
|
public boolean equals(Object o) { |
|
|
|
MethodType mt; |
|
|
|
MethodType mt; |
|
|
|
return (o instanceof MethodType |
|
|
|
return (o instanceof MethodType |
|
|
|
&& signature.equals((mt = (MethodType)o).signature) |
|
|
|
&& signature.equals((mt = (MethodType)o).signature)); |
|
|
|
&& staticFlag == mt.staticFlag); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|