java.lang.Object
sootup.java.bytecode.frontend.conversion.AsmUtil

public final class AsmUtil extends Object
  • Field Details

  • Method Details

    • readClassName

      protected static Optional<String> readClassName(@NonNull Path classSource, @NonNull org.objectweb.asm.ClassVisitor classNode)
      Initializes a class node.
      Parameters:
      classSource - The source.
      classNode - The node to initialize
      Returns:
      the actual class signature found in the compilation unit
    • createClassSource

      public static SootClassSource createClassSource(@NonNull AnalysisInputLocation analysisInputLocation, @NonNull Path sourcePath, @NonNull ClassType classType, @NonNull org.objectweb.asm.tree.ClassNode classNode)
    • isDWord

      public static boolean isDWord(@NonNull Type type)
      Determines if a type is a dword type.
      Parameters:
      type - the type to check.
      Returns:
      true if its a dword type.
    • toQualifiedName

      public static String toQualifiedName(@NonNull String str)
      Converts an str class name to a fully qualified name.
      Parameters:
      str - str name.
      Returns:
      fully qualified name.
    • getFieldModifiers

      public static EnumSet<FieldModifier> getFieldModifiers(int access)
    • getModuleModifiers

      public static EnumSet<ModuleModifier> getModuleModifiers(int access)
    • asmIdToSignature

      public static @NonNull Collection<JavaClassType> asmIdToSignature(@Nullable Iterable<String> asmClassNames)
    • toJimpleClassType

      public static @NonNull JavaClassType toJimpleClassType(@NonNull String asmClassName)
    • toJimpleType

      public static @NonNull Type toJimpleType(@NonNull String desc)
    • arrayTypetoJimpleType

      public static @NonNull Type arrayTypetoJimpleType(@NonNull String desc)
    • toJimpleSignatureDesc

      public static @NonNull List<Type> toJimpleSignatureDesc(@NonNull String desc)
      Converts n types contained in desc to a list of Jimple Types
    • toString

      public static String toString(org.objectweb.asm.tree.AbstractInsnNode insn)
    • createAnnotationUsage

      public static AnnotationUsage createAnnotationUsage(org.objectweb.asm.tree.AnnotationNode annotationNode)
    • createAnnotationUsage

      public static Iterable<AnnotationUsage> createAnnotationUsage(List<? extends org.objectweb.asm.tree.AnnotationNode> invisibleParameterAnnotation)
    • convertAnnotationValue

      public static Object convertAnnotationValue(Object annotationValue)
    • getModuleDescriptor

      public static @NonNull org.objectweb.asm.tree.ClassNode getModuleDescriptor(Path moduleInfoFile)
    • primitiveTypeFromOpcode

      public static Type primitiveTypeFromOpcode(int op)
      Returns the primitive result type implied by a bytecode opcode, or UnknownType when the opcode does not carry type information (e.g. ALOAD, AALOAD, ASTORE).

      Covers:

      • var insns: ILOAD/ISTORE → int, LLOAD/LSTORE → long, FLOAD/FSTORE → float, DLOAD/DSTORE → double
      • arithmetic + negate (IADD–DNEG, opcodes 96–119): I/L/F/D in groups-of-4
      • shift + bitwise (ISHL–LXOR, opcodes 120–131): even → int, odd → long
      • comparison results (LCMP, FCMPL/G, DCMPL/G) → int
      • ARRAYLENGTH → int
      • primitive array loads: IALOAD → int, LALOAD → long, FALOAD → float, DALOAD → double, BALOAD → byte, CALOAD → char, SALOAD → short