@SuppressWarnings("unchecked")
    static <T> T parseObject(ByteBuffer buffer, Class<T> objectClass) {
        if (buffer == null) {
            return null;
        }

        final JSONReader.Context context = JSONFactory.createReadContext();
        final ObjectReader<T> objectReader = context.getObjectReader(objectClass);

        try (JSONReader reader = JSONReader.of(buffer, null, context)) {
            T object = objectReader.readObject(reader, objectClass, null, 0);
            if (reader.resolveTasks != null) {
                reader.handleResolveTasks(object);
            }
            if (reader.ch != EOI && (context.features & IgnoreCheckClose.mask) == 0) {
                throw new JSONException(reader.info("input not end"));
            }
            return object;
        }
    }
Parses the json byte buffer as a {@link T}. Returns
{@code null} if received {@link ByteBuffer} is {@code null}.

@param buffer the specified buffer to be parsed
@param objectClass the specified class of {@link T}
@return {@link T} or {@code null}
@throws JSONException If a parsing error occurs
core/src/main/java/com/alibaba/fastjson2/JSON.java