if (SootUtilities.derivesFrom(type.getSootClass(),
PtolemyUtilities.settableClass)) {
// If we are invoking a method on a
// variable class, then attempt to get the
// constant value of the variable.
Attribute attribute = (Attribute) namedObjAnalysis
.getObject((Local) r.getBase());
if (debug) {
System.out.println("Settable base = " + attribute);
}
// If the attribute resolves to null, then
// replace the invocation with an exception
// throw. It would be nice to do this, but
// some strange cases fail as a result, in
// particular, if you showName on a
// PortParameter it fails (!)
// if (attribute == null) {
// if (debug) System.out.println("replacing with NullPointerException!");
// Local exceptionLocal =
// SootUtilities.createRuntimeException(
// body, stmt,
// "NullPointerException: " + r);
// body.getUnits().swapWith(stmt,
// Jimple.v().newThrowStmt(
// exceptionLocal));
// continue;
// }
// Inline getType, setTypeEquals, etc...
if (attribute instanceof Typeable) {
if (PtolemyUtilities.inlineTypeableMethods(body,
stmt, box, r, (Typeable) attribute)) {
continue;
}
}
// Inline namedObj methods on the attribute.
if (r.getMethod().getSubSignature().equals(
PtolemyUtilities.getFullNameMethod
.getSubSignature())) {
box.setValue(StringConstant.v(attribute
.getFullName()));
continue;
}
if (r.getMethod().getSubSignature().equals(
PtolemyUtilities.getNameMethod
.getSubSignature())) {
box.setValue(StringConstant.v(attribute.getName()));
continue;
}
if (r instanceof SpecialInvokeExpr) {
continue;