예제 #1
0
  /**
   * Constructs an instance.
   *
   * @param definingClass {@code non-null;} the type of the defining class
   * @param nat {@code non-null;} the name-and-type
   */
  /*package*/ CstBaseMethodRef(CstType definingClass, CstNat nat) {
    super(definingClass, nat);

    String descriptor = getNat().getDescriptor().getString();
    this.prototype = Prototype.intern(descriptor);
    this.instancePrototype = null;
  }
예제 #2
0
  /** {@inheritDoc} */
  @Override
  protected final int compareTo0(Constant other) {
    int cmp = super.compareTo0(other);

    if (cmp != 0) {
      return cmp;
    }

    CstBaseMethodRef otherMethod = (CstBaseMethodRef) other;
    return prototype.compareTo(otherMethod.prototype);
  }
예제 #3
0
 /**
  * Gets the prototype of this method as either a {@code static} or instance method. In the case of
  * a {@code static} method, this is the same as the raw prototype. In the case of an instance
  * method, this has an appropriately-typed {@code this} argument as the first one.
  *
  * @param isStatic whether the method should be considered static
  * @return {@code non-null;} the method prototype
  */
 public final Prototype getPrototype(boolean isStatic) {
   if (isStatic) {
     return prototype;
   } else {
     if (instancePrototype == null) {
       Type thisType = getDefiningClass().getClassType();
       instancePrototype = prototype.withFirstParameter(thisType);
     }
     return instancePrototype;
   }
 }
예제 #4
0
 /**
  * {@inheritDoc}
  *
  * <p>In this case, this method returns the <i>return type</i> of this method.
  *
  * @return {@code non-null;} the method's return type
  */
 public final Type getType() {
   return prototype.getReturnType();
 }