Class TypeDesc


  • public class TypeDesc
    extends java.lang.Object
    A utility class that provides static methods for interning type strings and merging type descriptors.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) static java.lang.String JAVA_LANG_OBJECT  
      (package private) static java.util.HashMap<java.lang.String,​java.lang.String> knownTypes  
    • Constructor Summary

      Constructors 
      Constructor Description
      TypeDesc()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String commonSuperType​(Detector det, java.lang.String oa, java.lang.String ob)  
      static java.lang.String[] getArgumentTypes​(java.lang.String methodDescriptor)  
      static java.lang.String getComponentType​(java.lang.String t)  
      static java.lang.String getInternalName​(java.lang.String desc)  
      static java.lang.String getInterned​(java.lang.String desc)  
      static int getNumArgumentTypes​(char[] buf)  
      static int getNumArgumentTypes​(java.lang.String desc)  
      static java.lang.String getReturnTypeDesc​(java.lang.String desc)  
      static java.lang.String getTypeDesc​(java.lang.Object object)  
      (package private) static boolean isDoubleWord​(java.lang.String desc)  
      static boolean isIntType​(java.lang.String typeDesc)  
      static boolean isRefType​(java.lang.String typeDesc)  
      (package private) static boolean isSingleWord​(java.lang.String desc)  
      static java.lang.String mergeType​(Detector det, java.lang.String a, java.lang.String b)
      Given two type descriptors, it returns an appropriate merge: 1) If they are Array types, the result is a an array of the merged component types 2) If they are ref types, it returns the least common super type.
      private static int typelen​(char[] buf, int off)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • knownTypes

        static final java.util.HashMap<java.lang.String,​java.lang.String> knownTypes
      • JAVA_LANG_OBJECT

        static java.lang.String JAVA_LANG_OBJECT
    • Constructor Detail

      • TypeDesc

        public TypeDesc()
    • Method Detail

      • isDoubleWord

        static boolean isDoubleWord​(java.lang.String desc)
      • getInterned

        public static java.lang.String getInterned​(java.lang.String desc)
      • getReturnTypeDesc

        public static java.lang.String getReturnTypeDesc​(java.lang.String desc)
      • isSingleWord

        static boolean isSingleWord​(java.lang.String desc)
      • getComponentType

        public static java.lang.String getComponentType​(java.lang.String t)
      • getTypeDesc

        public static java.lang.String getTypeDesc​(java.lang.Object object)
      • typelen

        private static int typelen​(char[] buf,
                                   int off)
      • getArgumentTypes

        public static java.lang.String[] getArgumentTypes​(java.lang.String methodDescriptor)
      • getNumArgumentTypes

        public static int getNumArgumentTypes​(java.lang.String desc)
      • getNumArgumentTypes

        public static int getNumArgumentTypes​(char[] buf)
      • mergeType

        public static java.lang.String mergeType​(Detector det,
                                                 java.lang.String a,
                                                 java.lang.String b)
                                          throws IncompatibleTypesException
        Given two type descriptors, it returns an appropriate merge: 1) If they are Array types, the result is a an array of the merged component types 2) If they are ref types, it returns the least common super type. If one of them is an interface, the result is D_OBJECT 3) All other types must match exactly in order to not raise an error.
        Throws:
        IncompatibleTypesException
      • commonSuperType

        public static java.lang.String commonSuperType​(Detector det,
                                                       java.lang.String oa,
                                                       java.lang.String ob)
      • isIntType

        public static boolean isIntType​(java.lang.String typeDesc)
      • isRefType

        public static boolean isRefType​(java.lang.String typeDesc)
      • getInternalName

        public static java.lang.String getInternalName​(java.lang.String desc)