}
Map map = new HashMap();
// Loop through all the fields and update the types.
for (Iterator fields = theClass.getFields().iterator(); fields
.hasNext();) {
SootField field = (SootField) fields.next();
if (debug) {
System.out.println("updating types for " + field);
}
Type baseType = field.getType();
RefType refType = PtolemyUtilities.getBaseTokenType(baseType);
if ((refType != null)
&& SootUtilities.derivesFrom(refType.getSootClass(),
PtolemyUtilities.tokenClass)) {
Type type = typeAnalysis.getSpecializedSootType(field);
if (debug) {
System.out.println("replacing with " + type);
}
field.setType(type);
// Update the type tag.
// FIXME: Correct?
ptolemy.data.type.Type specializedType = typeAnalysis
.getSpecializedType(field);
if ((specializedType != BaseType.UNKNOWN)
&& (specializedType != BaseType.GENERAL)
&& specializedType.isInstantiable()) {
if (debug) {
System.out.println("updating type tag of " + field
+ " to "
+ typeAnalysis.getSpecializedType(field));
}
field.removeTag("_CGType");
field.addTag(new TypeTag(typeAnalysis
.getSpecializedType(field)));
}
map.put(field, typeAnalysis.getSpecializedType(field));
}