com.sun.java.util.jar.pack.ConstantPool.MethodHandleEntry Java Examples

The following examples show how to use com.sun.java.util.jar.pack.ConstantPool.MethodHandleEntry. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ClassReader.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
void readBootstrapMethods(Class cls) throws IOException {
    BootstrapMethodEntry[] bsms = new BootstrapMethodEntry[readUnsignedShort()];
    for (int i = 0; i < bsms.length; i++) {
        MethodHandleEntry bsmRef = (MethodHandleEntry) readRef(CONSTANT_MethodHandle);
        Entry[] argRefs = new Entry[readUnsignedShort()];
        for (int j = 0; j < argRefs.length; j++) {
            argRefs[j] = readRef(CONSTANT_LoadableValue);
        }
        bsms[i] = ConstantPool.getBootstrapMethodEntry(bsmRef, argRefs);
    }
    cls.setBootstrapMethods(Arrays.asList(bsms));
}
 
Example #2
Source File: ClassReader.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
void readBootstrapMethods(Class cls) throws IOException {
    BootstrapMethodEntry[] bsms = new BootstrapMethodEntry[readUnsignedShort()];
    for (int i = 0; i < bsms.length; i++) {
        MethodHandleEntry bsmRef = (MethodHandleEntry) readRef(CONSTANT_MethodHandle);
        Entry[] argRefs = new Entry[readUnsignedShort()];
        for (int j = 0; j < argRefs.length; j++) {
            argRefs[j] = readRef(CONSTANT_LoadableValue);
        }
        bsms[i] = ConstantPool.getBootstrapMethodEntry(bsmRef, argRefs);
    }
    cls.setBootstrapMethods(Arrays.asList(bsms));
}
 
Example #3
Source File: ClassReader.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
void readBootstrapMethods(Class cls) throws IOException {
    BootstrapMethodEntry[] bsms = new BootstrapMethodEntry[readUnsignedShort()];
    for (int i = 0; i < bsms.length; i++) {
        MethodHandleEntry bsmRef = (MethodHandleEntry) readRef(CONSTANT_MethodHandle);
        Entry[] argRefs = new Entry[readUnsignedShort()];
        for (int j = 0; j < argRefs.length; j++) {
            argRefs[j] = readRef(CONSTANT_LoadableValue);
        }
        bsms[i] = ConstantPool.getBootstrapMethodEntry(bsmRef, argRefs);
    }
    cls.setBootstrapMethods(Arrays.asList(bsms));
}
 
Example #4
Source File: ClassReader.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
void readBootstrapMethods(Class cls) throws IOException {
    BootstrapMethodEntry[] bsms = new BootstrapMethodEntry[readUnsignedShort()];
    for (int i = 0; i < bsms.length; i++) {
        MethodHandleEntry bsmRef = (MethodHandleEntry) readRef(CONSTANT_MethodHandle);
        Entry[] argRefs = new Entry[readUnsignedShort()];
        for (int j = 0; j < argRefs.length; j++) {
            argRefs[j] = readRef(CONSTANT_LoadableValue);
        }
        bsms[i] = ConstantPool.getBootstrapMethodEntry(bsmRef, argRefs);
    }
    cls.setBootstrapMethods(Arrays.asList(bsms));
}
 
Example #5
Source File: ClassReader.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
void readBootstrapMethods(Class cls) throws IOException {
    BootstrapMethodEntry[] bsms = new BootstrapMethodEntry[readUnsignedShort()];
    for (int i = 0; i < bsms.length; i++) {
        MethodHandleEntry bsmRef = (MethodHandleEntry) readRef(CONSTANT_MethodHandle);
        Entry[] argRefs = new Entry[readUnsignedShort()];
        for (int j = 0; j < argRefs.length; j++) {
            argRefs[j] = readRef(CONSTANT_LoadableValue);
        }
        bsms[i] = ConstantPool.getBootstrapMethodEntry(bsmRef, argRefs);
    }
    cls.setBootstrapMethods(Arrays.asList(bsms));
}
 
