Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
timeout-minutes: 10
name: lint
runs-on: ${{ github.repository == 'stainless-sdks/lithic-java' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork

steps:
- uses: actions/checkout@v4
Expand All @@ -39,6 +40,7 @@ jobs:
timeout-minutes: 10
name: test
runs-on: ${{ github.repository == 'stainless-sdks/lithic-java' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
steps:
- uses: actions/checkout@v4

Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.94.0"
".": "0.94.1"
}
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## 0.94.1 (2025-06-29)

Full Changelog: [v0.94.0...v0.94.1](https://github.com/lithic-com/lithic-java/compare/v0.94.0...v0.94.1)

### Bug Fixes

* **client:** don't close client on `withOptions` usage when original is gc'd ([17178c0](https://github.com/lithic-com/lithic-java/commit/17178c0dd0bd4c502f313014e6029b6df04090c5))


### Chores

* **ci:** only run for pushes and fork pull requests ([93f11e2](https://github.com/lithic-com/lithic-java/commit/93f11e24c131b1aeee9e8429eb2a681c46974a99))

## 0.94.0 (2025-06-27)

Full Changelog: [v0.93.0...v0.94.0](https://github.com/lithic-com/lithic-java/compare/v0.93.0...v0.94.0)
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

<!-- x-release-please-start-version -->

[![Maven Central](https://img.shields.io/maven-central/v/com.lithic.api/lithic-java)](https://central.sonatype.com/artifact/com.lithic.api/lithic-java/0.94.0)
[![javadoc](https://javadoc.io/badge2/com.lithic.api/lithic-java/0.94.0/javadoc.svg)](https://javadoc.io/doc/com.lithic.api/lithic-java/0.94.0)
[![Maven Central](https://img.shields.io/maven-central/v/com.lithic.api/lithic-java)](https://central.sonatype.com/artifact/com.lithic.api/lithic-java/0.94.1)
[![javadoc](https://javadoc.io/badge2/com.lithic.api/lithic-java/0.94.1/javadoc.svg)](https://javadoc.io/doc/com.lithic.api/lithic-java/0.94.1)

<!-- x-release-please-end -->

Expand All @@ -13,7 +13,7 @@ The Lithic Java SDK is similar to the Lithic Kotlin SDK but with minor differenc

<!-- x-release-please-start-version -->

The REST API documentation can be found on [docs.lithic.com](https://docs.lithic.com). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.lithic.api/lithic-java/0.94.0).
The REST API documentation can be found on [docs.lithic.com](https://docs.lithic.com). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.lithic.api/lithic-java/0.94.1).

<!-- x-release-please-end -->

Expand All @@ -24,7 +24,7 @@ The REST API documentation can be found on [docs.lithic.com](https://docs.lithic
### Gradle

```kotlin
implementation("com.lithic.api:lithic-java:0.94.0")
implementation("com.lithic.api:lithic-java:0.94.1")
```

### Maven
Expand All @@ -33,7 +33,7 @@ implementation("com.lithic.api:lithic-java:0.94.0")
<dependency>
<groupId>com.lithic.api</groupId>
<artifactId>lithic-java</artifactId>
<version>0.94.0</version>
<version>0.94.1</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repositories {

allprojects {
group = "com.lithic.api"
version = "0.94.0" // x-release-please-version
version = "0.94.1" // x-release-please-version
}

subprojects {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ private constructor(
webhookSecret = clientOptions.webhookSecret
}

fun httpClient(httpClient: HttpClient) = apply { this.httpClient = httpClient }
fun httpClient(httpClient: HttpClient) = apply {
this.httpClient = PhantomReachableClosingHttpClient(httpClient)
}

fun checkJacksonVersionCompatibility(checkJacksonVersionCompatibility: Boolean) = apply {
this.checkJacksonVersionCompatibility = checkJacksonVersionCompatibility
Expand Down Expand Up @@ -258,13 +260,11 @@ private constructor(

return ClientOptions(
httpClient,
PhantomReachableClosingHttpClient(
RetryingHttpClient.builder()
.httpClient(httpClient)
.clock(clock)
.maxRetries(maxRetries)
.build()
),
RetryingHttpClient.builder()
.httpClient(httpClient)
.clock(clock)
.maxRetries(maxRetries)
.build(),
checkJacksonVersionCompatibility,
jsonMapper,
streamHandlerExecutor
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// File generated from our OpenAPI spec by Stainless.

package com.lithic.api.core

import com.lithic.api.core.http.HttpClient
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.extension.ExtendWith
import org.mockito.junit.jupiter.MockitoExtension
import org.mockito.kotlin.mock
import org.mockito.kotlin.never
import org.mockito.kotlin.verify

@ExtendWith(MockitoExtension::class)
internal class ClientOptionsTest {

@Test
fun toBuilder_whenOriginalClientOptionsGarbageCollected_doesNotCloseOriginalClient() {
val httpClient = mock<HttpClient>()
var clientOptions =
ClientOptions.builder().httpClient(httpClient).apiKey("My Lithic API Key").build()
verify(httpClient, never()).close()

// Overwrite the `clientOptions` variable so that the original `ClientOptions` is GC'd.
clientOptions = clientOptions.toBuilder().build()
System.gc()
Thread.sleep(100)

verify(httpClient, never()).close()
// This exists so that `clientOptions` is still reachable.
assertThat(clientOptions).isEqualTo(clientOptions)
}
}