// Resolve reference to constantPool by index in constants
private void resolveConstantPoolReferences(ConstantInfo[] constantPool) {
        for (ConstantInfo constant : constantPool) {
            if (constant instanceof ConstantInfo.Class) {
                ConstantInfo.Class info = (ConstantInfo.Class)constant;
                info.setName(((ConstantInfo.Utf8)constantPool[info.getNameIndex() - 1]).getString());
            } else if (constant instanceof ConstantInfo.Fieldref) {
                ConstantInfo.Fieldref info = (ConstantInfo.Fieldref)constant;
                info.setClassInfo((ConstantInfo.Class)constantPool[info.getClassIndex() - 1]);
                info.setNameAndType((ConstantInfo.NameAndType)constantPool[info.getNameAndTypeIndex() - 1]);
            } else if (constant instanceof ConstantInfo.Methodref) {
                ConstantInfo.Methodref info = (ConstantInfo.Methodref)constant;
                info.setClassInfo((ConstantInfo.Class)constantPool[info.getClassIndex() - 1]);
                info.setNameAndType((ConstantInfo.NameAndType)constantPool[info.getNameAndTypeIndex() - 1]);
            } else if (constant instanceof ConstantInfo.InterfaceMethodref) {
                ConstantInfo.InterfaceMethodref info = (ConstantInfo.InterfaceMethodref)constant;
                info.setClassInfo((ConstantInfo.Class)constantPool[info.getClassIndex() - 1]);
                info.setNameAndType((ConstantInfo.NameAndType)constantPool[info.getNameAndTypeIndex() - 1]);
            } else if (constant instanceof ConstantInfo.String) {
                ConstantInfo.String info = (ConstantInfo.String)constant;
                info.setString(((ConstantInfo.Utf8)constantPool[info.getStringIndex() - 1]).getString());
            } else if (constant instanceof ConstantInfo.Integer
                    || constant instanceof ConstantInfo.Float
                    || constant instanceof ConstantInfo.Long
                    || constant instanceof ConstantInfo.Double) {
                // not needed
            } else if (constant instanceof ConstantInfo.NameAndType) {
                ConstantInfo.NameAndType info = (ConstantInfo.NameAndType)constant;
                info.setName(((ConstantInfo.Utf8)constantPool[info.getNameIndex() - 1]).getString());
                info.setDescriptor(((ConstantInfo.Utf8)constantPool[info.getDescriptorIndex() - 1]).getString());
            } else if (constant instanceof ConstantInfo.Utf8) {
                // not needed
            } else if (constant instanceof ConstantInfo.MethodHandle
                    || constant instanceof ConstantInfo.MethodType
                    || constant instanceof ConstantInfo.InvokeDynamic) {
                // not used yet
            } else if (constant != null) { // Long/Double may leave create a blank space
                throw new UnsupportedOperationException("Unhandled ConstantType: " + constant);
            }
        }
    }
