JLCInfo getJLCInfo(String typeSystemKey) { // Check if already set. JLCInfo jlc = (JLCInfo) jlcInfoCache.get(typeSystemKey); if (jlc != null) { return jlc; } jlc = new JLCInfo(); jlcInfoCache.put(typeSystemKey, jlc); try { int mask = 0; for (int i = 0; i < fields.length; i++) { if (fields[i].name().equals("jlc$SourceLastModified$" + typeSystemKey)) { jlc.sourceLastModified = fields[i].getLong(); mask |= 1; } else if (fields[i].name().equals("jlc$CompilerVersion$" + typeSystemKey)) { jlc.compilerVersion = fields[i].getString(); mask |= 2; } else if (fields[i].name().equals("jlc$ClassType$" + typeSystemKey)) { // there is encoded class type information. StringBuffer encodedClassTypeInfo = new StringBuffer(fields[i].getString()); // check to see if there are more fields. int seeking = 1; boolean found; do { found = false; String suffix = ("$" + seeking); String seekingFieldName = "jlc$ClassType$" + typeSystemKey + suffix; for (int j = 0; j < fields.length; j++) { if (fields[j].name().equals(seekingFieldName)) { encodedClassTypeInfo.append(fields[j].getString()); found = true; seeking++; break; } } } while (found); jlc.encodedClassType = encodedClassTypeInfo.toString(); mask |= 4; } } if (mask != 7) { // Not all the information is there. Reset to default. jlc.sourceLastModified = 0; jlc.compilerVersion = null; jlc.encodedClassType = null; } } catch (SemanticException e) { jlc.sourceLastModified = 0; jlc.compilerVersion = null; jlc.encodedClassType = null; } return jlc; }
public String toString() { StringBuffer sb = new StringBuffer(baseType.toString()); sb.append("<"); for (Iterator it = typeArguments().iterator(); it.hasNext(); ) { sb.append(((Type) it.next())); if (it.hasNext()) { sb.append(", "); } } sb.append(">"); return sb.toString(); }
public String signature() { StringBuffer signature = new StringBuffer(); // no trailing ; for base type before the type args signature.append("L" + ((Named) baseType).fullName().replaceAll("\\.", "/") + "<"); for (Iterator it = typeArguments.iterator(); it.hasNext(); ) { SignatureType next = (SignatureType) it.next(); signature.append(next.signature()); if (it.hasNext()) { signature.append(","); } } signature.append(">;"); return signature.toString(); }