Class InsnUtils


  • public class InsnUtils
    extends java.lang.Object
    • Method Detail

      • formatOffset

        public static java.lang.String formatOffset​(int offset)
      • insnTypeToString

        public static java.lang.String insnTypeToString​(InsnType type)
      • indexToString

        public static java.lang.String indexToString​(java.lang.Object index)
      • getConstValueByArg

        public static java.lang.Object getConstValueByArg​(RootNode root,
                                                          InsnArg arg)
        Search constant assigned to provided arg.
        Returns:
        LiteralArg, String, ArgType or null
      • getConstValueByInsn

        @Nullable
        public static @Nullable java.lang.Object getConstValueByInsn​(RootNode root,
                                                                     InsnNode insn)
        Return constant value from insn or null if not constant.
        Returns:
        LiteralArg, String, ArgType or null
      • searchSingleReturnInsn

        @Nullable
        public static @Nullable InsnNode searchSingleReturnInsn​(MethodNode mth,
                                                                java.util.function.Predicate<InsnNode> test)
      • searchInsn

        @Nullable
        public static @Nullable InsnNode searchInsn​(MethodNode mth,
                                                    InsnType insnType,
                                                    java.util.function.Predicate<InsnNode> test)
        Search instruction of specific type and condition in method. This method support inlined instructions.
      • replaceInsns

        public static void replaceInsns​(MethodNode mth,
                                        java.util.function.Function<InsnNode,​InsnNode> replaceFunction)
      • getSingleArg

        @Nullable
        public static @Nullable InsnArg getSingleArg​(InsnNode insn)
      • checkInsnType

        @Nullable
        public static @Nullable InsnNode checkInsnType​(@Nullable
                                                       @Nullable InsnNode insn,
                                                       InsnType insnType)
      • isInsnType

        public static boolean isInsnType​(@Nullable
                                         @Nullable InsnNode insn,
                                         InsnType insnType)
      • getWrappedInsn

        @Nullable
        public static @Nullable InsnNode getWrappedInsn​(InsnArg arg)
      • isWrapped

        public static boolean isWrapped​(InsnArg arg,
                                        InsnType insnType)
      • dontGenerateIfNotUsed

        public static boolean dontGenerateIfNotUsed​(InsnNode insn)
      • containsVar

        public static <T extends InsnArg> boolean containsVar​(java.util.List<T> list,
                                                              RegisterArg arg)
      • contains

        public static boolean contains​(InsnNode insn,
                                       AFlag flag)