private static void generateGetSerializedType( ClassDefinition definition, List<StateField> fields, CallSiteBinder callSiteBinder) { CompilerContext compilerContext = new CompilerContext(); Block body = definition .declareMethod(compilerContext, a(PUBLIC), "getSerializedType", type(Type.class)) .getBody(); Type type; if (fields.size() > 1) { type = VARCHAR; } else { Class<?> stackType = fields.get(0).getType(); if (stackType == long.class) { type = BIGINT; } else if (stackType == double.class) { type = DOUBLE; } else if (stackType == boolean.class) { type = BOOLEAN; } else if (stackType == byte.class) { type = BIGINT; } else if (stackType == Slice.class) { type = VARCHAR; } else { throw new IllegalArgumentException("Unsupported type: " + stackType); } } body.comment("return %s", type.getName()) .append(constantType(new CompilerContext(BOOTSTRAP_METHOD), callSiteBinder, type)) .retObject(); }