Example #6
Source File: ClassReader.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
void readBootstrapMethods(Class cls) throws IOException {
    BootstrapMethodEntry[] bsms = new BootstrapMethodEntry[readUnsignedShort()];
    for (int i = 0; i < bsms.length; i++) {
        MethodHandleEntry bsmRef = (MethodHandleEntry) readRef(CONSTANT_MethodHandle);
        Entry[] argRefs = new Entry[readUnsignedShort()];
        for (int j = 0; j < argRefs.length; j++) {
            argRefs[j] = readRef(CONSTANT_LoadableValue);
        }
        bsms[i] = ConstantPool.getBootstrapMethodEntry(bsmRef, argRefs);
    }
    cls.setBootstrapMethods(Arrays.asList(bsms));
}
 
Example #7
Source File: ClassReader.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
void readBootstrapMethods(Class cls) throws IOException {
    BootstrapMethodEntry[] bsms = new BootstrapMethodEntry[readUnsignedShort()];
    for (int i = 0; i < bsms.length; i++) {
        MethodHandleEntry bsmRef = (MethodHandleEntry) readRef(CONSTANT_MethodHandle);
        Entry[] argRefs = new Entry[readUnsignedShort()];
        for (int j = 0; j < argRefs.length; j++) {
            argRefs[j] = readRef(CONSTANT_LoadableValue);
        }
        bsms[i] = ConstantPool.getBootstrapMethodEntry(bsmRef, argRefs);
    }
    cls.setBootstrapMethods(Arrays.asList(bsms));
}
 
Example #8
Source File: ClassReader.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
void readBootstrapMethods(Class cls) throws IOException {
    BootstrapMethodEntry[] bsms = new BootstrapMethodEntry[readUnsignedShort()];
    for (int i = 0; i < bsms.length; i++) {
        MethodHandleEntry bsmRef = (MethodHandleEntry) readRef(CONSTANT_MethodHandle);
        Entry[] argRefs = new Entry[readUnsignedShort()];
        for (int j = 0; j < argRefs.length; j++) {
            argRefs[j] = readRef(CONSTANT_LoadableValue);
        }
        bsms[i] = ConstantPool.getBootstrapMethodEntry(bsmRef, argRefs);
    }
    cls.setBootstrapMethods(Arrays.asList(bsms));
}
 
Example #9
Source File: ClassReader.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
void readBootstrapMethods(Class cls) throws IOException {
    BootstrapMethodEntry[] bsms = new BootstrapMethodEntry[readUnsignedShort()];
    for (int i = 0; i < bsms.length; i++) {
        MethodHandleEntry bsmRef = (MethodHandleEntry) readRef(CONSTANT_MethodHandle);
        Entry[] argRefs = new Entry[readUnsignedShort()];
        for (int j = 0; j < argRefs.length; j++) {
            argRefs[j] = readRef(CONSTANT_LoadableValue);
        }
        bsms[i] = ConstantPool.getBootstrapMethodEntry(bsmRef, argRefs);
    }
    cls.setBootstrapMethods(Arrays.asList(bsms));
}
 
Example #10
Source File: ClassReader.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
void readBootstrapMethods(Class cls) throws IOException {
    BootstrapMethodEntry[] bsms = new BootstrapMethodEntry[readUnsignedShort()];
    for (int i = 0; i < bsms.length; i++) {
        MethodHandleEntry bsmRef = (MethodHandleEntry) readRef(CONSTANT_MethodHandle);
        Entry[] argRefs = new Entry[readUnsignedShort()];
        for (int j = 0; j < argRefs.length; j++) {
            argRefs[j] = readRef(CONSTANT_LoadableValue);
        }
        bsms[i] = ConstantPool.getBootstrapMethodEntry(bsmRef, argRefs);
    }
    cls.setBootstrapMethods(Arrays.asList(bsms));
}
 