private void resolveConstantPoolReferences(ConstantInfo[] constantPool) {
for (ConstantInfo constant : constantPool) {
if (constant instanceof ConstantInfo.Class) {
ConstantInfo.Class info = (ConstantInfo.Class)constant;
info.setName(((ConstantInfo.Utf8)constantPool[info.getNameIndex() - 1]).getString());
} else if (constant instanceof ConstantInfo.Fieldref) {
ConstantInfo.Fieldref info = (ConstantInfo.Fieldref)constant;
info.setClassInfo((ConstantInfo.Class)constantPool[info.getClassIndex() - 1]);
info.setNameAndType((ConstantInfo.NameAndType)constantPool[info.getNameAndTypeIndex() - 1]);
} else if (constant instanceof ConstantInfo.Methodref) {
ConstantInfo.Methodref info = (ConstantInfo.Methodref)constant;
info.setClassInfo((ConstantInfo.Class)constantPool[info.getClassIndex() - 1]);
info.setNameAndType((ConstantInfo.NameAndType)constantPool[info.getNameAndTypeIndex() - 1]);
} else if (constant instanceof ConstantInfo.InterfaceMethodref) {
ConstantInfo.InterfaceMethodref info = (ConstantInfo.InterfaceMethodref)constant;
info.setClassInfo((ConstantInfo.Class)constantPool[info.getClassIndex() - 1]);
info.setNameAndType((ConstantInfo.NameAndType)constantPool[info.getNameAndTypeIndex() - 1]);
} else if (constant instanceof ConstantInfo.String) {
ConstantInfo.String info = (ConstantInfo.String)constant;
info.setString(((ConstantInfo.Utf8)constantPool[info.getStringIndex() - 1]).getString());
} else if (constant instanceof ConstantInfo.Integer
|| constant instanceof ConstantInfo.Float
|| constant instanceof ConstantInfo.Long
|| constant instanceof ConstantInfo.Double) {
// not needed
} else if (constant instanceof ConstantInfo.NameAndType) {
ConstantInfo.NameAndType info = (ConstantInfo.NameAndType)constant;
info.setName(((ConstantInfo.Utf8)constantPool[info.getNameIndex() - 1]).getString());
info.setDescriptor(((ConstantInfo.Utf8)constantPool[info.getDescriptorIndex() - 1]).getString());
} else if (constant instanceof ConstantInfo.Utf8) {
// not needed
} else if (constant instanceof ConstantInfo.MethodHandle
|| constant instanceof ConstantInfo.MethodType
|| constant instanceof ConstantInfo.InvokeDynamic) {
// not used yet
} else if (constant != null) { // Long/Double may leave create a blank space
throw new UnsupportedOperationException("Unhandled ConstantType: " + constant);
}
}
}
private void resolveConstantPoolReferences(ConstantInfo[] constantPool) {
for (ConstantInfo constant : constantPool) {
if (constant instanceof ConstantInfo.Class) {
ConstantInfo.Class info = (ConstantInfo.Class)constant;
info.setName(((ConstantInfo.Utf8)constantPool[info.getNameIndex() - 1]).getString());
} else if (constant instanceof ConstantInfo.Fieldref) {
ConstantInfo.Fieldref info = (ConstantInfo.Fieldref)constant;
info.setClassInfo((ConstantInfo.Class)constantPool[info.getClassIndex() - 1]);
info.setNameAndType((ConstantInfo.NameAndType)constantPool[info.getNameAndTypeIndex() - 1]);
} else if (constant instanceof ConstantInfo.Methodref) {
ConstantInfo.Methodref info = (ConstantInfo.Methodref)constant;
info.setClassInfo((ConstantInfo.Class)constantPool[info.getClassIndex() - 1]);
info.setNameAndType((ConstantInfo.NameAndType)constantPool[info.getNameAndTypeIndex() - 1]);
} else if (constant instanceof ConstantInfo.InterfaceMethodref) {
ConstantInfo.InterfaceMethodref info = (ConstantInfo.InterfaceMethodref)constant;
info.setClassInfo((ConstantInfo.Class)constantPool[info.getClassIndex() - 1]);
info.setNameAndType((ConstantInfo.NameAndType)constantPool[info.getNameAndTypeIndex() - 1]);
} else if (constant instanceof ConstantInfo.String) {
ConstantInfo.String info = (ConstantInfo.String)constant;
info.setString(((ConstantInfo.Utf8)constantPool[info.getStringIndex() - 1]).getString());
} else if (constant instanceof ConstantInfo.Integer
|| constant instanceof ConstantInfo.Float
|| constant instanceof ConstantInfo.Long
|| constant instanceof ConstantInfo.Double) {
// not needed
} else if (constant instanceof ConstantInfo.NameAndType) {
ConstantInfo.NameAndType info = (ConstantInfo.NameAndType)constant;
info.setName(((ConstantInfo.Utf8)constantPool[info.getNameIndex() - 1]).getString());
info.setDescriptor(((ConstantInfo.Utf8)constantPool[info.getDescriptorIndex() - 1]).getString());
} else if (constant instanceof ConstantInfo.Utf8) {
// not needed
} else if (constant instanceof ConstantInfo.MethodHandle
|| constant instanceof ConstantInfo.MethodType
|| constant instanceof ConstantInfo.InvokeDynamic) {
// not used yet
} else if (constant != null) { // Long/Double may leave create a blank space
throw new UnsupportedOperationException("Unhandled ConstantType: " + constant);
}
}
}
private void resolveConstantPoolReferences(ConstantInfo[] constantPool) {
for (ConstantInfo constant : constantPool) {
if (constant instanceof ConstantInfo.Class) {
ConstantInfo.Class info = (ConstantInfo.Class)constant;
info.setName(((ConstantInfo.Utf8)constantPool[info.getNameIndex() - 1]).getString());
} else if (constant instanceof ConstantInfo.Fieldref) {
ConstantInfo.Fieldref info = (ConstantInfo.Fieldref)constant;
info.setClassInfo((ConstantInfo.Class)constantPool[info.getClassIndex() - 1]);
info.setNameAndType((ConstantInfo.NameAndType)constantPool[info.getNameAndTypeIndex() - 1]);
} else if (constant instanceof ConstantInfo.Methodref) {
ConstantInfo.Methodref info = (ConstantInfo.Methodref)constant;
info.setClassInfo((ConstantInfo.Class)constantPool[info.getClassIndex() - 1]);
info.setNameAndType((ConstantInfo.NameAndType)constantPool[info.getNameAndTypeIndex() - 1]);
} else if (constant instanceof ConstantInfo.InterfaceMethodref) {
ConstantInfo.InterfaceMethodref info = (ConstantInfo.InterfaceMethodref)constant;
info.setClassInfo((ConstantInfo.Class)constantPool[info.getClassIndex() - 1]);
info.setNameAndType((ConstantInfo.NameAndType)constantPool[info.getNameAndTypeIndex() - 1]);
} else if (constant instanceof ConstantInfo.String) {
ConstantInfo.String info = (ConstantInfo.String)constant;
info.setString(((ConstantInfo.Utf8)constantPool[info.getStringIndex() - 1]).getString());
} else if (constant instanceof ConstantInfo.Integer
|| constant instanceof ConstantInfo.Float
|| constant instanceof ConstantInfo.Long
|| constant instanceof ConstantInfo.Double) {
// not needed
} else if (constant instanceof ConstantInfo.NameAndType) {
ConstantInfo.NameAndType info = (ConstantInfo.NameAndType)constant;
info.setName(((ConstantInfo.Utf8)constantPool[info.getNameIndex() - 1]).getString());
info.setDescriptor(((ConstantInfo.Utf8)constantPool[info.getDescriptorIndex() - 1]).getString());
} else if (constant instanceof ConstantInfo.Utf8) {
// not needed
} else if (constant instanceof ConstantInfo.MethodHandle
|| constant instanceof ConstantInfo.MethodType
|| constant instanceof ConstantInfo.InvokeDynamic) {
// not used yet
} else if (constant != null) { // Long/Double may leave create a blank space
throw new UnsupportedOperationException("Unhandled ConstantType: " + constant);
}
}
}