@@ -83,17 +83,6 @@ public interface CheckedFunction3<T1 extends @Nullable Object, T2 extends @Nulla
8383 * // using a lambda reference
8484 * Function1<Integer, Integer> add3 = Function1.of(add1::apply);
8585 * }</pre>
86- * <p>
87- * <strong>Caution:</strong> Reflection loses type information of lambda references.
88- * <pre>{@code // type of a lambda expression
89- * Type<?, ?> type1 = add1.getType(); // (Integer) -> Integer
90- *
91- * // type of a method reference
92- * Type<?, ?> type2 = add2.getType(); // (Integer) -> Integer
93- *
94- * // type of a lambda reference
95- * Type<?, ?> type3 = add3.getType(); // (Object) -> Object
96- * }</pre>
9786 *
9887 * @param methodReference (typically) a method reference, e.g. {@code Type::method}
9988 * @param <R> return type
@@ -107,30 +96,34 @@ public interface CheckedFunction3<T1 extends @Nullable Object, T2 extends @Nulla
10796 }
10897
10998 /**
110- * Lifts the given {@code partialFunction} into a total function that returns an {@code Option} result.
99+ * Lifts the given {@code partialFunction} into a function that returns an {@code Option} result.
111100 *
112101 * @param partialFunction a function that is not defined for all values of the domain (e.g. by throwing)
113102 * @param <R> return type
114103 * @param <T1> 1st argument
115104 * @param <T2> 2nd argument
116105 * @param <T3> 3rd argument
117106 * @return a function that applies arguments to the given {@code partialFunction} and returns {@code Some(result)}
118- * if the function is defined for the given arguments, and {@code None} otherwise.
107+ * if the function is defined for the given arguments, and {@code None} if it throws a non-fatal
108+ * throwable. Fatal throwables (see {@link Try}) are rethrown
109+ * instead of being turned into {@code None}.
119110 */
120111 static <T1 extends @ Nullable Object , T2 extends @ Nullable Object , T3 extends @ Nullable Object , R extends @ Nullable Object > Function3 <T1 , T2 , T3 , Option <R >> lift (CheckedFunction3 <? super T1 , ? super T2 , ? super T3 , ? extends R > partialFunction ) {
121112 return (t1 , t2 , t3 ) -> Try .<R >of (() -> partialFunction .apply (t1 , t2 , t3 )).toOption ();
122113 }
123114
124115 /**
125- * Lifts the given {@code partialFunction} into a total function that returns an {@code Try} result.
116+ * Lifts the given {@code partialFunction} into a function that returns a {@code Try} result.
126117 *
127118 * @param partialFunction a function that is not defined for all values of the domain (e.g. by throwing)
128119 * @param <R> return type
129120 * @param <T1> 1st argument
130121 * @param <T2> 2nd argument
131122 * @param <T3> 3rd argument
132123 * @return a function that applies arguments to the given {@code partialFunction} and returns {@code Success(result)}
133- * if the function is defined for the given arguments, and {@code Failure(throwable)} otherwise.
124+ * if the function is defined for the given arguments, and {@code Failure(throwable)} if it throws a
125+ * non-fatal throwable. Fatal throwables (see {@link Try}) are rethrown
126+ * instead of being wrapped.
134127 */
135128 static <T1 extends @ Nullable Object , T2 extends @ Nullable Object , T3 extends @ Nullable Object , R extends @ Nullable Object > Function3 <T1 , T2 , T3 , Try <R >> liftTry (CheckedFunction3 <? super T1 , ? super T2 , ? super T3 , ? extends R > partialFunction ) {
136129 return (t1 , t2 , t3 ) -> Try .of (() -> partialFunction .apply (t1 , t2 , t3 ));
@@ -223,7 +216,8 @@ default CheckedFunction3<T3, T2, T1, R> reversed() {
223216 * Returns a memoizing version of this function, which computes the return value for given arguments only one time.
224217 * On subsequent calls given the same arguments the memoized value is returned.
225218 * <p>
226- * Please note that memoizing functions do not permit {@code null} as single argument or return value.
219+ * Note that {@code null} arguments and {@code null} return values are permitted; a {@code null} result
220+ * is cached like any other value.
227221 *
228222 * @return a memoizing function equivalent to this.
229223 */
@@ -297,7 +291,7 @@ default Function3<T1, T2, T3, R> unchecked() {
297291 }
298292
299293 /**
300- * Returns a composed function that first applies this CheckedFunction3 to the given argument and then applies
294+ * Returns a composed function that first applies this CheckedFunction3 to the given arguments and then applies
301295 * {@linkplain CheckedFunction1} {@code after} to the result.
302296 *
303297 * @param <V> return type of after
0 commit comments