类 MethodSignature

java.lang.Object
proguard.classfile.Signature
proguard.classfile.MethodSignature
所有已实现的接口:
Comparable<Signature>, MethodInfo

public class MethodSignature extends Signature implements MethodInfo
Represents a Method signature containing a class, method and a descriptor.

In order to avoid a huge blow-up in memory consumption for analyses that rely heavily on method signatures, e.g. the creation of a call graph, this class provides the ability to cache signatures belonging to concrete Method objects. By using the corresponding computeIfAbsent(Clazz, Method) method, the amount of strings that need to be retained during runtime is reduced.

  • 字段详细资料

    • UNKNOWN

      public static final MethodSignature UNKNOWN
    • method

      @Nullable public final @Nullable String method
    • descriptor

      @Nullable public final @Nullable MethodDescriptor descriptor
  • 构造器详细资料

    • MethodSignature

      public MethodSignature(@Nullable @Nullable String internalClassName, @Nullable @Nullable String method, @Nullable @Nullable MethodDescriptor descriptor)
    • MethodSignature

      public MethodSignature(@Nullable @Nullable String internalClassName, @Nullable @Nullable String method, @Nullable @Nullable String descriptor)
    • MethodSignature

      public MethodSignature(@NotNull @NotNull Clazz clazz, @NotNull @NotNull Method method)
    • MethodSignature

      public MethodSignature(@NotNull @NotNull Clazz clazz)
    • MethodSignature

      public MethodSignature(@Nullable @Nullable String className)
  • 方法详细资料

    • getReferencedMethod

      public Method getReferencedMethod()
      Returns the Method reference that corresponds to the method represented by this MethodSignature or null if no reference is available (e.g. the methhod or its class were missing).
    • computeIfAbsent

      public static MethodSignature computeIfAbsent(Clazz clazz, Method method)
      Get the singleton MethodSignature object for this specific Method. If it is not yet available in the cache, it will be newly instantiated.
      参数:
      clazz - The class containing the target method
      method - The method whose signature is to be generated
      返回:
      The cached or newly generated MethodSignature object
    • isIncomplete

      public boolean isIncomplete()
      从类复制的说明: Signature
      Check if this signature is missing information.
      指定者:
      isIncomplete 在类中 Signature
    • calculateFqn

      protected String calculateFqn()
      指定者:
      calculateFqn 在类中 Signature
    • calculatePrettyFqn

      protected String calculatePrettyFqn()
      指定者:
      calculatePrettyFqn 在类中 Signature
    • clearCache

      public static void clearCache()
      Remove all currently cached MethodSignature objects from the cache, allowing them to be removed by the garbage collector.
    • matchesIgnoreNull

      public static boolean matchesIgnoreNull(MethodSignature signature, MethodSignature wildcard)
      Fuzzy check if two MethodSignature objects are equal. If any pattern field is null, its value in the matched object does not influence the check result, providing a way to create a wildcard MethodSignature that e.g. matches several methods of a class that have the same name but a different MethodDescriptor.
      参数:
      signature - The MethodSignature to be compared
      wildcard - The MethodSignature pattern to be matched against
      返回:
      true if the two objects match
    • matchesIgnoreNullAndDollar

      public static boolean matchesIgnoreNullAndDollar(MethodSignature signature, MethodSignature wildcard)
      Fuzzy check like matchesIgnoreNull(MethodSignature, MethodSignature) but allows dollar signs in type strings. Usually the notation for inner classes is com/example/Foo$Bar, but sometimes external systems call this class com/example/Foo/Bar. These two names correspond to the same class and thus should be treated as the same if they appear in a MethodSignature. If it is to be expected that this situation may occur, this method should be preferred over matchesIgnoreNull(MethodSignature, MethodSignature) to avoid false negatives.
      参数:
      signature - The MethodSignature to be compared
      wildcard - The MethodSignature pattern to be matched against
      返回:
      true if the two objects match
    • equals

      public boolean equals(Object o)
      覆盖:
      equals 在类中 Signature
    • getMethodName

      @Nullable public @Nullable String getMethodName()
      从接口复制的说明: MethodInfo
      Returns the method's name.
      指定者:
      getMethodName 在接口中 MethodInfo
    • getDescriptor

      @Nullable public @Nullable MethodDescriptor getDescriptor()
      从接口复制的说明: MethodInfo
      Returns the method's descriptor.
      指定者:
      getDescriptor 在接口中 MethodInfo