Skip to content

Commit 1b0f366

Browse files
committed
Refactored UncheckedException to allow creating instances with and without stack trace
Without stack trace is the default, causing to more lightweight exceptions
1 parent 1e5a362 commit 1b0f366

90 files changed

Lines changed: 548 additions & 401 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/main/java/com/github/robtimus/function/throwing/ThrowingBiConsumer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,12 +221,12 @@ default BiConsumer<T, U> onErrorDiscard() {
221221

222222
/**
223223
* Returns an operation that performs this operation on its input. Any checked exception thrown by this operation is wrapped in an
224-
* {@link UncheckedException}.
224+
* {@link UncheckedException} {@linkplain UncheckedException#withoutStackTrace(Throwable) without a stack trace}.
225225
*
226226
* @return An operation that wraps any checked exception in an {@link UncheckedException}.
227227
*/
228228
default BiConsumer<T, U> unchecked() {
229-
return onErrorThrowAsUnchecked(UncheckedException::new);
229+
return onErrorThrowAsUnchecked(UncheckedException::withoutStackTrace);
230230
}
231231

232232
/**

src/main/java/com/github/robtimus/function/throwing/ThrowingBiFunction.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,12 +269,12 @@ default BiFunction<T, U, R> onErrorReturn(R fallback) {
269269

270270
/**
271271
* Returns a function that applies this function to its input. Any checked exception thrown by this function is wrapped in an
272-
* {@link UncheckedException}.
272+
* {@link UncheckedException} {@linkplain UncheckedException#withoutStackTrace(Throwable) without a stack trace}.
273273
*
274274
* @return A function that wraps any checked exception in an {@link UncheckedException}.
275275
*/
276276
default BiFunction<T, U, R> unchecked() {
277-
return onErrorThrowAsUnchecked(UncheckedException::new);
277+
return onErrorThrowAsUnchecked(UncheckedException::withoutStackTrace);
278278
}
279279

280280
/**

src/main/java/com/github/robtimus/function/throwing/ThrowingBiPredicate.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,12 +292,12 @@ default BiPredicate<T, U> onErrorReturn(boolean fallback) {
292292

293293
/**
294294
* Returns a predicate that evaluates this predicate on its input. Any checked exception thrown by this predicate is wrapped in an
295-
* {@link UncheckedException}.
295+
* {@link UncheckedException} {@linkplain UncheckedException#withoutStackTrace(Throwable) without a stack trace}.
296296
*
297297
* @return A predicate that wraps any checked exception in an {@link UncheckedException}.
298298
*/
299299
default BiPredicate<T, U> unchecked() {
300-
return onErrorThrowAsUnchecked(UncheckedException::new);
300+
return onErrorThrowAsUnchecked(UncheckedException::withoutStackTrace);
301301
}
302302

303303
/**

src/main/java/com/github/robtimus/function/throwing/ThrowingBinaryOperator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ default BinaryOperator<T> onErrorReturn(T fallback) {
177177

178178
@Override
179179
default BinaryOperator<T> unchecked() {
180-
return onErrorThrowAsUnchecked(UncheckedException::new);
180+
return onErrorThrowAsUnchecked(UncheckedException::withoutStackTrace);
181181
}
182182

183183
/**

src/main/java/com/github/robtimus/function/throwing/ThrowingBooleanSupplier.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,12 +203,12 @@ default BooleanSupplier onErrorReturn(boolean fallback) {
203203

204204
/**
205205
* Returns a supplier that applies this supplier to its input. Any checked exception thrown by this supplier is wrapped in an
206-
* {@link UncheckedException}.
206+
* {@link UncheckedException} {@linkplain UncheckedException#withoutStackTrace(Throwable) without a stack trace}.
207207
*
208208
* @return A supplier that wraps any checked exception in an {@link UncheckedException}.
209209
*/
210210
default BooleanSupplier unchecked() {
211-
return onErrorThrowAsUnchecked(UncheckedException::new);
211+
return onErrorThrowAsUnchecked(UncheckedException::withoutStackTrace);
212212
}
213213

214214
/**

src/main/java/com/github/robtimus/function/throwing/ThrowingConsumer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,12 +218,12 @@ default Consumer<T> onErrorDiscard() {
218218

219219
/**
220220
* Returns an operation that performs this operation on its input. Any checked exception thrown by this operation is wrapped in an
221-
* {@link UncheckedException}.
221+
* {@link UncheckedException} {@linkplain UncheckedException#withoutStackTrace(Throwable) without a stack trace}.
222222
*
223223
* @return An operation that wraps any checked exception in an {@link UncheckedException}.
224224
*/
225225
default Consumer<T> unchecked() {
226-
return onErrorThrowAsUnchecked(UncheckedException::new);
226+
return onErrorThrowAsUnchecked(UncheckedException::withoutStackTrace);
227227
}
228228

229229
/**

src/main/java/com/github/robtimus/function/throwing/ThrowingDoubleBinaryOperator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,12 +251,12 @@ default DoubleBinaryOperator onErrorReturn(double fallback) {
251251

252252
/**
253253
* Returns a binary operator that applies this operator to its input. Any checked exception thrown by this operator is wrapped in an
254-
* {@link UncheckedException}.
254+
* {@link UncheckedException} {@linkplain UncheckedException#withoutStackTrace(Throwable) without a stack trace}.
255255
*
256256
* @return A binary operator that wraps any checked exception in an {@link UncheckedException}.
257257
*/
258258
default DoubleBinaryOperator unchecked() {
259-
return onErrorThrowAsUnchecked(UncheckedException::new);
259+
return onErrorThrowAsUnchecked(UncheckedException::withoutStackTrace);
260260
}
261261

262262
/**

src/main/java/com/github/robtimus/function/throwing/ThrowingDoubleConsumer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,12 +218,12 @@ default DoubleConsumer onErrorDiscard() {
218218

219219
/**
220220
* Returns an operation that performs this operation on its input. Any checked exception thrown by this operation is wrapped in an
221-
* {@link UncheckedException}.
221+
* {@link UncheckedException} {@linkplain UncheckedException#withoutStackTrace(Throwable) without a stack trace}.
222222
*
223223
* @return An operation that wraps any checked exception in an {@link UncheckedException}.
224224
*/
225225
default DoubleConsumer unchecked() {
226-
return onErrorThrowAsUnchecked(UncheckedException::new);
226+
return onErrorThrowAsUnchecked(UncheckedException::withoutStackTrace);
227227
}
228228

229229
/**

src/main/java/com/github/robtimus/function/throwing/ThrowingDoubleFunction.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,12 +250,12 @@ default DoubleFunction<R> onErrorReturn(R fallback) {
250250

251251
/**
252252
* Returns a function that applies this function to its input. Any checked exception thrown by this function is wrapped in an
253-
* {@link UncheckedException}.
253+
* {@link UncheckedException} {@linkplain UncheckedException#withoutStackTrace(Throwable) without a stack trace}.
254254
*
255255
* @return A function that wraps any checked exception in an {@link UncheckedException}.
256256
*/
257257
default DoubleFunction<R> unchecked() {
258-
return onErrorThrowAsUnchecked(UncheckedException::new);
258+
return onErrorThrowAsUnchecked(UncheckedException::withoutStackTrace);
259259
}
260260

261261
/**

src/main/java/com/github/robtimus/function/throwing/ThrowingDoublePredicate.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,12 +289,12 @@ default DoublePredicate onErrorReturn(boolean fallback) {
289289

290290
/**
291291
* Returns a predicate that evaluates this predicate on its input. Any checked exception thrown by this predicate is wrapped in an
292-
* {@link UncheckedException}.
292+
* {@link UncheckedException} {@linkplain UncheckedException#withoutStackTrace(Throwable) without a stack trace}.
293293
*
294294
* @return A predicate that wraps any checked exception in an {@link UncheckedException}.
295295
*/
296296
default DoublePredicate unchecked() {
297-
return onErrorThrowAsUnchecked(UncheckedException::new);
297+
return onErrorThrowAsUnchecked(UncheckedException::withoutStackTrace);
298298
}
299299

300300
/**

0 commit comments

Comments
 (0)