类 ConfigurationLogger

  • 所有已实现的接口:
    java.lang.Runnable

    public class ConfigurationLogger
    extends java.lang.Object
    implements java.lang.Runnable
    This class can be injected in applications to log information about reflection being used in the application code, and suggest appropriate ProGuard rules for keeping the reflected classes, methods and/or fields.
    • 方法概要

      所有方法 静态方法 实例方法 具体方法 
      修饰符和类型 方法 说明
      static void checkClass​(java.lang.String reflectionClassName, java.lang.String reflectionMethodName, java.lang.String reflectedClassName, java.lang.String callingClassName)
      Check if a class that is loaded via reflection is kept and if not, log a keep rule suggestion for it.
      static void checkForName​(java.lang.String reflectedClassName, java.lang.String callingClassName)
      Check if a class that is loaded via Class.forName() is kept and if not, log a keep rule suggestion for it.
      static void checkGetConstructor​(java.lang.Class reflectedClass, java.lang.Class[] constructorParameters, java.lang.String callingClassName)
      Check if a constructor that is retrieved via Class.getConstructor() is kept and if not, log a keep rule suggestion for it.
      static void checkGetConstructor​(java.lang.String reflectionMethodName, java.lang.Class reflectedClass, java.lang.Class[] constructorParameters, java.lang.String callingClassName)
      Check if a constructor that is retrieved via reflection is kept and if not, log a keep rule suggestion for it.
      static void checkGetConstructors​(java.lang.Class reflectedClass, java.lang.String callingClassName)
      Check if the constructors of a class on which getConstructors() is called are all kept and if not, log a keep rule suggestion for it.
      static void checkGetDeclaredConstructor​(java.lang.Class reflectedClass, java.lang.Class[] constructorParameters, java.lang.String callingClassName)
      Check if a constructor that is retrieved via Class.getDeclaredConstructor() is kept and if not, log a keep rule suggestion for it.
      static void checkGetDeclaredConstructors​(java.lang.Class reflectedClass, java.lang.String callingClassName)
      Check if the constructors of a class on which getDeclaredConstructors() is called are all kept and if not, log a keep rule suggestion for it.
      static void checkGetDeclaredField​(java.lang.Class reflectedClass, java.lang.String reflectedFieldName, java.lang.String callingClassName)
      Check if a field that is retrieved via Class.getDeclaredField() is kept and if not, log a keep rule suggestion for it.
      static void checkGetDeclaredFields​(java.lang.Class reflectedClass, java.lang.String callingClassName)
      Check if the fields of a class whose fields are retrieved via Class.getDeclaredFields() are all kept and if not, log a keep rule suggestion for it.
      static void checkGetDeclaredMethod​(java.lang.Class reflectedClass, java.lang.String reflectedMethodName, java.lang.Class[] reflectedMethodParameters, java.lang.String callingClassName)
      Check if a method that is retrieved via Class.getDeclaredMethod() is kept and if not, log a keep rule suggestion for it.
      static void checkGetDeclaredMethods​(java.lang.Class reflectedClass, java.lang.String callingClassName)
      Check if the methods of a class on which getDeclaredMethods() is called are all kept and if not, log a keep rule suggestion for it.
      static void checkGetField​(java.lang.Class reflectedClass, java.lang.String reflectedFieldName, java.lang.String callingClassName)
      Check if a field that is retrieved via Class.getField() is kept and if not, log a keep rule suggestion for it.
      static void checkGetFields​(java.lang.Class reflectedClass, java.lang.String callingClassName)
      Check if the fields of a class whose fields are retrieved via Class.getFields() are all kept and if not, log a keep rule suggestion for it.
      static void checkGetMethod​(java.lang.Class reflectedClass, java.lang.String reflectedMethodName, java.lang.Class[] reflectedMethodParameters, java.lang.String callingClassName)
      Check if a method that is retrieved via Class.getMethod() is kept and if not, log a keep rule suggestion for it.
      static void checkGetMethods​(java.lang.Class reflectedClass, java.lang.String callingClassName)
      Check if the methods of a class on which getMethods() is called are all kept and if not, log a keep rule suggestion for it.
      static void checkLoadClass​(java.lang.String reflectedClassName, java.lang.String callingClassName)
      Check if a class that is loaded via ClassLoader.loadClass() is kept and if not, log a keep rule suggestion for it.
      static void loadClassMap​(java.io.InputStream inputStream, java.util.Map<java.lang.String,​ConfigurationLogger.ClassInfo> map)
      Load a classmap.txt file into a map.
      void run()  
      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 字段详细资料

      • CLASS_MAP_FILENAME

        public static final java.lang.String CLASS_MAP_FILENAME
        另请参阅:
        常量字段值
      • CLASS_KEPT

        public static final int CLASS_KEPT
        另请参阅:
        常量字段值
      • ALL_DECLARED_CONSTRUCTORS_KEPT

        public static final int ALL_DECLARED_CONSTRUCTORS_KEPT
        另请参阅:
        常量字段值
      • ALL_PUBLIC_CONSTRUCTORS_KEPT

        public static final int ALL_PUBLIC_CONSTRUCTORS_KEPT
        另请参阅:
        常量字段值
      • ALL_DECLARED_FIELDS_KEPT

        public static final int ALL_DECLARED_FIELDS_KEPT
        另请参阅:
        常量字段值
      • ALL_PUBLIC_FIELDS_KEPT

        public static final int ALL_PUBLIC_FIELDS_KEPT
        另请参阅:
        常量字段值
      • ALL_DECLARED_METHODS_KEPT

        public static final int ALL_DECLARED_METHODS_KEPT
        另请参阅:
        常量字段值
      • ALL_PUBLIC_METHODS_KEPT

        public static final int ALL_PUBLIC_METHODS_KEPT
        另请参阅:
        常量字段值
      • CLASS_SHRUNK

        public static final int CLASS_SHRUNK
        另请参阅:
        常量字段值
      • MEMBER_KEPT

        public static final int MEMBER_KEPT
        另请参阅:
        常量字段值
      • MEMBER_SHRUNK

        public static final int MEMBER_SHRUNK
        另请参阅:
        常量字段值
    • 构造器详细资料

      • ConfigurationLogger

        public ConfigurationLogger()
    • 方法详细资料

      • checkForName

        public static void checkForName​(java.lang.String reflectedClassName,
                                        java.lang.String callingClassName)
        Check if a class that is loaded via Class.forName() is kept and if not, log a keep rule suggestion for it.
        参数:
        reflectedClassName - the name of the class that is introspected.
        callingClassName - the class from which the reflection API is called.
      • checkLoadClass

        public static void checkLoadClass​(java.lang.String reflectedClassName,
                                          java.lang.String callingClassName)
        Check if a class that is loaded via ClassLoader.loadClass() is kept and if not, log a keep rule suggestion for it.
        参数:
        reflectedClassName - the name of the class that is introspected.
        callingClassName - the class from which the reflection API is called.
      • checkClass

        public static void checkClass​(java.lang.String reflectionClassName,
                                      java.lang.String reflectionMethodName,
                                      java.lang.String reflectedClassName,
                                      java.lang.String callingClassName)
        Check if a class that is loaded via reflection is kept and if not, log a keep rule suggestion for it.
        参数:
        reflectedClassName - the name of the class that is introspected.
        callingClassName - the class from which the reflection API is called.
      • checkGetField

        public static void checkGetField​(java.lang.Class reflectedClass,
                                         java.lang.String reflectedFieldName,
                                         java.lang.String callingClassName)
        Check if a field that is retrieved via Class.getField() is kept and if not, log a keep rule suggestion for it.
        参数:
        reflectedClass - the class that is introspected.
        reflectedFieldName - the field that is retrieved via reflection.
        callingClassName - the class from which the reflection API is called.
      • checkGetDeclaredField

        public static void checkGetDeclaredField​(java.lang.Class reflectedClass,
                                                 java.lang.String reflectedFieldName,
                                                 java.lang.String callingClassName)
        Check if a field that is retrieved via Class.getDeclaredField() is kept and if not, log a keep rule suggestion for it.
        参数:
        reflectedClass - the class that is introspected.
        reflectedFieldName - the field that is retrieved via reflection.
        callingClassName - the class from which the reflection API is called.
      • checkGetDeclaredFields

        public static void checkGetDeclaredFields​(java.lang.Class reflectedClass,
                                                  java.lang.String callingClassName)
        Check if the fields of a class whose fields are retrieved via Class.getDeclaredFields() are all kept and if not, log a keep rule suggestion for it.
        参数:
        callingClassName - the class from which the reflection API is called.
        reflectedClass - the class that is introspected.
      • checkGetFields

        public static void checkGetFields​(java.lang.Class reflectedClass,
                                          java.lang.String callingClassName)
        Check if the fields of a class whose fields are retrieved via Class.getFields() are all kept and if not, log a keep rule suggestion for it.
        参数:
        reflectedClass - the class that is introspected.
        callingClassName - the class from which the reflection API is called.
      • checkGetDeclaredConstructor

        public static void checkGetDeclaredConstructor​(java.lang.Class reflectedClass,
                                                       java.lang.Class[] constructorParameters,
                                                       java.lang.String callingClassName)
        Check if a constructor that is retrieved via Class.getDeclaredConstructor() is kept and if not, log a keep rule suggestion for it.
      • checkGetConstructor

        public static void checkGetConstructor​(java.lang.Class reflectedClass,
                                               java.lang.Class[] constructorParameters,
                                               java.lang.String callingClassName)
        Check if a constructor that is retrieved via Class.getConstructor() is kept and if not, log a keep rule suggestion for it.
      • checkGetConstructor

        public static void checkGetConstructor​(java.lang.String reflectionMethodName,
                                               java.lang.Class reflectedClass,
                                               java.lang.Class[] constructorParameters,
                                               java.lang.String callingClassName)
        Check if a constructor that is retrieved via reflection is kept and if not, log a keep rule suggestion for it.
      • checkGetDeclaredConstructors

        public static void checkGetDeclaredConstructors​(java.lang.Class reflectedClass,
                                                        java.lang.String callingClassName)
        Check if the constructors of a class on which getDeclaredConstructors() is called are all kept and if not, log a keep rule suggestion for it.
        参数:
        reflectedClass - the class that is introspected.
        callingClassName - the class from which the reflection API is called.
      • checkGetConstructors

        public static void checkGetConstructors​(java.lang.Class reflectedClass,
                                                java.lang.String callingClassName)
        Check if the constructors of a class on which getConstructors() is called are all kept and if not, log a keep rule suggestion for it.
        参数:
        reflectedClass - the class that is introspected.
        callingClassName - the class from which the reflection API is called.
      • checkGetDeclaredMethod

        public static void checkGetDeclaredMethod​(java.lang.Class reflectedClass,
                                                  java.lang.String reflectedMethodName,
                                                  java.lang.Class[] reflectedMethodParameters,
                                                  java.lang.String callingClassName)
        Check if a method that is retrieved via Class.getDeclaredMethod() is kept and if not, log a keep rule suggestion for it.
        参数:
        reflectedClass - the class that is introspected.
        reflectedMethodName - the method that is retrieved via reflection.
        reflectedMethodParameters - the parameters of the method that is retrieved via reflection.
        callingClassName - the class from which the reflection API is called.
      • checkGetMethod

        public static void checkGetMethod​(java.lang.Class reflectedClass,
                                          java.lang.String reflectedMethodName,
                                          java.lang.Class[] reflectedMethodParameters,
                                          java.lang.String callingClassName)
        Check if a method that is retrieved via Class.getMethod() is kept and if not, log a keep rule suggestion for it.
        参数:
        reflectedClass - the class that is introspected.
        reflectedMethodName - the method that is retrieved via reflection.
        reflectedMethodParameters - the parameters of the method that is retrieved via reflection.
        callingClassName - the class from which the reflection API is called.
      • checkGetDeclaredMethods

        public static void checkGetDeclaredMethods​(java.lang.Class reflectedClass,
                                                   java.lang.String callingClassName)
        Check if the methods of a class on which getDeclaredMethods() is called are all kept and if not, log a keep rule suggestion for it.
        参数:
        reflectedClass - the class that is introspected.
        callingClassName - the class from which the reflection API is called.
      • checkGetMethods

        public static void checkGetMethods​(java.lang.Class reflectedClass,
                                           java.lang.String callingClassName)
        Check if the methods of a class on which getMethods() is called are all kept and if not, log a keep rule suggestion for it.
        参数:
        reflectedClass - the class that is introspected.
        callingClassName - the class from which the reflection API is called.
      • run

        public void run()
        指定者:
        run 在接口中 java.lang.Runnable
      • loadClassMap

        public static void loadClassMap​(java.io.InputStream inputStream,
                                        java.util.Map<java.lang.String,​ConfigurationLogger.ClassInfo> map)
                                 throws java.io.IOException
        Load a classmap.txt file into a map.
        参数:
        inputStream - Input stream from which to read the info.
        map - The map to load the info into.
        抛出:
        java.io.IOException - If the input stream could not be read.