< prev index next >

src/java.base/share/classes/com/sun/java/util/jar/pack/ConstantPool.java

Print this page




1564         }
1565         return "tag#"+tag;
1566     }
1567 
1568     public static String refKindName(int refKind) {
1569         switch (refKind) {
1570             case REF_getField:                  return "getField";
1571             case REF_getStatic:                 return "getStatic";
1572             case REF_putField:                  return "putField";
1573             case REF_putStatic:                 return "putStatic";
1574             case REF_invokeVirtual:             return "invokeVirtual";
1575             case REF_invokeStatic:              return "invokeStatic";
1576             case REF_invokeSpecial:             return "invokeSpecial";
1577             case REF_newInvokeSpecial:          return "newInvokeSpecial";
1578             case REF_invokeInterface:           return "invokeInterface";
1579         }
1580         return "refKind#"+refKind;
1581     }
1582 
1583     // archive constant pool definition order
1584     static final byte TAGS_IN_ORDER[] = {
1585         CONSTANT_Utf8,
1586         CONSTANT_Integer,           // cp_Int
1587         CONSTANT_Float,
1588         CONSTANT_Long,
1589         CONSTANT_Double,
1590         CONSTANT_String,            // note that String=8 precedes Class=7
1591         CONSTANT_Class,
1592         CONSTANT_Signature,
1593         CONSTANT_NameandType,       // cp_Descr
1594         CONSTANT_Fieldref,          // cp_Field
1595         CONSTANT_Methodref,         // cp_Method
1596         CONSTANT_InterfaceMethodref, // cp_Imethod
1597 
1598         // Constants defined in JDK 7 and later:
1599         CONSTANT_MethodHandle,
1600         CONSTANT_MethodType,
1601         CONSTANT_BootstrapMethod,  // pseudo-tag, really stored in a class attribute
1602         CONSTANT_InvokeDynamic
1603     };
1604     static final byte TAG_ORDER[];
1605     static {
1606         TAG_ORDER = new byte[CONSTANT_Limit];
1607         for (int i = 0; i < TAGS_IN_ORDER.length; i++) {
1608             TAG_ORDER[TAGS_IN_ORDER[i]] = (byte)(i+1);
1609         }
1610         /*
1611         System.out.println("TAG_ORDER[] = {");
1612         for (int i = 0; i < TAG_ORDER.length; i++)
1613             System.out.println("  "+TAG_ORDER[i]+",");
1614         System.out.println("};");
1615         */
1616     }
1617     static final byte[] NUMBER_TAGS = {
1618         CONSTANT_Integer, CONSTANT_Float, CONSTANT_Long, CONSTANT_Double
1619     };
1620     static final byte[] EXTRA_TAGS = {
1621         CONSTANT_MethodHandle, CONSTANT_MethodType,
1622         CONSTANT_BootstrapMethod, // pseudo-tag
1623         CONSTANT_InvokeDynamic
1624     };




1564         }
1565         return "tag#"+tag;
1566     }
1567 
1568     public static String refKindName(int refKind) {
1569         switch (refKind) {
1570             case REF_getField:                  return "getField";
1571             case REF_getStatic:                 return "getStatic";
1572             case REF_putField:                  return "putField";
1573             case REF_putStatic:                 return "putStatic";
1574             case REF_invokeVirtual:             return "invokeVirtual";
1575             case REF_invokeStatic:              return "invokeStatic";
1576             case REF_invokeSpecial:             return "invokeSpecial";
1577             case REF_newInvokeSpecial:          return "newInvokeSpecial";
1578             case REF_invokeInterface:           return "invokeInterface";
1579         }
1580         return "refKind#"+refKind;
1581     }
1582 
1583     // archive constant pool definition order
1584     static final byte[] TAGS_IN_ORDER = {
1585         CONSTANT_Utf8,
1586         CONSTANT_Integer,           // cp_Int
1587         CONSTANT_Float,
1588         CONSTANT_Long,
1589         CONSTANT_Double,
1590         CONSTANT_String,            // note that String=8 precedes Class=7
1591         CONSTANT_Class,
1592         CONSTANT_Signature,
1593         CONSTANT_NameandType,       // cp_Descr
1594         CONSTANT_Fieldref,          // cp_Field
1595         CONSTANT_Methodref,         // cp_Method
1596         CONSTANT_InterfaceMethodref, // cp_Imethod
1597 
1598         // Constants defined in JDK 7 and later:
1599         CONSTANT_MethodHandle,
1600         CONSTANT_MethodType,
1601         CONSTANT_BootstrapMethod,  // pseudo-tag, really stored in a class attribute
1602         CONSTANT_InvokeDynamic
1603     };
1604     static final byte[] TAG_ORDER;
1605     static {
1606         TAG_ORDER = new byte[CONSTANT_Limit];
1607         for (int i = 0; i < TAGS_IN_ORDER.length; i++) {
1608             TAG_ORDER[TAGS_IN_ORDER[i]] = (byte)(i+1);
1609         }
1610         /*
1611         System.out.println("TAG_ORDER[] = {");
1612         for (int i = 0; i < TAG_ORDER.length; i++)
1613             System.out.println("  "+TAG_ORDER[i]+",");
1614         System.out.println("};");
1615         */
1616     }
1617     static final byte[] NUMBER_TAGS = {
1618         CONSTANT_Integer, CONSTANT_Float, CONSTANT_Long, CONSTANT_Double
1619     };
1620     static final byte[] EXTRA_TAGS = {
1621         CONSTANT_MethodHandle, CONSTANT_MethodType,
1622         CONSTANT_BootstrapMethod, // pseudo-tag
1623         CONSTANT_InvokeDynamic
1624     };


< prev index next >