Example #11
Source File: ClassReader.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
void readBootstrapMethods(Class cls) throws IOException {
    BootstrapMethodEntry[] bsms = new BootstrapMethodEntry[readUnsignedShort()];
    for (int i = 0; i < bsms.length; i++) {
        MethodHandleEntry bsmRef = (MethodHandleEntry) readRef(CONSTANT_MethodHandle);
        Entry[] argRefs = new Entry[readUnsignedShort()];
        for (int j = 0; j < argRefs.length; j++) {
            argRefs[j] = readRef(CONSTANT_LoadableValue);
        }
        bsms[i] = ConstantPool.getBootstrapMethodEntry(bsmRef, argRefs);
    }
    cls.setBootstrapMethods(Arrays.asList(bsms));
}
 
Example #12
Source File: ClassReader.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
void readBootstrapMethods(Class cls) throws IOException {
    BootstrapMethodEntry[] bsms = new BootstrapMethodEntry[readUnsignedShort()];
    for (int i = 0; i < bsms.length; i++) {
        MethodHandleEntry bsmRef = (MethodHandleEntry) readRef(CONSTANT_MethodHandle);
        Entry[] argRefs = new Entry[readUnsignedShort()];
        for (int j = 0; j < argRefs.length; j++) {
            argRefs[j] = readRef(CONSTANT_LoadableValue);
        }
        bsms[i] = ConstantPool.getBootstrapMethodEntry(bsmRef, argRefs);
    }
    cls.setBootstrapMethods(Arrays.asList(bsms));
}
 
Example #13
Source File: ClassReader.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
void readBootstrapMethods(Class cls) throws IOException {
    BootstrapMethodEntry[] bsms = new BootstrapMethodEntry[readUnsignedShort()];
    for (int i = 0; i < bsms.length; i++) {
        MethodHandleEntry bsmRef = (MethodHandleEntry) readRef(CONSTANT_MethodHandle);
        Entry[] argRefs = new Entry[readUnsignedShort()];
        for (int j = 0; j < argRefs.length; j++) {
            argRefs[j] = readRef(CONSTANT_LoadableValue);
        }
        bsms[i] = ConstantPool.getBootstrapMethodEntry(bsmRef, argRefs);
    }
    cls.setBootstrapMethods(Arrays.asList(bsms));
}
 
Example #14
Source File: ClassWriter.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
void writeConstantPool() throws IOException {
    Entry[] cpMap = cls.cpMap;
    writeShort(cpMap.length);
    for (int i = 0; i < cpMap.length; i++) {
        Entry e = cpMap[i];
        assert((e == null) == (i == 0 || cpMap[i-1] != null && cpMap[i-1].isDoubleWord()));
        if (e == null)  continue;
        byte tag = e.getTag();
        if (verbose > 2)  Utils.log.fine("   CP["+i+"] = "+e);
        out.write(tag);
        switch (tag) {
            case CONSTANT_Signature:
                throw new AssertionError("CP should have Signatures remapped to Utf8");
            case CONSTANT_Utf8:
                out.writeUTF(e.stringValue());
                break;
            case CONSTANT_Integer:
                out.writeInt(((NumberEntry)e).numberValue().intValue());
                break;
            case CONSTANT_Float:
                float fval = ((NumberEntry)e).numberValue().floatValue();
                out.writeInt(Float.floatToRawIntBits(fval));
                break;
            case CONSTANT_Long:
                out.writeLong(((NumberEntry)e).numberValue().longValue());
                break;
            case CONSTANT_Double:
                double dval = ((NumberEntry)e).numberValue().doubleValue();
                out.writeLong(Double.doubleToRawLongBits(dval));
                break;
            case CONSTANT_Class:
            case CONSTANT_String:
            case CONSTANT_MethodType:
                writeRef(e.getRef(0));
                break;
            case CONSTANT_MethodHandle:
                MethodHandleEntry mhe = (MethodHandleEntry) e;
                out.writeByte(mhe.refKind);
                writeRef(mhe.getRef(0));
                break;
            case CONSTANT_Fieldref:
            case CONSTANT_Methodref:
            case CONSTANT_InterfaceMethodref:
            case CONSTANT_NameandType:
                writeRef(e.getRef(0));
                writeRef(e.getRef(1));
                break;
            case CONSTANT_InvokeDynamic:
                writeRef(e.getRef(0), bsmIndex);
                writeRef(e.getRef(1));
                break;
            case CONSTANT_BootstrapMethod:
                throw new AssertionError("CP should have BootstrapMethods moved to side-table");
            default:
                throw new IOException("Bad constant pool tag "+tag);
        }
    }
}
 
