Program: 74458
Project: 74458
Buggy source:
/** 
 * Infer the type of the specified method.  The type of the object on which the method is evaluated should be the first argument.
 * @param methodName The method name.
 * @param argTypes An array of argument types.
 * @exception IllegalActionException If an evaluation error occurs.
 * @see ParseTreeEvaluator#_methodCall(String,Type[],Object[])
 */
protected Type _methodCall(String methodName,Type[] argTypes) throws IllegalActionException {
  CachedMethod cachedMethod=CachedMethod.findMethod(methodName,argTypes,CachedMethod.METHOD);
  if (cachedMethod.isValid()) {
    Type type=cachedMethod.getReturnType();
    return type;
  }
  if (argTypes[0] instanceof ObjectType) {
    Object object=((ObjectType)argTypes[0]).getValue();
    if (object != null) {
      if (object instanceof NamedObj) {
        Object result=((NamedObj)object).getAttribute(methodName);
        if (result == null && object instanceof Entity) {
          result=((Entity)object).getPort(methodName);
        }
        if (result == null && object instanceof CompositeEntity) {
          result=((CompositeEntity)object).getEntity(methodName);
          if (result == null) {
            result=((CompositeEntity)object).getRelation(methodName);
          }
        }
        if (result == null && object instanceof State) {
          NamedObj objectInRefinement=((State)object).getObjectInRefinement(methodName);
          if (objectInRefinement != null) {
            result=objectInRefinement;
          }
        }
        if (result != null) {
          if (result instanceof Variable) {
            return ((Variable)result).getType();
          }
 else {
            return new ObjectType(result,result.getClass());
          }
        }
      }
    }
    Class<?> valueClass=((ObjectType)argTypes[0]).getValueClass();
    Set<Class<?>> classes=new HashSet<Class<?>>();
    classes.add(valueClass);
    while (!classes.isEmpty()) {
      Iterator<Class<?>> iterator=classes.iterator();
      valueClass=iterator.next();
      iterator.remove();
      if (!Modifier.isPublic(valueClass.getModifiers())) {
        for (        Class<?> interf : valueClass.getInterfaces()) {
          classes.add(interf);
        }
        Class<?> superclass=valueClass.getSuperclass();
        if (superclass != null) {
          classes.add(superclass);
        }
      }
 else {
        Type result=_getMethodReturnType(valueClass,methodName,argTypes);
        if (result != null) {
          return result;
        }
      }
    }
  }
  StringBuffer buffer=new StringBuffer();
  for (int i=1; i < argTypes.length; i++) {
    if (i == 1) {
      buffer.append(argTypes[i].toString());
    }
 else {
      buffer.append("String_Node_Str" + argTypes[i].toString());
    }
  }
  throw new IllegalActionException("String_Node_Str" + argTypes[0] + "String_Node_Str"+ methodName+ "String_Node_Str"+ buffer+ "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Infer the type of the specified method.  The type of the object on which the method is evaluated should be the first argument.
 * @param methodName The method name.
 * @param argTypes An array of argument types.
 * @exception IllegalActionException If an evaluation error occurs.
 * @see ParseTreeEvaluator#_methodCall(String,Type[],Object[])
 */
protected Type _methodCall(String methodName,Type[] argTypes) throws IllegalActionException {
  CachedMethod cachedMethod=CachedMethod.findMethod(methodName,argTypes,CachedMethod.METHOD);
  if (cachedMethod.isValid()) {
    Type type=cachedMethod.getReturnType();
    return type;
  }
  if (argTypes[0] instanceof ObjectType) {
    Object object=((ObjectType)argTypes[0]).getValue();
    if (object != null) {
      if (object instanceof NamedObj) {
        Object result=((NamedObj)object).getAttribute(methodName);
        if (result == null && object instanceof Entity) {
          result=((Entity)object).getPort(methodName);
        }
        if (result == null && object instanceof CompositeEntity) {
          result=((CompositeEntity)object).getEntity(methodName);
          if (result == null) {
            result=((CompositeEntity)object).getRelation(methodName);
          }
        }
        if (result == null && object instanceof State) {
          NamedObj objectInRefinement=((State)object).getObjectInRefinement(methodName);
          if (objectInRefinement != null) {
            result=objectInRefinement;
          }
        }
        if (result != null) {
          if (result instanceof Variable) {
            return ((Variable)result).getType();
          }
 else {
            return new ObjectType(result,result.getClass());
          }
        }
      }
    }
    Class<?> valueClass=((ObjectType)argTypes[0]).getValueClass();
    if (valueClass != null) {
      Set<Class<?>> classes=new HashSet<Class<?>>();
      classes.add(valueClass);
      while (!classes.isEmpty()) {
        Iterator<Class<?>> iterator=classes.iterator();
        valueClass=iterator.next();
        iterator.remove();
        if (!Modifier.isPublic(valueClass.getModifiers())) {
          for (          Class<?> interf : valueClass.getInterfaces()) {
            classes.add(interf);
          }
          Class<?> superclass=valueClass.getSuperclass();
          if (superclass != null) {
            classes.add(superclass);
          }
        }
 else {
          Type result=_getMethodReturnType(valueClass,methodName,argTypes);
          if (result != null) {
            return result;
          }
        }
      }
    }
  }
  StringBuffer buffer=new StringBuffer();
  for (int i=1; i < argTypes.length; i++) {
    if (i == 1) {
      buffer.append(argTypes[i].toString());
    }
 else {
      buffer.append("String_Node_Str" + argTypes[i].toString());
    }
  }
  throw new IllegalActionException("String_Node_Str" + argTypes[0] + "String_Node_Str"+ methodName+ "String_Node_Str"+ buffer+ "String_Node_Str");
}