/** Given a type t, return the extended class name of its erasure in * external representation. */ public Name xClassName(Type t) { if (t.tag == CLASS) { return names.fromUtf(externalize(t.tsym.flatName())); } else if (t.tag == ARRAY) { return typeSig(types.erasure(t)); } else { throw new AssertionError("xClassName"); } }
/** Given a type t, return the extended class name of its erasure in * external representation. */ public Name xClassName(Type t) { if (t.tag == CLASS) { return names.fromUtf(externalize(t.tsym.flatName())); } else if (t.tag == ARRAY) { return typeSig(types.erasure(t)); } else { throw new AssertionError("xClassName"); } }
/** Convert (implicit) signature to type parameter. */ Type sigToTypeParam() { int start = sigp; while (signature[sigp] != ':') sigp++; Name name = names.fromUtf(signature, start, sigp - start); TypeVar tvar; if (sigEnterPhase) { tvar = new TypeVar(name, currentOwner); typevars.enter(tvar.tsym); } else { tvar = (TypeVar)findTypeVar(name); } List<Type> bounds = List.nil(); Type st = null; if (signature[sigp] == ':' && signature[sigp+1] == ':') { sigp++; st = syms.objectType; } while (signature[sigp] == ':') { sigp++; bounds = bounds.prepend(sigToType()); } if (!sigEnterPhase) { types.setBounds(tvar, bounds.reverse(), st); } return tvar; }
/** Convert (implicit) signature to type parameter. */ Type sigToTypeParam() { int start = sigp; while (signature[sigp] != ':') sigp++; Name name = names.fromUtf(signature, start, sigp - start); TypeVar tvar; if (sigEnterPhase) { tvar = new TypeVar(name, currentOwner, syms.botType); typevars.enter(tvar.tsym); } else { tvar = (TypeVar)findTypeVar(name); } List<Type> bounds = List.nil(); Type st = null; if (signature[sigp] == ':' && signature[sigp+1] == ':') { sigp++; st = syms.objectType; } while (signature[sigp] == ':') { sigp++; bounds = bounds.prepend(sigToType()); } if (!sigEnterPhase) { types.setBounds(tvar, bounds.reverse(), st); } return tvar; }
/** If name is an array type or class signature, return the * corresponding type; otherwise return a ClassSymbol with given name. */ Object readClassOrType(int i) { int index = poolIdx[i]; int len = getChar(index + 1); int start = index + 3; assert buf[start] == '[' || buf[start + len - 1] != ';'; // by the above assertion, the following test can be // simplified to (buf[start] == '[') return (buf[start] == '[' || buf[start + len - 1] == ';') ? (Object)sigToType(buf, start, len) : (Object)enterClass(names.fromUtf(internalize(buf, start, len))); }
/** If name is an array type or class signature, return the * corresponding type; otherwise return a ClassSymbol with given name. */ Object readClassOrType(int i) { int index = poolIdx[i]; int len = getChar(index + 1); int start = index + 3; assert buf[start] == '[' || buf[start + len - 1] != ';'; // by the above assertion, the following test can be // simplified to (buf[start] == '[') return (buf[start] == '[' || buf[start + len - 1] == ';') ? (Object)sigToType(buf, start, len) : (Object)enterClass(names.fromUtf(internalize(buf, start, len))); }
/** get the name for the bytes in cs[start..start+len-1]. * Assume that bytes are in utf8 format. */ public abstract Name fromUtf(byte[] cs, int start, int len);
public Name fromUtf(byte[] cs, int start, int len) { return table.fromUtf(cs, start, len); } }
public Name fromUtf(byte[] cs) { return table.fromUtf(cs); }
/** get the name for the bytes in cs[start..start+len-1]. * Assume that bytes are in utf8 format. */ public abstract Name fromUtf(byte[] cs, int start, int len);
public Name fromUtf(byte[] cs, int start, int len) { return table.fromUtf(cs, start, len); } }
/** Return the concatenation of this name and name `n'. */ public Name append(Name n) { int len = getByteLength(); byte[] bs = new byte[len + n.getByteLength()]; getBytes(bs, 0); n.getBytes(bs, len); return table.fromUtf(bs, 0, bs.length); }
public Name fromUtf(byte[] cs) { return table.fromUtf(cs); }
/** Returns the sub-name starting at position start, up to and * excluding position end. */ public Name subName(int start, int end) { if (end < start) end = start; return table.fromUtf(getByteArray(), getByteOffset() + start, end - start); }
/** Return the concatenation of this name, the given ASCII * character, and name `n'. */ public Name append(char c, Name n) { int len = getByteLength(); byte[] bs = new byte[len + 1 + n.getByteLength()]; getBytes(bs, 0); bs[len] = (byte) c; n.getBytes(bs, len+1); return table.fromUtf(bs, 0, bs.length); }
/** Return the concatenation of this name and name `n'. */ public Name append(Name n) { int len = getByteLength(); byte[] bs = new byte[len + n.getByteLength()]; getBytes(bs, 0); n.getBytes(bs, len); return table.fromUtf(bs, 0, bs.length); }
/** Returns the sub-name starting at position start, up to and * excluding position end. */ public Name subName(int start, int end) { if (end < start) end = start; return table.fromUtf(getByteArray(), getByteOffset() + start, end - start); }
/** Convert contents to name. */ public Name toName(Name.Table names) { return names.fromUtf(elems, 0, length); } }
/** Convert contents to name. */ public Name toName(Name.Table names) { return names.fromUtf(elems, 0, length); } }
/** Return the concatenation of this name, the given ASCII * character, and name `n'. */ public Name append(char c, Name n) { int len = getByteLength(); byte[] bs = new byte[len + 1 + n.getByteLength()]; getBytes(bs, 0); bs[len] = (byte) c; n.getBytes(bs, len+1); return table.fromUtf(bs, 0, bs.length); }