Example #15
Source File: TLGlobals.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
Map<String, MethodHandleEntry> getMethodHandleEntries() {
    return methodHandleEntries;
}
 
Example #16
Source File: TLGlobals.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
Map<String, MethodHandleEntry> getMethodHandleEntries() {
    return methodHandleEntries;
}
 
Example #17
Source File: ClassWriter.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
void writeConstantPool() throws IOException {
    Entry[] cpMap = cls.cpMap;
    writeShort(cpMap.length);
    for (int i = 0; i < cpMap.length; i++) {
        Entry e = cpMap[i];
        assert((e == null) == (i == 0 || cpMap[i-1] != null && cpMap[i-1].isDoubleWord()));
        if (e == null)  continue;
        byte tag = e.getTag();
        if (verbose > 2)  Utils.log.fine("   CP["+i+"] = "+e);
        out.write(tag);
        switch (tag) {
            case CONSTANT_Signature:
                throw new AssertionError("CP should have Signatures remapped to Utf8");
            case CONSTANT_Utf8:
                out.writeUTF(e.stringValue());
                break;
            case CONSTANT_Integer:
                out.writeInt(((NumberEntry)e).numberValue().intValue());
                break;
            case CONSTANT_Float:
                float fval = ((NumberEntry)e).numberValue().floatValue();
                out.writeInt(Float.floatToRawIntBits(fval));
                break;
            case CONSTANT_Long:
                out.writeLong(((NumberEntry)e).numberValue().longValue());
                break;
            case CONSTANT_Double:
                double dval = ((NumberEntry)e).numberValue().doubleValue();
                out.writeLong(Double.doubleToRawLongBits(dval));
                break;
            case CONSTANT_Class:
            case CONSTANT_String:
            case CONSTANT_MethodType:
                writeRef(e.getRef(0));
                break;
            case CONSTANT_MethodHandle:
                MethodHandleEntry mhe = (MethodHandleEntry) e;
                out.writeByte(mhe.refKind);
                writeRef(mhe.getRef(0));
                break;
            case CONSTANT_Fieldref:
            case CONSTANT_Methodref:
            case CONSTANT_InterfaceMethodref:
            case CONSTANT_NameandType:
                writeRef(e.getRef(0));
                writeRef(e.getRef(1));
                break;
            case CONSTANT_InvokeDynamic:
                writeRef(e.getRef(0), bsmIndex);
                writeRef(e.getRef(1));
                break;
            case CONSTANT_BootstrapMethod:
                throw new AssertionError("CP should have BootstrapMethods moved to side-table");
            default:
                throw new IOException("Bad constant pool tag "+tag);
        }
    }
}
 
Example #18
Source File: TLGlobals.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
Map<String, MethodHandleEntry> getMethodHandleEntries() {
    return methodHandleEntries;
}
 
