Пример #1
0
 public static String getSignature(IMethodBinding binding) {
   StringBuilder sb = new StringBuilder("(");
   appendParametersSignature(binding, sb);
   sb.append(')');
   appendReturnTypeSignature(binding, sb);
   return sb.toString();
 }
Пример #2
0
  /**
   * Get a method's signature for dead code elimination purposes.
   *
   * <p>Since DeadCodeEliminator runs before InnerClassExtractor, inner class constructors do not
   * yet have the parameter for capturing outer class, and therefore we need this special case.
   */
  public static String getProGuardSignature(IMethodBinding binding) {
    StringBuilder sb = new StringBuilder("(");

    // If the method is an inner class constructor, prepend the outer class type.
    if (binding.isConstructor()) {
      ITypeBinding declClass = binding.getDeclaringClass();
      ITypeBinding outerClass = declClass.getDeclaringClass();
      if (outerClass != null
          && !declClass.isInterface()
          && !declClass.isAnnotation()
          && !Modifier.isStatic(declClass.getModifiers())) {
        appendParameterSignature(outerClass.getErasure(), sb);
      }
    }

    appendParametersSignature(binding, sb);
    sb.append(')');
    appendReturnTypeSignature(binding, sb);
    return sb.toString();
  }