static int getReturnTypeSize(final String signature) { final int index = signature.lastIndexOf(')') + 1; return Type.size(getTypeSize(signature.substring(index))); }
/** @return size of field (1 or 2) */ protected int getFieldSize( final ConstantPoolGen cpg ) { return Type.size(Type.getTypeSize(getSignature(cpg))); }
static int getArgumentTypesSize( final String signature ) { int res = 0; int index; try { // Read all declarations between for `(' and `)' if (signature.charAt(0) != '(') { throw new ClassFormatException("Invalid method signature: " + signature); } index = 1; // current string position while (signature.charAt(index) != ')') { final int coded = getTypeSize(signature.substring(index)); res += size(coded); index += consumed(coded); } } catch (final StringIndexOutOfBoundsException e) { // Should never occur throw new ClassFormatException("Invalid method signature: " + signature, e); } return res; }
static int getTypeSize( final String signature ) throws StringIndexOutOfBoundsException { final byte type = Utility.typeOfSignature(signature); if (type <= Const.T_VOID) { return encode(BasicType.getType(type).getSize(), 1); } else if (type == Const.T_ARRAY) { int dim = 0; do { // Count dimensions dim++; } while (signature.charAt(dim) == '['); // Recurse, but just once, if the signature is ok final int consumed = consumed(getTypeSize(signature.substring(dim))); return encode(1, dim + consumed); } else { // type == T_REFERENCE final int index = signature.indexOf(';'); // Look for closing `;' if (index < 0) { throw new ClassFormatException("Invalid signature: " + signature); } return encode(1, index + 1); } }