Class JavaTypeUtil
java.lang.Object
com.pnfsoftware.jeb.core.units.code.java.JavaTypeUtil
Utility methods to generate or verify Java type names and signatures.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcheckLegalInternalClassname(String classname) static StringgenerateClassnameStandardRepresentation(String classname) Transform an internal classname representation to its external representation.static StringgenerateClassnameWithoutPackage(String classname) Get the non fully-qualified internal representation of the class name.
Example:Lcom/pnfsoftware/Raasta;will generateLRaasta;static StringgeneratePackageNameStandardRepresentation(String classname) Extract the standard representation of a package name provided the internal representation of the FQ classname.
Example:Lcom/foo/Crap$Bla;will generatecom.foostatic booleanisLegalInternalClassname(String classname) Check whether the class (or interface) name is a valid Java object type internal representation.static IJavaType[]parseFullPrototype(IDexPrototype proto, IJavaTypeFactory tf) Parse a DEX prototype to an array of IR/ASTIJavaTypes.parseMethodParameters(IDexUnit dex, IDexMethod m, IJavaTypeFactory tf) Determine method parameters and register association.static IJavaType[]parseShortyPrototype(String shorty, IJavaTypeFactory tf) Parse a DEX shorty prototype string to an array of IR/ASTIJavaTypes.
-
Constructor Details
-
JavaTypeUtil
public JavaTypeUtil()
-
-
Method Details
-
isLegalInternalClassname
Check whether the class (or interface) name is a valid Java object type internal representation.Example:
Labc/def/Bla;- Parameters:
classname-- Returns:
-
checkLegalInternalClassname
- Parameters:
classname-
-
generateClassnameStandardRepresentation
Transform an internal classname representation to its external representation.Examples:
- Lcom/bla/Animal; becomes com.bla.Animal
- Lcom/bla/Animal$Trainer; becomes com.bla.Animal$Trainer
- Parameters:
classname- internal representation- Returns:
-
generateClassnameWithoutPackage
Get the non fully-qualified internal representation of the class name.
Example:Lcom/pnfsoftware/Raasta;will generateLRaasta;- Parameters:
classname- internal representation- Returns:
-
generatePackageNameStandardRepresentation
Extract the standard representation of a package name provided the internal representation of the FQ classname.
Example:Lcom/foo/Crap$Bla;will generatecom.foo- Parameters:
classname- internal representation- Returns:
- standard representation of the package containing the provided classname
-
parseShortyPrototype
Parse a DEX shorty prototype string to an array of IR/ASTIJavaTypes. Note that a type factory is not needed as no detailed complex type is created (shorty prototypes simply indicate if a type is an object, they do not define the object type itself).- Parameters:
shorty-tf-- Returns:
- Array of types:
- index=0 : return
- index=1+ : arguments
-
parseFullPrototype
Parse a DEX prototype to an array of IR/ASTIJavaTypes.- Parameters:
proto-tf-- Returns:
-
parseMethodParameters
public static SortedMap<Integer,IJavaType> parseMethodParameters(IDexUnit dex, IDexMethod m, IJavaTypeFactory tf) Determine method parameters and register association.- Parameters:
dex- DEX Parserm- internal, non-abstract method (must contain bytecode)- Returns:
- Map of (register number, parameter type), including the 'this' pointer if any. The return value, if any, is mapped to fake register number -1.
- Throws:
RuntimeException- If the frame is too small, or the type cannot be processed.
-