Example #19
Source File: ClassWriter.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
void writeConstantPool() throws IOException {
    Entry[] cpMap = cls.cpMap;
    writeShort(cpMap.length);
    for (int i = 0; i < cpMap.length; i++) {
        Entry e = cpMap[i];
        assert((e == null) == (i == 0 || cpMap[i-1] != null && cpMap[i-1].isDoubleWord()));
        if (e == null)  continue;
        byte tag = e.getTag();
        if (verbose > 2)  Utils.log.fine("   CP["+i+"] = "+e);
        out.write(tag);
        switch (tag) {
            case CONSTANT_Signature:
                throw new AssertionError("CP should have Signatures remapped to Utf8");
            case CONSTANT_Utf8:
                out.writeUTF(e.stringValue());
                break;
            case CONSTANT_Integer:
                out.writeInt(((NumberEntry)e).numberValue().intValue());
                break;
            case CONSTANT_Float:
                float fval = ((NumberEntry)e).numberValue().floatValue();
                out.writeInt(Float.floatToRawIntBits(fval));
                break;
            case CONSTANT_Long:
                out.writeLong(((NumberEntry)e).numberValue().longValue());
                break;
            case CONSTANT_Double:
                double dval = ((NumberEntry)e).numberValue().doubleValue();
                out.writeLong(Double.doubleToRawLongBits(dval));
                break;
            case CONSTANT_Class:
            case CONSTANT_String:
            case CONSTANT_MethodType:
                writeRef(e.getRef(0));
                break;
            case CONSTANT_MethodHandle:
                MethodHandleEntry mhe = (MethodHandleEntry) e;
                out.writeByte(mhe.refKind);
                writeRef(mhe.getRef(0));
                break;
            case CONSTANT_Fieldref:
            case CONSTANT_Methodref:
            case CONSTANT_InterfaceMethodref:
            case CONSTANT_NameandType:
                writeRef(e.getRef(0));
                writeRef(e.getRef(1));
                break;
            case CONSTANT_InvokeDynamic:
                writeRef(e.getRef(0), bsmIndex);
                writeRef(e.getRef(1));
                break;
            case CONSTANT_BootstrapMethod:
                throw new AssertionError("CP should have BootstrapMethods moved to side-table");
            default:
                throw new IOException("Bad constant pool tag "+tag);
        }
    }
}
 
Example #20
Source File: ClassWriter.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
void writeConstantPool() throws IOException {
    Entry[] cpMap = cls.cpMap;
    writeShort(cpMap.length);
    for (int i = 0; i < cpMap.length; i++) {
        Entry e = cpMap[i];
        assert((e == null) == (i == 0 || cpMap[i-1] != null && cpMap[i-1].isDoubleWord()));
        if (e == null)  continue;
        byte tag = e.getTag();
        if (verbose > 2)  Utils.log.fine("   CP["+i+"] = "+e);
        out.write(tag);
        switch (tag) {
            case CONSTANT_Signature:
                throw new AssertionError("CP should have Signatures remapped to Utf8");
            case CONSTANT_Utf8:
                out.writeUTF(e.stringValue());
                break;
            case CONSTANT_Integer:
                out.writeInt(((NumberEntry)e).numberValue().intValue());
                break;
            case CONSTANT_Float:
                float fval = ((NumberEntry)e).numberValue().floatValue();
                out.writeInt(Float.floatToRawIntBits(fval));
                break;
            case CONSTANT_Long:
                out.writeLong(((NumberEntry)e).numberValue().longValue());
                break;
            case CONSTANT_Double:
                double dval = ((NumberEntry)e).numberValue().doubleValue();
                out.writeLong(Double.doubleToRawLongBits(dval));
                break;
            case CONSTANT_Class:
            case CONSTANT_String:
            case CONSTANT_MethodType:
                writeRef(e.getRef(0));
                break;
            case CONSTANT_MethodHandle:
                MethodHandleEntry mhe = (MethodHandleEntry) e;
                out.writeByte(mhe.refKind);
                writeRef(mhe.getRef(0));
                break;
            case CONSTANT_Fieldref:
            case CONSTANT_Methodref:
            case CONSTANT_InterfaceMethodref:
            case CONSTANT_NameandType:
                writeRef(e.getRef(0));
                writeRef(e.getRef(1));
                break;
            case CONSTANT_InvokeDynamic:
                writeRef(e.getRef(0), bsmIndex);
                writeRef(e.getRef(1));
                break;
            case CONSTANT_BootstrapMethod:
                throw new AssertionError("CP should have BootstrapMethods moved to side-table");
            default:
                throw new IOException("Bad constant pool tag "+tag);
        }
    }
}
 
Example #21
Source File: TLGlobals.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
Map<String, MethodHandleEntry> getMethodHandleEntries() {
    return methodHandleEntries;
}
 
Example #22
Source File: TLGlobals.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
Map<String, MethodHandleEntry> getMethodHandleEntries() {
    return methodHandleEntries;
}
 
