Skip to content

Commit 54e20a4

Browse files
committed
Javadoc fixes (#220)
1 parent 6405541 commit 54e20a4

14 files changed

+86
-47
lines changed

pom.xml

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -50,32 +50,6 @@
5050
<id>sonatype-oss-release</id>
5151
<build>
5252
<plugins>
53-
<plugin>
54-
<groupId>org.apache.maven.plugins</groupId>
55-
<artifactId>maven-source-plugin</artifactId>
56-
<version>3.3.1</version>
57-
<executions>
58-
<execution>
59-
<id>attach-sources</id>
60-
<goals>
61-
<goal>jar-no-fork</goal>
62-
</goals>
63-
</execution>
64-
</executions>
65-
</plugin>
66-
<plugin>
67-
<groupId>org.apache.maven.plugins</groupId>
68-
<artifactId>maven-javadoc-plugin</artifactId>
69-
<version>3.10.0</version>
70-
<executions>
71-
<execution>
72-
<id>attach-javadocs</id>
73-
<goals>
74-
<goal>jar</goal>
75-
</goals>
76-
</execution>
77-
</executions>
78-
</plugin>
7953
<plugin>
8054
<groupId>org.apache.maven.plugins</groupId>
8155
<artifactId>maven-gpg-plugin</artifactId>
@@ -178,6 +152,36 @@
178152
<extensions>true</extensions>
179153
</plugin>
180154

155+
<plugin>
156+
<groupId>org.apache.maven.plugins</groupId>
157+
<artifactId>maven-source-plugin</artifactId>
158+
<version>3.3.1</version>
159+
<executions>
160+
<execution>
161+
<id>attach-sources</id>
162+
<goals>
163+
<goal>jar-no-fork</goal>
164+
</goals>
165+
</execution>
166+
</executions>
167+
</plugin>
168+
<plugin>
169+
<groupId>org.apache.maven.plugins</groupId>
170+
<artifactId>maven-javadoc-plugin</artifactId>
171+
<version>3.10.0</version>
172+
<executions>
173+
<execution>
174+
<id>attach-javadocs</id>
175+
<goals>
176+
<goal>jar</goal>
177+
</goals>
178+
</execution>
179+
</executions>
180+
<configuration>
181+
<source>8</source>
182+
</configuration>
183+
</plugin>
184+
181185
<plugin>
182186
<groupId>org.moditect</groupId>
183187
<artifactId>moditect-maven-plugin</artifactId>

src/main/java/com/pivovarit/function/SneakyThrowUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016 the original author or authors.
2+
* Copyright 2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

src/main/java/com/pivovarit/function/ThrowingBiConsumer.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016 the original author or authors.
2+
* Copyright 2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -15,7 +15,7 @@
1515
*/
1616
package com.pivovarit.function;
1717
/*
18-
* Copyright 2016 the original author or authors.
18+
* Copyright 2024 the original author or authors.
1919
*
2020
* Licensed under the Apache License, Version 2.0 (the "License");
2121
* you may not use this file except in compliance with the License.
@@ -40,7 +40,7 @@
4040
* Represents an operation that accepts two input arguments and returns no
4141
* result. This is the two-arity specialization of {@link ThrowingConsumer}.
4242
* Unlike most other functional interfaces, {@code ThrowingBiConsumer} is expected
43-
* to operate via side-effects.
43+
* to operate via side effects.
4444
*
4545
* @param <T> the type of the first argument to the operation
4646
* @param <U> the type of the second argument to the operation
@@ -79,6 +79,9 @@ static <T, U> BiConsumer<T, U> unchecked(ThrowingBiConsumer<T, U, ?> consumer) {
7979

8080
/**
8181
* Returns a new BiConsumer instance which rethrows the checked exception using the Sneaky Throws pattern
82+
* @param consumer ThrowingBiConsumer operation throwing checked exception
83+
* @param <T> the type of the first argument to the operation
84+
* @param <U> the type of the second argument to the operation
8285
* @return BiConsumer instance that rethrows the checked exception using the Sneaky Throws pattern
8386
*/
8487
static <T, U> BiConsumer<T, U> sneaky(ThrowingBiConsumer<T, U, ?> consumer) {

src/main/java/com/pivovarit/function/ThrowingBiFunction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016 the original author or authors.
2+
* Copyright 2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

src/main/java/com/pivovarit/function/ThrowingBiPredicate.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016 the original author or authors.
2+
* Copyright 2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -42,7 +42,12 @@ static <T, U> BiPredicate<T, U> unchecked(ThrowingBiPredicate<T, U, ?> predicate
4242
}
4343

4444
/**
45+
* Returns a new BiPredicate instance which rethrows the checked exception using the Sneaky Throws pattern
46+
*
4547
* @return BiPredicate instance that rethrows the checked exception using the Sneaky Throws pattern
48+
* @param predicate operation throwing checked exception
49+
* @param <T> type of the first argument to the predicate
50+
* @param <U> type of the second argument to the predicate
4651
*/
4752
static <T, U> BiPredicate<T, U> sneaky(ThrowingBiPredicate<T, U, ?> predicate) {
4853
Objects.requireNonNull(predicate);

src/main/java/com/pivovarit/function/ThrowingBinaryOperator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016 the original author or authors.
2+
* Copyright 2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

src/main/java/com/pivovarit/function/ThrowingConsumer.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016 the original author or authors.
2+
* Copyright 2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -42,6 +42,8 @@ static <T> Consumer<T> unchecked(ThrowingConsumer<T, ?> consumer) {
4242

4343
/**
4444
* Returns a new BiConsumer instance which rethrows the checked exception using the Sneaky Throws pattern
45+
* @param consumer operation throwing checked exception
46+
* @param <T> type of the argument to the consumer
4547
* @return BiConsumer instance that rethrows the checked exception using the Sneaky Throws pattern
4648
*/
4749
static <T> Consumer<T> sneaky(ThrowingConsumer<T, ?> consumer) {

src/main/java/com/pivovarit/function/ThrowingFunction.java

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016 the original author or authors.
2+
* Copyright 2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -36,17 +36,36 @@ public interface ThrowingFunction<T, R, E extends Exception> {
3636
R apply(T arg) throws E;
3737

3838
/**
39+
* Returns a new Function instance which wraps a result of the given function in an Optional, returning an empty Optional in case of a checked exception
40+
*
41+
* @param f operation throwing checked exception
42+
* @param <T> type of the argument to the function
43+
* @param <R> type of the result of the function
3944
* @return a Function that returns the result of the given function as an Optional instance.
40-
* In case of a failure, empty Optional is returned
4145
*/
4246
static <T, R> Function<T, Optional<R>> lifted(final ThrowingFunction<T, R, ?> f) {
4347
return requireNonNull(f).lift();
4448
}
4549

50+
/**
51+
* Returns a new Function instance which rethrows the checked exception using the Sneaky Throws pattern
52+
*
53+
* @param f operation throwing checked exception
54+
* @param <T> type of the argument to the function
55+
* @param <R> type of the result of the function
56+
* @return Function instance that rethrows the checked exception using the Sneaky Throws pattern
57+
*/
4658
static <T, R> Function<T, R> unchecked(final ThrowingFunction<T, R, ?> f) {
4759
return requireNonNull(f).uncheck();
4860
}
4961

62+
/**
63+
* Returns a new Function instance which rethrows the checked exception using the Sneaky Throws pattern
64+
* @param function operation throwing checked exception
65+
* @param <T1> type of the argument to the function
66+
* @param <R> type of the result of the function
67+
* @return Function instance that rethrows the checked exception using the Sneaky Throws pattern
68+
*/
5069
static <T1, R> Function<T1, R> sneaky(ThrowingFunction<? super T1, ? extends R, ?> function) {
5170
requireNonNull(function);
5271
return t -> {

src/main/java/com/pivovarit/function/ThrowingIntFunction.java

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,12 @@
99
import static java.util.Objects.requireNonNull;
1010

1111
/**
12-
* Functional interface mirroring {@link IntFunction<R>} for primitive ints from the java.util.function package.
13-
* This allows wrapping a exceptions in a runtime exception: {@link WrappedException}
14-
* <p>
15-
* As this adheres to the {@link IntFunction} interface, compose and andThen (as you might be familiar with from
16-
* {@link java.util.function.Function} are not available.
12+
* Represents a function that accepts an int-valued argument and returns a value;
13+
* Function might throw a checked exception instance.
1714
*
1815
* @param <R> the type of the result of the function
1916
* @param <E> the type of the thrown checked exception
17+
* @author Grzegorz Piwowarek
2018
*/
2119
@FunctionalInterface
2220
public interface ThrowingIntFunction<R, E extends Exception> {
@@ -38,13 +36,21 @@ static <R> IntFunction<R> unchecked(final ThrowingIntFunction<R, ?> f) {
3836
}
3937

4038
/**
39+
* Returns a new Function instance which wraps a result of the given function in an Optional, returning an empty Optional in case of a checked exception
40+
* @param f operation throwing checked exception
41+
* @param <R> type of the result of the function
4142
* @return a Function that returns the result of the given function as an Optional instance.
42-
* In case of a failure, empty Optional is returned
4343
*/
4444
static <R> IntFunction<Optional<R>> lifted(final ThrowingIntFunction<R, ?> f) {
4545
return requireNonNull(f).lift();
4646
}
4747

48+
/**
49+
* Returns a new Function instance which rethrows the checked exception using the Sneaky Throws pattern
50+
* @param function operation throwing checked exception
51+
* @param <R> type of the result of the function
52+
* @return Function instance that rethrows the checked exception using the Sneaky Throws pattern
53+
*/
4854
static <R> IntFunction<R> sneaky(ThrowingIntFunction<? extends R, ?> function) {
4955
requireNonNull(function);
5056
return t -> {

src/main/java/com/pivovarit/function/ThrowingPredicate.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016 the original author or authors.
2+
* Copyright 2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)