Package com.android.dx.rop.type
Class Prototype
java.lang.Object
com.android.dx.rop.type.Prototype
- All Implemented Interfaces:
Comparable<Prototype>
Representation of a method descriptor. Instances of this class are
generally interned and may be usefully compared with each other
using
==
.-
Method Summary
Modifier and TypeMethodDescriptionstatic void
int
boolean
static Prototype
fromDescriptor
(String descriptor) Returns a prototype for a method descriptor.Gets the descriptor string.Gets the list of frame types corresponding to the list of parameter types.Gets the list of parameter types.Gets the return type.int
hashCode()
static Prototype
Returns the unique instance corresponding to the given method descriptor.static Prototype
Interns an instance, adding to the descriptor as necessary based on the given definer, name, and flags.static Prototype
internInts
(Type returnType, int count) Interns an instance which consists of the given number ofint
s along with the given return typetoString()
withFirstParameter
(Type param) Returns a new interned instance, which is the same as this instance, except that it has an additional parameter prepended to the original's argument list.
-
Method Details
-
intern
Returns the unique instance corresponding to the given method descriptor. See vmspec-2 sec4.3.3 for details on the field descriptor syntax.- Parameters:
descriptor
-non-null;
the descriptor- Returns:
non-null;
the corresponding instance- Throws:
IllegalArgumentException
- thrown if the descriptor has invalid syntax
-
fromDescriptor
Returns a prototype for a method descriptor. ThePrototype
returned will be the interned value if present, or a new instance otherwise. If a new instance is created, it is not placed in the intern table.- Parameters:
descriptor
-non-null;
the descriptor- Returns:
non-null;
the corresponding instance- Throws:
IllegalArgumentException
- thrown if the descriptor has invalid syntax
-
clearInternTable
public static void clearInternTable() -
intern
Interns an instance, adding to the descriptor as necessary based on the given definer, name, and flags. For example, an init method has an uninitialized object of typedefiner
as its first argument.- Parameters:
descriptor
-non-null;
the descriptor stringdefiner
-non-null;
class the method is defined onisStatic
- whether this is a static methodisInit
- whether this is an init method- Returns:
non-null;
the interned instance
-
internInts
Interns an instance which consists of the given number ofint
s along with the given return type- Parameters:
returnType
-non-null;
the return typecount
-> 0;
the number of elements in the prototype- Returns:
non-null;
the interned instance
-
equals
-
hashCode
public int hashCode() -
compareTo
- Specified by:
compareTo
in interfaceComparable<Prototype>
-
toString
-
getDescriptor
Gets the descriptor string.- Returns:
non-null;
the descriptor
-
getReturnType
Gets the return type.- Returns:
non-null;
the return type
-
getParameterTypes
Gets the list of parameter types.- Returns:
non-null;
the list of parameter types
-
getParameterFrameTypes
Gets the list of frame types corresponding to the list of parameter types. The difference between the two lists (if any) is that all "intlike" types (seeType.isIntlike()
) are replaced byType.INT
.- Returns:
non-null;
the list of parameter frame types
-
withFirstParameter
Returns a new interned instance, which is the same as this instance, except that it has an additional parameter prepended to the original's argument list.- Parameters:
param
-non-null;
the new first parameter- Returns:
non-null;
an appropriately-constructed instance
-