Package soot.util.backend
Class ASMBackendUtils
- java.lang.Object
-
- soot.util.backend.ASMBackendUtils
-
public class ASMBackendUtils extends Object
Utility class for ASM-based back-ends.- Author:
- Tobias Hamann, Florian Kuebler, Dominik Helm, Lukas Sommer
-
-
Constructor Summary
Constructors Constructor Description ASMBackendUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanacceptsStringInitialValue(SootField field)Determine if the field accepts a string default value, this is only true for fields of type String or a sub-type of Stringstatic org.objectweb.asm.AttributecreateASMAttribute(Attribute attr)Create an ASM attribute from an Soot attributestatic ObjectgetDefaultValue(SootField field)Get default value of a field for constant poolstatic intsizeOfType(Type t)Get the size in words for a type.static Stringslashify(String s)Convert class identifiers and signatures by replacing dots by slashes.static StringtoTypeDesc(List<Type> parameterTypes, Type returnType)Compute type description for methods, comprising parameter types and return type.static StringtoTypeDesc(SootMethodRef m)Compute type description for methods, comprising parameter types and return type.static StringtoTypeDesc(Type type)Convert type to JVM style type descriptionstatic StringtranslateJavaVersion(int javaVersion)Translate internal numbering of java versions to real version for debug messages.
-
-
-
Method Detail
-
slashify
public static String slashify(String s)
Convert class identifiers and signatures by replacing dots by slashes.- Parameters:
s- String to convert- Returns:
- Converted identifier
-
toTypeDesc
public static String toTypeDesc(SootMethodRef m)
Compute type description for methods, comprising parameter types and return type.- Parameters:
m- Method to determine type description- Returns:
- Method type description
-
toTypeDesc
public static String toTypeDesc(List<Type> parameterTypes, Type returnType)
Compute type description for methods, comprising parameter types and return type.- Parameters:
parameterTypes- The parameters for some methodreturnType- The return type for some method- Returns:
- Method type description
-
toTypeDesc
public static String toTypeDesc(Type type)
Convert type to JVM style type description- Parameters:
type- Type to convert- Returns:
- JVM style type description
-
getDefaultValue
public static Object getDefaultValue(SootField field)
Get default value of a field for constant pool- Parameters:
field- Field to get default value for- Returns:
- Default value or
nullif there is no default value.
-
acceptsStringInitialValue
public static boolean acceptsStringInitialValue(SootField field)
Determine if the field accepts a string default value, this is only true for fields of type String or a sub-type of String- Parameters:
field- Field- Returns:
trueif the field is of type String or sub-type,falseotherwise.
-
sizeOfType
public static int sizeOfType(Type t)
Get the size in words for a type.- Parameters:
t- Type- Returns:
- Size in words
-
createASMAttribute
public static org.objectweb.asm.Attribute createASMAttribute(Attribute attr)
Create an ASM attribute from an Soot attribute- Parameters:
attr- Soot attribute- Returns:
- ASM attribute
-
translateJavaVersion
public static String translateJavaVersion(int javaVersion)
Translate internal numbering of java versions to real version for debug messages.- Parameters:
javaVersion- Internal java version number- Returns:
- Java version in the format "1.7"
-
-