Example #23
Source File: ClassWriter.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
void writeConstantPool() throws IOException {
    Entry[] cpMap = cls.cpMap;
    writeShort(cpMap.length);
    for (int i = 0; i < cpMap.length; i++) {
        Entry e = cpMap[i];
        assert((e == null) == (i == 0 || cpMap[i-1] != null && cpMap[i-1].isDoubleWord()));
        if (e == null)  continue;
        byte tag = e.getTag();
        if (verbose > 2)  Utils.log.fine("   CP["+i+"] = "+e);
        out.write(tag);
        switch (tag) {
            case CONSTANT_Signature:
                throw new AssertionError("CP should have Signatures remapped to Utf8");
            case CONSTANT_Utf8:
                out.writeUTF(e.stringValue());
                break;
            case CONSTANT_Integer:
                out.writeInt(((NumberEntry)e).numberValue().intValue());
                break;
            case CONSTANT_Float:
                float fval = ((NumberEntry)e).numberValue().floatValue();
                out.writeInt(Float.floatToRawIntBits(fval));
                break;
            case CONSTANT_Long:
                out.writeLong(((NumberEntry)e).numberValue().longValue());
                break;
            case CONSTANT_Double:
                double dval = ((NumberEntry)e).numberValue().doubleValue();
                out.writeLong(Double.doubleToRawLongBits(dval));
                break;
            case CONSTANT_Class:
            case CONSTANT_String:
            case CONSTANT_MethodType:
                writeRef(e.getRef(0));
                break;
            case CONSTANT_MethodHandle:
                MethodHandleEntry mhe = (MethodHandleEntry) e;
                out.writeByte(mhe.refKind);
                writeRef(mhe.getRef(0));
                break;
            case CONSTANT_Fieldref:
            case CONSTANT_Methodref:
            case CONSTANT_InterfaceMethodref:
            case CONSTANT_NameandType:
                writeRef(e.getRef(0));
                writeRef(e.getRef(1));
                break;
            case CONSTANT_InvokeDynamic:
                writeRef(e.getRef(0), bsmIndex);
                writeRef(e.getRef(1));
                break;
            case CONSTANT_BootstrapMethod:
                throw new AssertionError("CP should have BootstrapMethods moved to side-table");
            default:
                throw new IOException("Bad constant pool tag "+tag);
        }
    }
}
 
Example #24
Source File: TLGlobals.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
Map<String, MethodHandleEntry> getMethodHandleEntries() {
    return methodHandleEntries;
}
 
Example #25
Source File: TLGlobals.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
Map<String, MethodHandleEntry> getMethodHandleEntries() {
    return methodHandleEntries;
}
 
Example #26
Source File: ClassWriter.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
void writeConstantPool() throws IOException {
    Entry[] cpMap = cls.cpMap;
    writeShort(cpMap.length);
    for (int i = 0; i < cpMap.length; i++) {
        Entry e = cpMap[i];
        assert((e == null) == (i == 0 || cpMap[i-1] != null && cpMap[i-1].isDoubleWord()));
        if (e == null)  continue;
        byte tag = e.getTag();
        if (verbose > 2)  Utils.log.fine("   CP["+i+"] = "+e);
        out.write(tag);
        switch (tag) {
            case CONSTANT_Signature:
                throw new AssertionError("CP should have Signatures remapped to Utf8");
            case CONSTANT_Utf8:
                out.writeUTF(e.stringValue());
                break;
            case CONSTANT_Integer:
                out.writeInt(((NumberEntry)e).numberValue().intValue());
                break;
            case CONSTANT_Float:
                float fval = ((NumberEntry)e).numberValue().floatValue();
                out.writeInt(Float.floatToRawIntBits(fval));
                break;
            case CONSTANT_Long:
                out.writeLong(((NumberEntry)e).numberValue().longValue());
                break;
            case CONSTANT_Double:
                double dval = ((NumberEntry)e).numberValue().doubleValue();
                out.writeLong(Double.doubleToRawLongBits(dval));
                break;
            case CONSTANT_Class:
            case CONSTANT_String:
            case CONSTANT_MethodType:
                writeRef(e.getRef(0));
                break;
            case CONSTANT_MethodHandle:
                MethodHandleEntry mhe = (MethodHandleEntry) e;
                out.writeByte(mhe.refKind);
                writeRef(mhe.getRef(0));
                break;
            case CONSTANT_Fieldref:
            case CONSTANT_Methodref:
            case CONSTANT_InterfaceMethodref:
            case CONSTANT_NameandType:
                writeRef(e.getRef(0));
                writeRef(e.getRef(1));
                break;
            case CONSTANT_InvokeDynamic:
                writeRef(e.getRef(0), bsmIndex);
                writeRef(e.getRef(1));
                break;
            case CONSTANT_BootstrapMethod:
                throw new AssertionError("CP should have BootstrapMethods moved to side-table");
            default:
                throw new IOException("Bad constant pool tag "+tag);
        }
    }
}
 
