void writeUntaggedValueChecked()

in src/main/java/com/jetbrains/jdi/PacketStream.java [279:349]


    void writeUntaggedValueChecked(Value val) throws InvalidTypeException {
        byte tag = ValueImpl.typeValueKey(val);
        if (isObjectTag(tag)) {
            if (val == null) {
                 writeObjectRef(0);
            } else {
                if (!(val instanceof ObjectReference)) {
                    throw new InvalidTypeException();
                }
                writeObjectRef(((ObjectReferenceImpl)val).ref());
            }
        } else {
            switch (tag) {
                case JDWP.Tag.BYTE:
                    if(!(val instanceof ByteValue))
                        throw new InvalidTypeException();

                    writeByte(((PrimitiveValue)val).byteValue());
                    break;

                case JDWP.Tag.CHAR:
                    if(!(val instanceof CharValue))
                        throw new InvalidTypeException();

                    writeChar(((PrimitiveValue)val).charValue());
                    break;

                case JDWP.Tag.FLOAT:
                    if(!(val instanceof FloatValue))
                        throw new InvalidTypeException();

                    writeFloat(((PrimitiveValue)val).floatValue());
                    break;

                case JDWP.Tag.DOUBLE:
                    if(!(val instanceof DoubleValue))
                        throw new InvalidTypeException();

                    writeDouble(((PrimitiveValue)val).doubleValue());
                    break;

                case JDWP.Tag.INT:
                    if(!(val instanceof IntegerValue))
                        throw new InvalidTypeException();

                    writeInt(((PrimitiveValue)val).intValue());
                    break;

                case JDWP.Tag.LONG:
                    if(!(val instanceof LongValue))
                        throw new InvalidTypeException();

                    writeLong(((PrimitiveValue)val).longValue());
                    break;

                case JDWP.Tag.SHORT:
                    if(!(val instanceof ShortValue))
                        throw new InvalidTypeException();

                    writeShort(((PrimitiveValue)val).shortValue());
                    break;

                case JDWP.Tag.BOOLEAN:
                    if(!(val instanceof BooleanValue))
                        throw new InvalidTypeException();

                    writeBoolean(((PrimitiveValue)val).booleanValue());
                    break;
            }
        }
    }