Пример #1
0
  @Override
  public boolean equals(Object o) {
    if (o == null) {
      return false;
    }
    if (o.getClass() != this.getClass()) {
      return false;
    }

    ExceptionObjectType other = (ExceptionObjectType) o;
    return getSignature().equals(other.getSignature()) && exceptionSet.equals(other.exceptionSet);
  }
Пример #2
0
  /**
   * Initialize object from an exception set.
   *
   * @param exceptionSet the exception set
   * @return a Type that is a supertype of all of the exceptions in the exception set
   */
  public static Type fromExceptionSet(ExceptionSet exceptionSet) throws ClassNotFoundException {
    Type commonSupertype = exceptionSet.getCommonSupertype();
    if (commonSupertype.getType() != Const.T_OBJECT) {
      return commonSupertype;
    }

    ObjectType exceptionSupertype = (ObjectType) commonSupertype;

    String className = exceptionSupertype.getClassName();
    if ("java.lang.Throwable".equals(className)) {
      return exceptionSupertype;
    }
    return new ExceptionObjectType(className, exceptionSet);
  }
Пример #3
0
 @Override
 public String toString() {
   StringBuilder buf = new StringBuilder();
   buf.append("<exception:");
   boolean first = true;
   for (ExceptionSet.ThrownExceptionIterator i = exceptionSet.iterator(); i.hasNext(); ) {
     if (first) {
       first = false;
     } else {
       buf.append(',');
     }
     buf.append(i.next().toString());
   }
   buf.append(">");
   return buf.toString();
 }