alef 0.68.0

Opinionated polyglot binding generator for Rust libraries
Documentation
    private static <T> java.util.List<T> readJsonList(MemorySegment resultPtr, com.fasterxml.jackson.core.type.TypeReference<java.util.List<T>> typeRef) throws {{ class_name }}Exception {
        try {
            if (resultPtr.equals(MemorySegment.NULL)) {
                checkLastError();
                return java.util.List.of();
            }
            Throwable conversionFailure = null;
            try {
                String json = resultPtr.reinterpret(Long.MAX_VALUE).getString(0);
                return MAPPER.readValue(json, typeRef);
            } catch (Throwable failure) {
                conversionFailure = failure;
                throw failure;
            } finally {
                try {
                    {{ free_handle }}.invoke(resultPtr);
                } catch (Throwable cleanupFailure) {
                    if (conversionFailure != null) conversionFailure.addSuppressed(cleanupFailure);
                    else throw cleanupFailure;
                }
            }
        } catch (Throwable e) {
            throw new {{ class_name }}Exception("FFI call failed", e);
        }
    }