Example #27
Source File: ClassWriter.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
void writeConstantPool() throws IOException {
    Entry[] cpMap = cls.cpMap;
    writeShort(cpMap.length);
    for (int i = 0; i < cpMap.length; i++) {
        Entry e = cpMap[i];
        assert((e == null) == (i == 0 || cpMap[i-1] != null && cpMap[i-1].isDoubleWord()));
        if (e == null)  continue;
        byte tag = e.getTag();
        if (verbose > 2)  Utils.log.fine("   CP["+i+"] = "+e);
        out.write(tag);
        switch (tag) {
            case CONSTANT_Signature:
                throw new AssertionError("CP should have Signatures remapped to Utf8");
            case CONSTANT_Utf8:
                out.writeUTF(e.stringValue());
                break;
            case CONSTANT_Integer:
                out.writeInt(((NumberEntry)e).numberValue().intValue());
                break;
            case CONSTANT_Float:
                float fval = ((NumberEntry)e).numberValue().floatValue();
                out.writeInt(Float.floatToRawIntBits(fval));
                break;
            case CONSTANT_Long:
                out.writeLong(((NumberEntry)e).numberValue().longValue());
                break;
            case CONSTANT_Double:
                double dval = ((NumberEntry)e).numberValue().doubleValue();
                out.writeLong(Double.doubleToRawLongBits(dval));
                break;
            case CONSTANT_Class:
            case CONSTANT_String:
            case CONSTANT_MethodType:
                writeRef(e.getRef(0));
                break;
            case CONSTANT_MethodHandle:
                MethodHandleEntry mhe = (MethodHandleEntry) e;
                out.writeByte(mhe.refKind);
                writeRef(mhe.getRef(0));
                break;
            case CONSTANT_Fieldref:
            case CONSTANT_Methodref:
            case CONSTANT_InterfaceMethodref:
            case CONSTANT_NameandType:
                writeRef(e.getRef(0));
                writeRef(e.getRef(1));
                break;
            case CONSTANT_InvokeDynamic:
                writeRef(e.getRef(0), bsmIndex);
                writeRef(e.getRef(1));
                break;
            case CONSTANT_BootstrapMethod:
                throw new AssertionError("CP should have BootstrapMethods moved to side-table");
            default:
                throw new IOException("Bad constant pool tag "+tag);
        }
    }
}
 
