private static Type parseType(String sig, Cursor c) throws BadBytecode { Type t = parseObjectType(sig, c, true); if (t == null) t = new BaseType(sig.charAt(c.position++)); return t; }
private static Type parseType(String sig, Cursor c) throws BadBytecode { Type t = parseObjectType(sig, c, true); if (t == null) t = new BaseType(sig.charAt(c.position++)); return t; }
private static TypeParameter[] parseTypeParams(String sig, Cursor cur) throws BadBytecode { ArrayList typeParam = new ArrayList(); if (sig.charAt(cur.position) == '<') { cur.position++; while (sig.charAt(cur.position) != '>') { int nameBegin = cur.position; int nameEnd = cur.indexOf(sig, ':'); ObjectType classBound = parseObjectType(sig, cur, true); ArrayList ifBound = new ArrayList(); while (sig.charAt(cur.position) == ':') { cur.position++; ObjectType t = parseObjectType(sig, cur, false); ifBound.add(t); } TypeParameter p = new TypeParameter(sig, nameBegin, nameEnd, classBound, (ObjectType[])ifBound.toArray(new ObjectType[ifBound.size()])); typeParam.add(p); } cur.position++; } return (TypeParameter[])typeParam.toArray(new TypeParameter[typeParam.size()]); }
private static TypeArgument[] parseTypeArgs(String sig, Cursor c) throws BadBytecode { ArrayList args = new ArrayList(); char t; while ((t = sig.charAt(c.position++)) != '>') { TypeArgument ta; if (t == '*' ) ta = new TypeArgument(null, '*'); else { if (t != '+' && t != '-') { t = ' '; c.position--; } ta = new TypeArgument(parseObjectType(sig, c, false), t); } args.add(ta); } return (TypeArgument[])args.toArray(new TypeArgument[args.size()]); }
private static TypeParameter[] parseTypeParams(String sig, Cursor cur) throws BadBytecode { List<TypeParameter> typeParam = new ArrayList<TypeParameter>(); if (sig.charAt(cur.position) == '<') { cur.position++; while (sig.charAt(cur.position) != '>') { int nameBegin = cur.position; int nameEnd = cur.indexOf(sig, ':'); ObjectType classBound = parseObjectType(sig, cur, true); List<ObjectType> ifBound = new ArrayList<ObjectType>(); while (sig.charAt(cur.position) == ':') { cur.position++; ObjectType t = parseObjectType(sig, cur, false); ifBound.add(t); } TypeParameter p = new TypeParameter(sig, nameBegin, nameEnd, classBound, ifBound.toArray(new ObjectType[ifBound.size()])); typeParam.add(p); } cur.position++; } return typeParam.toArray(new TypeParameter[typeParam.size()]); }
/** * Parses the given signature string as a field type signature. * * @param sig the signature string obtained from the <code>SignatureAttribute</code> * of a <code>FieldInfo</code>. * @return the field type signature. * @throws BadBytecode thrown when a syntactical error is found. * @see #getSignature() * @since 3.5 */ public static ObjectType toFieldSignature(String sig) throws BadBytecode { try { return parseObjectType(sig, new Cursor(), false); } catch (IndexOutOfBoundsException e) { throw error(sig); } }
private static TypeArgument[] parseTypeArgs(String sig, Cursor c) throws BadBytecode { List<TypeArgument> args = new ArrayList<TypeArgument>(); char t; while ((t = sig.charAt(c.position++)) != '>') { TypeArgument ta; if (t == '*' ) ta = new TypeArgument(null, '*'); else { if (t != '+' && t != '-') { t = ' '; c.position--; } ta = new TypeArgument(parseObjectType(sig, c, false), t); } args.add(ta); } return args.toArray(new TypeArgument[args.size()]); }
private static MethodSignature parseMethodSig(String sig) throws BadBytecode { Cursor cur = new Cursor(); TypeParameter[] tp = parseTypeParams(sig, cur); if (sig.charAt(cur.position++) != '(') throw error(sig); ArrayList params = new ArrayList(); while (sig.charAt(cur.position) != ')') { Type t = parseType(sig, cur); params.add(t); } cur.position++; Type ret = parseType(sig, cur); int sigLen = sig.length(); ArrayList exceptions = new ArrayList(); while (cur.position < sigLen && sig.charAt(cur.position) == '^') { cur.position++; ObjectType t = parseObjectType(sig, cur, false); if (t instanceof ArrayType) throw error(sig); exceptions.add(t); } Type[] p = (Type[])params.toArray(new Type[params.size()]); ObjectType[] ex = (ObjectType[])exceptions.toArray(new ObjectType[exceptions.size()]); return new MethodSignature(tp, p, ret, ex); }
/** * Parses the given signature string as a field type signature. * * @param sig the signature string obtained from the <code>SignatureAttribute</code> * of a <code>FieldInfo</code>. * @return the field type signature. * @throws BadBytecode thrown when a syntactical error is found. * @see #getSignature() * @since 3.5 */ public static ObjectType toFieldSignature(String sig) throws BadBytecode { try { return parseObjectType(sig, new Cursor(), false); } catch (IndexOutOfBoundsException e) { throw error(sig); } }
private static MethodSignature parseMethodSig(String sig) throws BadBytecode { Cursor cur = new Cursor(); TypeParameter[] tp = parseTypeParams(sig, cur); if (sig.charAt(cur.position++) != '(') throw error(sig); List<Type> params = new ArrayList<Type>(); while (sig.charAt(cur.position) != ')') { Type t = parseType(sig, cur); params.add(t); } cur.position++; Type ret = parseType(sig, cur); int sigLen = sig.length(); List<ObjectType> exceptions = new ArrayList<ObjectType>(); while (cur.position < sigLen && sig.charAt(cur.position) == '^') { cur.position++; ObjectType t = parseObjectType(sig, cur, false); if (t instanceof ArrayType) throw error(sig); exceptions.add(t); } Type[] p = params.toArray(new Type[params.size()]); ObjectType[] ex = exceptions.toArray(new ObjectType[exceptions.size()]); return new MethodSignature(tp, p, ret, ex); }
private static Type parseType(String sig, Cursor c) throws BadBytecode { Type t = parseObjectType(sig, c, true); if (t == null) t = new BaseType(sig.charAt(c.position++)); return t; }
private static Type parseType(String sig, Cursor c) throws BadBytecode { Type t = parseObjectType(sig, c, true); if (t == null) t = new BaseType(sig.charAt(c.position++)); return t; }
private static Type parseType(String sig, Cursor c) throws BadBytecode { Type t = parseObjectType(sig, c, true); if (t == null) t = new BaseType(sig.charAt(c.position++)); return t; }
private static Type parseType(String sig, Cursor c) throws BadBytecode { Type t = parseObjectType(sig, c, true); if (t == null) t = new BaseType(sig.charAt(c.position++)); return t; }
private static Type parseType(String sig, Cursor c) throws BadBytecode { Type t = parseObjectType(sig, c, true); if (t == null) t = new BaseType(sig.charAt(c.position++)); return t; }
private static TypeArgument[] parseTypeArgs(String sig, Cursor c) throws BadBytecode { ArrayList args = new ArrayList(); char t; while ((t = sig.charAt(c.position++)) != '>') { TypeArgument ta; if (t == '*' ) ta = new TypeArgument(null, '*'); else { if (t != '+' && t != '-') { t = ' '; c.position--; } ta = new TypeArgument(parseObjectType(sig, c, false), t); } args.add(ta); } return (TypeArgument[])args.toArray(new TypeArgument[args.size()]); }
private static TypeArgument[] parseTypeArgs(String sig, Cursor c) throws BadBytecode { ArrayList args = new ArrayList(); char t; while ((t = sig.charAt(c.position++)) != '>') { TypeArgument ta; if (t == '*' ) ta = new TypeArgument(null, '*'); else { if (t != '+' && t != '-') { t = ' '; c.position--; } ta = new TypeArgument(parseObjectType(sig, c, false), t); } args.add(ta); } return (TypeArgument[])args.toArray(new TypeArgument[args.size()]); }
/** * Parses the given signature string as a field type signature. * * @param sig the signature string obtained from the <code>SignatureAttribute</code> * of a <code>FieldInfo</code>. * @return the field type signature. * @throws BadBytecode thrown when a syntactical error is found. * @see #getSignature() * @since 3.5 */ public static ObjectType toFieldSignature(String sig) throws BadBytecode { try { return parseObjectType(sig, new Cursor(), false); } catch (IndexOutOfBoundsException e) { throw error(sig); } }
/** * Parses the given signature string as a field type signature. * * @param sig the signature string. * @return the field type signature. * @throws BadBytecode thrown when a syntactical error is found. * @since 3.5 */ public static ObjectType toFieldSignature(String sig) throws BadBytecode { try { return parseObjectType(sig, new Cursor(), false); } catch (IndexOutOfBoundsException e) { throw error(sig); } }
/** * Parses the given signature string as a field type signature. * * @param sig the signature string. * @return the field type signature. * @throws BadBytecode thrown when a syntactical error is found. * @since 3.5 */ public static ObjectType toFieldSignature(String sig) throws BadBytecode { try { return parseObjectType(sig, new Cursor(), false); } catch (IndexOutOfBoundsException e) { throw error(sig); } }