diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 6940d83ef..41f7de963 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -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
@@ -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
diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index 91393ed88..dbeb1ee3c 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.94.0"
+ ".": "0.94.1"
}
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9b1769bb7..5f3bb4369 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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)
diff --git a/README.md b/README.md
index ee8372ef3..d98d067b5 100644
--- a/README.md
+++ b/README.md
@@ -2,8 +2,8 @@
-[](https://central.sonatype.com/artifact/com.lithic.api/lithic-java/0.94.0)
-[](https://javadoc.io/doc/com.lithic.api/lithic-java/0.94.0)
+[](https://central.sonatype.com/artifact/com.lithic.api/lithic-java/0.94.1)
+[](https://javadoc.io/doc/com.lithic.api/lithic-java/0.94.1)
@@ -13,7 +13,7 @@ The Lithic Java SDK is similar to the Lithic Kotlin SDK but with minor differenc
-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).
@@ -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
@@ -33,7 +33,7 @@ implementation("com.lithic.api:lithic-java:0.94.0")
com.lithic.api
lithic-java
- 0.94.0
+ 0.94.1
```
diff --git a/build.gradle.kts b/build.gradle.kts
index f88a1bc96..2ec19e53c 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -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 {
diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/core/ClientOptions.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/core/ClientOptions.kt
index 177861737..47c918a90 100644
--- a/lithic-java-core/src/main/kotlin/com/lithic/api/core/ClientOptions.kt
+++ b/lithic-java-core/src/main/kotlin/com/lithic/api/core/ClientOptions.kt
@@ -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
@@ -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
diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/core/ClientOptionsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/core/ClientOptionsTest.kt
new file mode 100644
index 000000000..75e472f33
--- /dev/null
+++ b/lithic-java-core/src/test/kotlin/com/lithic/api/core/ClientOptionsTest.kt
@@ -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()
+ 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)
+ }
+}