Skip to content

Commit aefa34a

Browse files
committed
refactor: make the onFailure to be typed when we use onFailure(RuntimeException.class)
1 parent 924d13d commit aefa34a

10 files changed

Lines changed: 255 additions & 42 deletions

File tree

implementation/revapi.json

Lines changed: 201 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,207 @@
5151
"criticality" : "highlight",
5252
"minSeverity" : "POTENTIALLY_BREAKING",
5353
"minCriticality" : "documented",
54-
"differences" : [ ]
54+
"differences" : [ {
55+
"ignore": true,
56+
"code": "java.method.returnTypeTypeParametersChanged",
57+
"old": "method io.smallrye.mutiny.groups.UniOnFailure<T> io.smallrye.mutiny.Uni<T>::onFailure()",
58+
"new": "method io.smallrye.mutiny.groups.UniOnFailure<T, ?> io.smallrye.mutiny.Uni<T>::onFailure()",
59+
"justification": "To allow expressing the type of the Throwable in case of onFailure(SomeException.class)"
60+
},
61+
{
62+
"ignore": true,
63+
"code": "java.method.returnTypeTypeParametersChanged",
64+
"old": "method io.smallrye.mutiny.groups.UniOnFailure<T> io.smallrye.mutiny.Uni<T>::onFailure(java.lang.Class<? extends java.lang.Throwable>)",
65+
"new": "method <TT extends java.lang.Throwable> io.smallrye.mutiny.groups.UniOnFailure<T, TT> io.smallrye.mutiny.Uni<T>::onFailure(java.lang.Class<TT>)",
66+
"justification": "To allow expressing the type of the Throwable in case of onFailure(SomeException.class)"
67+
},
68+
{
69+
"ignore": true,
70+
"code": "java.generics.elementNowParameterized",
71+
"old": "method io.smallrye.mutiny.groups.UniOnFailure<T> io.smallrye.mutiny.Uni<T>::onFailure(java.lang.Class<? extends java.lang.Throwable>)",
72+
"new": "method <TT extends java.lang.Throwable> io.smallrye.mutiny.groups.UniOnFailure<T, TT> io.smallrye.mutiny.Uni<T>::onFailure(java.lang.Class<TT>)",
73+
"justification": "To allow expressing the type of the Throwable in case of onFailure(SomeException.class)"
74+
},
75+
{
76+
"ignore": true,
77+
"code": "java.generics.formalTypeParameterAdded",
78+
"old": "method io.smallrye.mutiny.groups.UniOnFailure<T> io.smallrye.mutiny.Uni<T>::onFailure(java.lang.Class<? extends java.lang.Throwable>)",
79+
"new": "method <TT extends java.lang.Throwable> io.smallrye.mutiny.groups.UniOnFailure<T, TT> io.smallrye.mutiny.Uni<T>::onFailure(java.lang.Class<TT>)",
80+
"typeParameter": "TT extends java.lang.Throwable",
81+
"justification": "To allow expressing the type of the Throwable in case of onFailure(SomeException.class)"
82+
},
83+
{
84+
"ignore": true,
85+
"code": "java.method.returnTypeTypeParametersChanged",
86+
"old": "method io.smallrye.mutiny.groups.UniOnFailure<T> io.smallrye.mutiny.Uni<T>::onFailure(java.util.function.Predicate<? super java.lang.Throwable>)",
87+
"new": "method io.smallrye.mutiny.groups.UniOnFailure<T, ?> io.smallrye.mutiny.Uni<T>::onFailure(java.util.function.Predicate<? super java.lang.Throwable>)",
88+
"justification": "To allow expressing the type of the Throwable in case of onFailure(SomeException.class)"
89+
},
90+
{
91+
"ignore": true,
92+
"code": "java.method.numberOfParametersChanged",
93+
"old": "method void io.smallrye.mutiny.groups.UniOnFailure<T>::<init>(io.smallrye.mutiny.Uni<T>, java.util.function.Predicate<? super java.lang.Throwable>)",
94+
"new": "method void io.smallrye.mutiny.groups.UniOnFailure<T, TT extends java.lang.Throwable>::<init>(io.smallrye.mutiny.Uni<T>, java.lang.Class<TT>, java.util.function.Predicate<? super java.lang.Throwable>)",
95+
"justification": "To allow expressing the type of the Throwable in case of onFailure(SomeException.class)"
96+
},
97+
{
98+
"ignore": true,
99+
"code": "java.method.parameterTypeParameterChanged",
100+
"old": "parameter io.smallrye.mutiny.Uni<T> io.smallrye.mutiny.groups.UniOnFailure<T>::transform(===java.util.function.Function<? super java.lang.Throwable, ? extends java.lang.Throwable>===)",
101+
"new": "parameter io.smallrye.mutiny.Uni<T> io.smallrye.mutiny.groups.UniOnFailure<T, TT extends java.lang.Throwable>::transform(===java.util.function.Function<TT, ? extends java.lang.Throwable>===)",
102+
"parameterIndex": "0",
103+
"justification": "To allow expressing the type of the Throwable in case of onFailure(SomeException.class)"
104+
},
105+
{
106+
"ignore": true,
107+
"code": "java.generics.formalTypeParameterAdded",
108+
"old": "class io.smallrye.mutiny.groups.UniOnFailure<T>",
109+
"new": "class io.smallrye.mutiny.groups.UniOnFailure<T, TT extends java.lang.Throwable>",
110+
"typeParameter": "TT extends java.lang.Throwable",
111+
"justification": "To allow expressing the type of the Throwable in case of onFailure(SomeException.class)"
112+
},
113+
{
114+
"ignore": true,
115+
"code": "java.method.returnTypeTypeParametersChanged",
116+
"old": "method io.smallrye.mutiny.groups.UniOnFailure<T> io.smallrye.mutiny.operators.AbstractUni<T>::onFailure()",
117+
"new": "method io.smallrye.mutiny.groups.UniOnFailure<T, ? extends java.lang.Throwable> io.smallrye.mutiny.operators.AbstractUni<T>::onFailure()",
118+
"justification": "To allow expressing the type of the Throwable in case of onFailure(SomeException.class)"
119+
},
120+
{
121+
"ignore": true,
122+
"code": "java.method.returnTypeTypeParametersChanged",
123+
"old": "method io.smallrye.mutiny.groups.UniOnFailure<T> io.smallrye.mutiny.operators.AbstractUni<T>::onFailure(java.lang.Class<? extends java.lang.Throwable>)",
124+
"new": "method <TT extends java.lang.Throwable> io.smallrye.mutiny.groups.UniOnFailure<T, TT> io.smallrye.mutiny.operators.AbstractUni<T>::onFailure(java.lang.Class<TT>)",
125+
"justification": "To allow expressing the type of the Throwable in case of onFailure(SomeException.class)"
126+
},
127+
{
128+
"ignore": true,
129+
"code": "java.generics.elementNowParameterized",
130+
"old": "method io.smallrye.mutiny.groups.UniOnFailure<T> io.smallrye.mutiny.operators.AbstractUni<T>::onFailure(java.lang.Class<? extends java.lang.Throwable>)",
131+
"new": "method <TT extends java.lang.Throwable> io.smallrye.mutiny.groups.UniOnFailure<T, TT> io.smallrye.mutiny.operators.AbstractUni<T>::onFailure(java.lang.Class<TT>)",
132+
"justification": "To allow expressing the type of the Throwable in case of onFailure(SomeException.class)"
133+
},
134+
{
135+
"ignore": true,
136+
"code": "java.generics.formalTypeParameterAdded",
137+
"old": "method io.smallrye.mutiny.groups.UniOnFailure<T> io.smallrye.mutiny.operators.AbstractUni<T>::onFailure(java.lang.Class<? extends java.lang.Throwable>)",
138+
"new": "method <TT extends java.lang.Throwable> io.smallrye.mutiny.groups.UniOnFailure<T, TT> io.smallrye.mutiny.operators.AbstractUni<T>::onFailure(java.lang.Class<TT>)",
139+
"typeParameter": "TT extends java.lang.Throwable",
140+
"justification": "To allow expressing the type of the Throwable in case of onFailure(SomeException.class)"
141+
},
142+
{
143+
"ignore": true,
144+
"code": "java.method.returnTypeTypeParametersChanged",
145+
"old": "method io.smallrye.mutiny.groups.UniOnFailure<T> io.smallrye.mutiny.operators.AbstractUni<T>::onFailure(java.util.function.Predicate<? super java.lang.Throwable>)",
146+
"new": "method io.smallrye.mutiny.groups.UniOnFailure<T, ? extends java.lang.Throwable> io.smallrye.mutiny.operators.AbstractUni<T>::onFailure(java.util.function.Predicate<? super java.lang.Throwable>)",
147+
"justification": "To allow expressing the type of the Throwable in case of onFailure(SomeException.class)"
148+
},
149+
{
150+
"ignore": true,
151+
"code": "java.method.numberOfParametersChanged",
152+
"old": "method void io.smallrye.mutiny.operators.uni.UniOnFailureTransform<I, O>::<init>(io.smallrye.mutiny.Uni<I>, java.util.function.Predicate<? super java.lang.Throwable>, java.util.function.Function<? super java.lang.Throwable, ? extends java.lang.Throwable>)",
153+
"new": "method void io.smallrye.mutiny.operators.uni.UniOnFailureTransform<I, O, TT extends java.lang.Throwable>::<init>(io.smallrye.mutiny.Uni<I>, java.util.function.Predicate<? super java.lang.Throwable>, java.util.function.Function<TT, ? extends java.lang.Throwable>, java.lang.Class<TT>)",
154+
"justification": "To allow expressing the type of the Throwable in case of onFailure(SomeException.class)"
155+
},
156+
{
157+
"ignore": true,
158+
"code": "java.generics.formalTypeParameterAdded",
159+
"old": "class io.smallrye.mutiny.operators.uni.UniOnFailureTransform<I, O>",
160+
"new": "class io.smallrye.mutiny.operators.uni.UniOnFailureTransform<I, O, TT extends java.lang.Throwable>",
161+
"typeParameter": "TT extends java.lang.Throwable",
162+
"justification": "To allow expressing the type of the Throwable in case of onFailure(SomeException.class)"
163+
},
164+
{
165+
"ignore": true,
166+
"code": "java.method.parameterTypeParameterChanged",
167+
"old": "parameter io.smallrye.mutiny.Uni<T> io.smallrye.mutiny.groups.UniOnFailure<T>::call(===java.util.function.Function<java.lang.Throwable, io.smallrye.mutiny.Uni<?>>===)",
168+
"new": "parameter io.smallrye.mutiny.Uni<T> io.smallrye.mutiny.groups.UniOnFailure<T, TT extends java.lang.Throwable>::call(===java.util.function.Function<TT, io.smallrye.mutiny.Uni<?>>===)",
169+
"parameterIndex": "0",
170+
"justification": "To allow expressing the type of the Throwable in case of onFailure(SomeException.class)"
171+
},
172+
{
173+
"ignore": true,
174+
"code": "java.method.parameterTypeParameterChanged",
175+
"old": "parameter io.smallrye.mutiny.Uni<T> io.smallrye.mutiny.groups.UniOnFailure<T>::invoke(===java.util.function.Consumer<java.lang.Throwable>===)",
176+
"new": "parameter io.smallrye.mutiny.Uni<T> io.smallrye.mutiny.groups.UniOnFailure<T, TT extends java.lang.Throwable>::invoke(===java.util.function.Consumer<TT>===)",
177+
"parameterIndex": "0",
178+
"justification": "To allow expressing the type of the Throwable in case of onFailure(SomeException.class)"
179+
},
180+
{
181+
"ignore": true,
182+
"code": "java.method.parameterTypeParameterChanged",
183+
"old": "parameter io.smallrye.mutiny.Uni<T> io.smallrye.mutiny.groups.UniOnFailure<T>::recoverWithItem(===java.util.function.Function<? super java.lang.Throwable, ? extends T>===)",
184+
"new": "parameter io.smallrye.mutiny.Uni<T> io.smallrye.mutiny.groups.UniOnFailure<T, TT extends java.lang.Throwable>::recoverWithItem(===java.util.function.Function<TT, ? extends T>===)",
185+
"parameterIndex": "0",
186+
"justification": "To allow expressing the type of the Throwable in case of onFailure(SomeException.class)"
187+
},
188+
{
189+
"ignore": true,
190+
"code": "java.method.parameterTypeParameterChanged",
191+
"old": "parameter io.smallrye.mutiny.Uni<T> io.smallrye.mutiny.groups.UniOnFailure<T>::recoverWithUni(===java.util.function.Function<? super java.lang.Throwable, io.smallrye.mutiny.Uni<? extends T>>===)",
192+
"new": "parameter io.smallrye.mutiny.Uni<T> io.smallrye.mutiny.groups.UniOnFailure<T, TT extends java.lang.Throwable>::recoverWithUni(===java.util.function.Function<TT, io.smallrye.mutiny.Uni<? extends T>>===)",
193+
"parameterIndex": "0",
194+
"justification": "To allow expressing the type of the Throwable in case of onFailure(SomeException.class)"
195+
},
196+
{
197+
"ignore": true,
198+
"code": "java.method.numberOfParametersChanged",
199+
"old": "method void io.smallrye.mutiny.operators.uni.UniOnFailureFlatMap<I>::<init>(io.smallrye.mutiny.Uni<I>, java.util.function.Predicate<? super java.lang.Throwable>, java.util.function.Function<? super java.lang.Throwable, io.smallrye.mutiny.Uni<? extends I>>)",
200+
"new": "method void io.smallrye.mutiny.operators.uni.UniOnFailureFlatMap<I, TT>::<init>(io.smallrye.mutiny.Uni<I>, java.util.function.Predicate<? super java.lang.Throwable>, java.util.function.Function<TT, io.smallrye.mutiny.Uni<? extends I>>, java.lang.Class<TT>)",
201+
"justification": "To allow expressing the type of the Throwable in case of onFailure(SomeException.class)"
202+
},
203+
{
204+
"ignore": true,
205+
"code": "java.generics.formalTypeParameterAdded",
206+
"old": "class io.smallrye.mutiny.operators.uni.UniOnFailureFlatMap<I>",
207+
"new": "class io.smallrye.mutiny.operators.uni.UniOnFailureFlatMap<I, TT>",
208+
"typeParameter": "TT",
209+
"justification": "To allow expressing the type of the Throwable in case of onFailure(SomeException.class)"
210+
},
211+
{
212+
"ignore": true,
213+
"code": "java.method.numberOfParametersChanged",
214+
"old": "method void io.smallrye.mutiny.operators.uni.UniOnItemConsume<T>::<init>(io.smallrye.mutiny.Uni<? extends T>, java.util.function.Consumer<? super T>, java.util.function.Consumer<java.lang.Throwable>, java.util.function.Predicate<? super java.lang.Throwable>)",
215+
"new": "method void io.smallrye.mutiny.operators.uni.UniOnItemConsume<T, TT>::<init>(io.smallrye.mutiny.Uni<? extends T>, java.util.function.Consumer<? super T>, java.util.function.Consumer<TT>, java.util.function.Predicate<? super java.lang.Throwable>, java.lang.Class<TT>)",
216+
"justification": "To allow expressing the type of the Throwable in case of onFailure(SomeException.class)"
217+
},
218+
{
219+
"ignore": true,
220+
"code": "java.generics.formalTypeParameterAdded",
221+
"old": "class io.smallrye.mutiny.operators.uni.UniOnItemConsume<T>",
222+
"new": "class io.smallrye.mutiny.operators.uni.UniOnItemConsume<T, TT>",
223+
"typeParameter": "TT",
224+
"justification": "To allow expressing the type of the Throwable in case of onFailure(SomeException.class)"
225+
},
226+
{
227+
"ignore": true,
228+
"code": "java.method.returnTypeTypeParametersChanged",
229+
"old": "method io.smallrye.mutiny.groups.UniOnFailure<T> io.smallrye.mutiny.Uni<T>::onFailure()",
230+
"new": "method io.smallrye.mutiny.groups.UniOnFailure<T, java.lang.Throwable> io.smallrye.mutiny.Uni<T>::onFailure()",
231+
"justification": "To allow expressing the type of the Throwable in case of onFailure(SomeException.class)"
232+
},
233+
{
234+
"ignore": true,
235+
"code": "java.method.returnTypeTypeParametersChanged",
236+
"old": "method io.smallrye.mutiny.groups.UniOnFailure<T> io.smallrye.mutiny.Uni<T>::onFailure(java.util.function.Predicate<? super java.lang.Throwable>)",
237+
"new": "method io.smallrye.mutiny.groups.UniOnFailure<T, java.lang.Throwable> io.smallrye.mutiny.Uni<T>::onFailure(java.util.function.Predicate<? super java.lang.Throwable>)",
238+
"justification": "To allow expressing the type of the Throwable in case of onFailure(SomeException.class)"
239+
},
240+
{
241+
"ignore": true,
242+
"code": "java.method.returnTypeTypeParametersChanged",
243+
"old": "method io.smallrye.mutiny.groups.UniOnFailure<T> io.smallrye.mutiny.operators.AbstractUni<T>::onFailure()",
244+
"new": "method io.smallrye.mutiny.groups.UniOnFailure<T, java.lang.Throwable> io.smallrye.mutiny.operators.AbstractUni<T>::onFailure()",
245+
"justification": "To allow expressing the type of the Throwable in case of onFailure(SomeException.class)"
246+
},
247+
{
248+
"ignore": true,
249+
"code": "java.method.returnTypeTypeParametersChanged",
250+
"old": "method io.smallrye.mutiny.groups.UniOnFailure<T> io.smallrye.mutiny.operators.AbstractUni<T>::onFailure(java.util.function.Predicate<? super java.lang.Throwable>)",
251+
"new": "method io.smallrye.mutiny.groups.UniOnFailure<T, java.lang.Throwable> io.smallrye.mutiny.operators.AbstractUni<T>::onFailure(java.util.function.Predicate<? super java.lang.Throwable>)",
252+
"justification": "To allow expressing the type of the Throwable in case of onFailure(SomeException.class)"
253+
}
254+
]
55255
}
56256
}, {
57257
"extension" : "revapi.reporter.json",

implementation/src/main/java/io/smallrye/mutiny/Uni.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ default UniAwait<T> awaitUsing(Context context) {
259259
* @return a UniOnFailure on which you can specify the on failure action
260260
*/
261261
@CheckReturnValue
262-
UniOnFailure<T> onFailure();
262+
UniOnFailure<T, Throwable> onFailure();
263263

264264
/**
265265
* Configures a predicate filtering the failures on which the behavior (specified with the returned
@@ -275,7 +275,7 @@ default UniAwait<T> awaitUsing(Context context) {
275275
* @return a UniOnFailure configured with the given predicate on which you can specify the on failure action
276276
*/
277277
@CheckReturnValue
278-
UniOnFailure<T> onFailure(Predicate<? super Throwable> predicate);
278+
UniOnFailure<T, Throwable> onFailure(Predicate<? super Throwable> predicate);
279279

280280
/**
281281
* Configures a type of failure filtering the failures on which the behavior (specified with the returned
@@ -291,7 +291,7 @@ default UniAwait<T> awaitUsing(Context context) {
291291
* @return a UniOnFailure configured with the given predicate on which you can specify the on failure action
292292
*/
293293
@CheckReturnValue
294-
UniOnFailure<T> onFailure(Class<? extends Throwable> typeOfFailure);
294+
<TT extends Throwable> UniOnFailure<T, TT> onFailure(Class<TT> typeOfFailure);
295295

296296
/**
297297
* Produces a {@link Uni} reacting when a no item event is fired by the upstream uni during the specified time

0 commit comments

Comments
 (0)