Example #28
Source File: ClassWriter.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
void writeConstantPool() throws IOException {
    Entry[] cpMap = cls.cpMap;
    writeShort(cpMap.length);
    for (int i = 0; i < cpMap.length; i++) {
        Entry e = cpMap[i];
        assert((e == null) == (i == 0 || cpMap[i-1] != null && cpMap[i-1].isDoubleWord()));
        if (e == null)  continue;
        byte tag = e.getTag();
        if (verbose > 2)  Utils.log.fine("   CP["+i+"] = "+e);
        out.write(tag);
        switch (tag) {
            case CONSTANT_Signature:
                throw new AssertionError("CP should have Signatures remapped to Utf8");
            case CONSTANT_Utf8:
                out.writeUTF(e.stringValue());
                break;
            case CONSTANT_Integer:
                out.writeInt(((NumberEntry)e).numberValue().intValue());
                break;
            case CONSTANT_Float:
                float fval = ((NumberEntry)e).numberValue().floatValue();
                out.writeInt(Float.floatToRawIntBits(fval));
                break;
            case CONSTANT_Long:
                out.writeLong(((NumberEntry)e).numberValue().longValue());
                break;
            case CONSTANT_Double:
                double dval = ((NumberEntry)e).numberValue().doubleValue();
                out.writeLong(Double.doubleToRawLongBits(dval));
                break;
            case CONSTANT_Class:
            case CONSTANT_String:
            case CONSTANT_MethodType:
                writeRef(e.getRef(0));
                break;
            case CONSTANT_MethodHandle:
                MethodHandleEntry mhe = (MethodHandleEntry) e;
                out.writeByte(mhe.refKind);
                writeRef(mhe.getRef(0));
                break;
            case CONSTANT_Fieldref:
            case CONSTANT_Methodref:
            case CONSTANT_InterfaceMethodref:
            case CONSTANT_NameandType:
                writeRef(e.getRef(0));
                writeRef(e.getRef(1));
                break;
            case CONSTANT_InvokeDynamic:
                writeRef(e.getRef(0), bsmIndex);
                writeRef(e.getRef(1));
                break;
            case CONSTANT_BootstrapMethod:
                throw new AssertionError("CP should have BootstrapMethods moved to side-table");
            default:
                throw new IOException("Bad constant pool tag "+tag);
        }
    }
}
 
Example #29
Source File: TLGlobals.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
Map<String, MethodHandleEntry> getMethodHandleEntries() {
    return methodHandleEntries;
}
 
Example #30
Source File: ClassWriter.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
void writeConstantPool() throws IOException {
    Entry[] cpMap = cls.cpMap;
    writeShort(cpMap.length);
    for (int i = 0; i < cpMap.length; i++) {
        Entry e = cpMap[i];
        assert((e == null) == (i == 0 || cpMap[i-1] != null && cpMap[i-1].isDoubleWord()));
        if (e == null)  continue;
        byte tag = e.getTag();
        if (verbose > 2)  Utils.log.fine("   CP["+i+"] = "+e);
        out.write(tag);
        switch (tag) {
            case CONSTANT_Signature:
                throw new AssertionError("CP should have Signatures remapped to Utf8");
            case CONSTANT_Utf8:
                out.writeUTF(e.stringValue());
                break;
            case CONSTANT_Integer:
                out.writeInt(((NumberEntry)e).numberValue().intValue());
                break;
            case CONSTANT_Float:
                float fval = ((NumberEntry)e).numberValue().floatValue();
                out.writeInt(Float.floatToRawIntBits(fval));
                break;
            case CONSTANT_Long:
                out.writeLong(((NumberEntry)e).numberValue().longValue());
                break;
            case CONSTANT_Double:
                double dval = ((NumberEntry)e).numberValue().doubleValue();
                out.writeLong(Double.doubleToRawLongBits(dval));
                break;
            case CONSTANT_Class:
            case CONSTANT_String:
            case CONSTANT_MethodType:
                writeRef(e.getRef(0));
                break;
            case CONSTANT_MethodHandle:
                MethodHandleEntry mhe = (MethodHandleEntry) e;
                out.writeByte(mhe.refKind);
                writeRef(mhe.getRef(0));
                break;
            case CONSTANT_Fieldref:
            case CONSTANT_Methodref:
            case CONSTANT_InterfaceMethodref:
            case CONSTANT_NameandType:
                writeRef(e.getRef(0));
                writeRef(e.getRef(1));
                break;
            case CONSTANT_InvokeDynamic:
                writeRef(e.getRef(0), bsmIndex);
                writeRef(e.getRef(1));
                break;
            case CONSTANT_BootstrapMethod:
                throw new AssertionError("CP should have BootstrapMethods moved to side-table");
            default:
                throw new IOException("Bad constant pool tag "+tag);
        }
    }
}