/** * @param parameters the parameters for a descriptor * @param returnType the return type * @return the canonical representative for this descriptor value */ public static Descriptor findOrCreate(TypeName[] parameters, TypeName returnType) { if (returnType == null) { throw new IllegalArgumentException("null returnType"); } if (parameters != null && parameters.length == 0) { parameters = null; } Key k = new Key(returnType, parameters); Descriptor result = map.get(k); if (result == null) { result = new Descriptor(k); map.put(k, result); } return result; }
@Override public String toString() { StringBuilder result = new StringBuilder(); result.append('('); if (parameters != null) { for (TypeName p : parameters) { result.append(p); appendSemicolonIfNeeded(result, p); } } result.append(')'); result.append(returnType); appendSemicolonIfNeeded(result, returnType); return result.toString(); }
/** * @param parameters the parameters for a descriptor * @param returnType the return type * @return the canonical representative for this descriptor value */ public static Descriptor findOrCreate(TypeName[] parameters, TypeName returnType) { if (returnType == null) { throw new IllegalArgumentException("null returnType"); } if (parameters != null && parameters.length == 0) { parameters = null; } Key k = new Key(returnType, parameters); Descriptor result = map.get(k); if (result == null) { result = new Descriptor(k); map.put(k, result); } return result; }
@Override public String toString() { StringBuilder result = new StringBuilder(); result.append('('); if (parameters != null) { for (TypeName p : parameters) { result.append(p); appendSemicolonIfNeeded(result, p); } } result.append(')'); result.append(returnType); appendSemicolonIfNeeded(result, returnType); return result.toString(); }
/** * @param b a byte array holding the string representation of this descriptor * @return the canonical representative for this descriptor value */ public static Descriptor findOrCreate(Language l, ImmutableByteArray b) throws IllegalArgumentException { TypeName returnType = StringStuff.parseForReturnTypeName(l, b); TypeName[] parameters = StringStuff.parseForParameterNames(l, b); Key k = new Key(returnType, parameters); Descriptor result = map.get(k); if (result == null) { result = new Descriptor(k); map.put(k, result); } return result; }
/** * @param b a byte array holding the string representation of this descriptor * @return the canonical representative for this descriptor value */ public static Descriptor findOrCreate(Language l, ImmutableByteArray b) throws IllegalArgumentException { TypeName returnType = StringStuff.parseForReturnTypeName(l, b); TypeName[] parameters = StringStuff.parseForParameterNames(l, b); Key k = new Key(returnType, parameters); Descriptor result = map.get(k); if (result == null) { result = new Descriptor(k); map.put(k, result); } return result; }
public String toUnicodeString() { StringBuilder result = new StringBuilder(); result.append('('); if (parameters != null) { for (TypeName p : parameters) { result.append(p.toUnicodeString()); appendSemicolonIfNeeded(result, p); } } result.append(')'); result.append(returnType); appendSemicolonIfNeeded(result, returnType); return result.toString(); }
public String toUnicodeString() { StringBuilder result = new StringBuilder(); result.append('('); if (parameters != null) { for (TypeName p : parameters) { result.append(p.toUnicodeString()); appendSemicolonIfNeeded(result, p); } } result.append(')'); result.append(returnType); appendSemicolonIfNeeded(result, returnType); return result.toString(); }
@Override public String toString() { return key.toString(); }
@Override public int hashCode() { return key.hashCode(); }
@Override public int hashCode() { return key.hashCode(); }
@Override public String toString() { return key.toString(); }
/** * @return a unicode string representation of this descriptor */ public String toUnicodeString() { return key.toUnicodeString(); }
/** * @return a unicode string representation of this descriptor */ public String toUnicodeString() { return key.toUnicodeString(); }
Key(TypeName returnType, TypeName[] parameters) { this.returnType = returnType; this.parameters = parameters; if (parameters != null) { assert parameters.length > 0; } hashCode = computeHashCode(); }
Key(TypeName returnType, TypeName[] parameters) { this.returnType = returnType; this.parameters = parameters; if (parameters != null) { assert parameters.length > 0; } hashCode = computeHashCode(); }