src/share/classes/sun/invoke/anon/ConstantPoolPatch.java

Print this page




 401      * @see ConstantPoolVisitor#visitMemberRef(int, byte, String, String, String, int, int)
 402      */
 403     public void putMemberRef(int index, byte tag,
 404                     String className, String memberName, String signature) {
 405         checkTagMask(tag, CONSTANT_MemberRef_MASK);
 406         checkTag(index, tag);
 407         checkClassName(className);
 408         checkMemberName(memberName);
 409         if (signature.startsWith("(") == (tag == CONSTANT_Fieldref))
 410             throw new IllegalArgumentException("bad signature: "+signature);
 411         patchArray[index] = addSemis(className, memberName, signature);
 412     }
 413 
 414     static private final int CONSTANT_MemberRef_MASK =
 415               CONSTANT_Fieldref
 416             | CONSTANT_Methodref
 417             | CONSTANT_InterfaceMethodref;
 418 
 419     private static final Map<Class<?>, Byte> CONSTANT_VALUE_CLASS_TAG
 420         = new IdentityHashMap<Class<?>, Byte>();
 421     private static final Class[] CONSTANT_VALUE_CLASS = new Class[16];
 422     static {
 423         Object[][] values = {
 424             {Integer.class, CONSTANT_Integer},
 425             {Long.class, CONSTANT_Long},
 426             {Float.class, CONSTANT_Float},
 427             {Double.class, CONSTANT_Double},
 428             {String.class, CONSTANT_String},
 429             {Class.class, CONSTANT_Class}
 430         };
 431         for (Object[] value : values) {
 432             Class<?> cls = (Class<?>)value[0];
 433             Byte     tag = (Byte) value[1];
 434             CONSTANT_VALUE_CLASS_TAG.put(cls, tag);
 435             CONSTANT_VALUE_CLASS[(byte)tag] = cls;
 436         }
 437     }
 438 
 439     static Class<?> classForTag(byte tag) {
 440         if ((tag & 0xFF) >= CONSTANT_VALUE_CLASS.length)
 441             return null;




 401      * @see ConstantPoolVisitor#visitMemberRef(int, byte, String, String, String, int, int)
 402      */
 403     public void putMemberRef(int index, byte tag,
 404                     String className, String memberName, String signature) {
 405         checkTagMask(tag, CONSTANT_MemberRef_MASK);
 406         checkTag(index, tag);
 407         checkClassName(className);
 408         checkMemberName(memberName);
 409         if (signature.startsWith("(") == (tag == CONSTANT_Fieldref))
 410             throw new IllegalArgumentException("bad signature: "+signature);
 411         patchArray[index] = addSemis(className, memberName, signature);
 412     }
 413 
 414     static private final int CONSTANT_MemberRef_MASK =
 415               CONSTANT_Fieldref
 416             | CONSTANT_Methodref
 417             | CONSTANT_InterfaceMethodref;
 418 
 419     private static final Map<Class<?>, Byte> CONSTANT_VALUE_CLASS_TAG
 420         = new IdentityHashMap<Class<?>, Byte>();
 421     private static final Class<?>[] CONSTANT_VALUE_CLASS = new Class<?>[16];
 422     static {
 423         Object[][] values = {
 424             {Integer.class, CONSTANT_Integer},
 425             {Long.class, CONSTANT_Long},
 426             {Float.class, CONSTANT_Float},
 427             {Double.class, CONSTANT_Double},
 428             {String.class, CONSTANT_String},
 429             {Class.class, CONSTANT_Class}
 430         };
 431         for (Object[] value : values) {
 432             Class<?> cls = (Class<?>)value[0];
 433             Byte     tag = (Byte) value[1];
 434             CONSTANT_VALUE_CLASS_TAG.put(cls, tag);
 435             CONSTANT_VALUE_CLASS[(byte)tag] = cls;
 436         }
 437     }
 438 
 439     static Class<?> classForTag(byte tag) {
 440         if ((tag & 0xFF) >= CONSTANT_VALUE_CLASS.length)
 441             return null;