Skip to content

Commit 2f20c3c

Browse files
committed
build: fix some javadoc warnings and errors
1 parent d0bf83a commit 2f20c3c

40 files changed

+567
-140
lines changed

etc/javadoc.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
DIR=$(cd "$(dirname "$0")"; pwd)
44

5-
mvn javadoc:javadoc -P source -Dmaven.plugin.validation=VERBOSE
5+
mvn javadoc:javadoc -P source -Dmaven.plugin.validation=VERBOSE -Dmaven.javadoc.failOnError=true -Dmaven.javadoc.failOnWarnings=true

jooby/src/main/java/io/jooby/ForwardingContext.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ public class ForwardingContext implements Context {
4141
public static class ForwardingBody implements Body {
4242
protected final Body delegate;
4343

44+
/**
45+
* Creates a new instance.
46+
*
47+
* @param body Underlying body.
48+
*/
4449
public ForwardingBody(Body body) {
4550
this.delegate = body;
4651
}
@@ -322,6 +327,11 @@ public Map<String, String> toMap() {
322327
public static class ForwardingValue implements Value {
323328
protected final Value delegate;
324329

330+
/**
331+
* Creates a new instance.
332+
*
333+
* @param delegate Underlying value.
334+
*/
325335
public ForwardingValue(Value delegate) {
326336
this.delegate = delegate;
327337
}
@@ -561,6 +571,11 @@ public Map<String, String> toMap() {
561571

562572
/** Forwarding/Delegate pattern over {@link QueryString}. */
563573
public static class ForwardingQueryString extends ForwardingValue implements QueryString {
574+
/**
575+
* Creates a new instance.
576+
*
577+
* @param queryString Underlying query string.
578+
*/
564579
public ForwardingQueryString(QueryString queryString) {
565580
super(queryString);
566581
}
@@ -578,6 +593,11 @@ public String queryString() {
578593

579594
/** Forwarding/Delegate pattern over {@link Formdata}. */
580595
public static class ForwardingFormdata extends ForwardingValue implements Formdata {
596+
/**
597+
* Creates a new instance.
598+
*
599+
* @param delegate Underlying formdata.
600+
*/
581601
public ForwardingFormdata(Formdata delegate) {
582602
super(delegate);
583603
}
@@ -640,6 +660,11 @@ public Context setUser(@Nullable Object user) {
640660
return this;
641661
}
642662

663+
/**
664+
* Get the underlying context.
665+
*
666+
* @return Get the underlying context.
667+
*/
643668
public Context getDelegate() {
644669
return ctx;
645670
}

jooby/src/main/java/io/jooby/Jooby.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,13 @@ public ServiceRegistry getServices() {
783783
return basePackage;
784784
}
785785

786+
/**
787+
* Set the base package, it has no direct effect on how jooby works but some modules might use it
788+
* for package scanning. Defaults is main application package.
789+
*
790+
* @param basePackage Application base package.
791+
* @return This instance.
792+
*/
786793
public Jooby setBasePackage(@Nullable String basePackage) {
787794
this.basePackage = basePackage;
788795
return this;

jooby/src/main/java/io/jooby/LoggingService.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ public interface LoggingService {
6262
* @param classLoader Class loader to use.
6363
* @param names Actives environment names. Useful for choosing an environment specific logging
6464
* configuration file.
65+
* @return Location of logging configuration file or <code>null</code>.
6566
*/
6667
static @Nullable String configure(@NonNull ClassLoader classLoader, @NonNull List<String> names) {
6768
// Supported well-know implementation
@@ -133,6 +134,12 @@ public interface LoggingService {
133134
return null;
134135
}
135136

137+
/**
138+
* True when path contains one of: <code>target, build, bin</code> directories.
139+
*
140+
* @param path Path to test.
141+
* @return True when path contains one of: <code>target, build, bin</code> directories.
142+
*/
136143
static boolean isBinary(Path path) {
137144
var bin = Set.of("target", "build", "bin");
138145
return StreamSupport.stream(path.spliterator(), false)

jooby/src/main/java/io/jooby/MapModelAndView.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import edu.umd.cs.findbugs.annotations.NonNull;
1313
import edu.umd.cs.findbugs.annotations.Nullable;
1414

15+
/** A {@link ModelAndView} which uses a map as model. */
1516
public class MapModelAndView extends ModelAndView<Map<String, Object>> {
1617
/**
1718
* Creates a new model and view.

jooby/src/main/java/io/jooby/OpenAPIModule.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ public class OpenAPIModule implements Extension {
4141

4242
private static class OpenAPIAsset implements Asset {
4343

44-
private long lastModified;
44+
private final long lastModified;
4545

46-
private byte[] content;
46+
private final byte[] content;
4747

48-
private MediaType type;
48+
private final MediaType type;
4949

5050
OpenAPIAsset(MediaType type, byte[] content, long lastModified) {
5151
this.content = content;
@@ -68,7 +68,7 @@ public boolean isDirectory() {
6868
return false;
6969
}
7070

71-
@NonNull @Override
71+
@Override
7272
public MediaType getContentType() {
7373
return type;
7474
}
@@ -107,6 +107,12 @@ public enum Format {
107107
/** YAML. */
108108
YAML;
109109

110+
/**
111+
* Find format based on files extension.
112+
*
113+
* @param filePath File name.
114+
* @return File format.
115+
*/
110116
public static Format from(@NonNull String filePath) {
111117
for (Format value : values()) {
112118
if (filePath.endsWith("." + value.name().toLowerCase())) {

jooby/src/main/java/io/jooby/ReactiveSupport.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ public class ReactiveSupport {
2121

2222
private static final Route.Filter CONCURRENT = new ConcurrentHandler();
2323

24+
private ReactiveSupport() {}
25+
2426
/**
2527
* Creates a subscriber from web context.
2628
*
@@ -41,6 +43,12 @@ public static Route.Filter concurrent() {
4143
return CONCURRENT;
4244
}
4345

46+
/**
47+
* Handler for {@link CompletionStage} and {@link Flow.Publisher} result types.
48+
*
49+
* @param next Next handler in pipeline.
50+
* @return A new wrapped route handler.
51+
*/
4452
public static Route.Handler concurrent(Route.Handler next) {
4553
return CONCURRENT.then(next);
4654
}

jooby/src/main/java/io/jooby/Reified.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ public static <T> Reified<CompletableFuture<T>> completableFuture(@NonNull Type
269269
*
270270
* @param rawType Raw type.
271271
* @param typeArguments Parameter types.
272+
* @param <T> Target type.
272273
* @return Gets type literal for the parameterized type represented by applying {@code
273274
* typeArguments} to {@code rawType}.
274275
*/
@@ -283,6 +284,7 @@ public static <T> Reified<T> getParameterized(
283284
*
284285
* @param rawType Raw type.
285286
* @param argument Parameter types.
287+
* @param <T> Target type.
286288
* @return Gets type literal for the parameterized type represented by applying {@code
287289
* typeArguments} to {@code rawType}.
288290
*/

jooby/src/main/java/io/jooby/Route.java

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
import java.lang.reflect.Method;
1414
import java.util.*;
1515
import java.util.concurrent.Executor;
16-
import java.util.function.Consumer;
17-
import java.util.function.Predicate;
1816
import java.util.stream.Stream;
1917

2018
import edu.umd.cs.findbugs.annotations.NonNull;
@@ -253,6 +251,10 @@ public interface Complete {
253251
void apply(@NonNull Context ctx) throws Exception;
254252
}
255253

254+
/**
255+
* Callback that allow to customize a route while the route pipeline is being created. The {@link
256+
* #setRoute(Route)} is called once at application startup time.
257+
*/
256258
public interface Aware {
257259
/**
258260
* Allows a handler to listen for route metadata.
@@ -277,7 +279,7 @@ public interface Handler extends Serializable, Aware {
277279
* @return Route response.
278280
* @throws Exception If something goes wrong.
279281
*/
280-
@NonNull Object apply(@NonNull Context ctx) throws Exception;
282+
Object apply(@NonNull Context ctx) throws Exception;
281283

282284
/**
283285
* Chain this after decorator with next and produces a new decorator.
@@ -722,7 +724,7 @@ public boolean isNonBlockingSet() {
722724
* your application using {@link ExecutionMode#EVENT_LOOP}.
723725
*
724726
* @param nonBlocking True for non-blocking routes.
725-
* @return
727+
* @return This route.
726728
*/
727729
public Route setNonBlocking(boolean nonBlocking) {
728730
this.nonBlocking = nonBlocking;
@@ -1176,6 +1178,11 @@ public static class Set implements Iterable<Route> {
11761178

11771179
private String description;
11781180

1181+
/**
1182+
* Set of routes.
1183+
*
1184+
* @param routes Routes.
1185+
*/
11791186
public Set(List<Route> routes) {
11801187
this.routes = routes;
11811188
}
@@ -1384,10 +1391,6 @@ public Set description(@Nullable String description) {
13841391
return setDescription(description);
13851392
}
13861393

1387-
public void forEach(Predicate<Route> predicate, Consumer<? super Route> action) {
1388-
routes.stream().filter(predicate).forEach(action);
1389-
}
1390-
13911394
@Override
13921395
public Iterator<Route> iterator() {
13931396
return routes.iterator();

jooby/src/main/java/io/jooby/Router.java

Lines changed: 44 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,18 @@ interface Match {
6565
/**
6666
* Executes matched route.
6767
*
68-
* @param context not null.
69-
* @param pipeline Handler.
68+
* @param context Web Context.
69+
* @param pipeline Route pipeline.
70+
* @return route response.
7071
*/
7172
Object execute(@NonNull Context context, @NonNull Route.Handler pipeline);
7273

74+
/**
75+
* Executes matched route.
76+
*
77+
* @param context Web Context.
78+
* @return route response.
79+
*/
7380
default Object execute(@NonNull Context context) {
7481
return execute(context, route().getPipeline());
7582
}
@@ -202,10 +209,20 @@ default Object execute(@NonNull Context context) {
202209
*
203210
* @return Application context path (a.k.a as base path).
204211
*/
205-
@NonNull String getContextPath();
212+
String getContextPath();
206213

214+
/**
215+
* True when router started.
216+
*
217+
* @return True when router started.
218+
*/
207219
boolean isStarted();
208220

221+
/**
222+
* True when router stopped.
223+
*
224+
* @return True when router stopped.
225+
*/
209226
boolean isStopped();
210227

211228
/**
@@ -450,17 +467,22 @@ default Object execute(@NonNull Context context) {
450467
* @param worker Default worker thread pool.
451468
* @return This router.
452469
*/
453-
@NonNull Router setDefaultWorker(@NonNull Executor worker);
470+
Router setDefaultWorker(@NonNull Executor worker);
454471

455-
@NonNull OutputFactory getOutputFactory();
472+
/**
473+
* Output factory.
474+
*
475+
* @return Output factory.
476+
*/
477+
OutputFactory getOutputFactory();
456478

457479
/**
458480
* Attach a filter to the route pipeline.
459481
*
460482
* @param filter Filter.
461483
* @return This router.
462484
*/
463-
@NonNull Router use(@NonNull Route.Filter filter);
485+
Router use(@NonNull Route.Filter filter);
464486

465487
/**
466488
* Add a before route decorator to the route pipeline.
@@ -841,7 +863,7 @@ default Object execute(@NonNull Context context) {
841863
*
842864
* @return Template for the flash cookie.
843865
*/
844-
@NonNull Cookie getFlashCookie();
866+
Cookie getFlashCookie();
845867

846868
/**
847869
* Sets a cookie used as a template to generate the flash cookie, allowing to customize the cookie
@@ -850,19 +872,30 @@ default Object execute(@NonNull Context context) {
850872
* @param flashCookie The cookie template.
851873
* @return This router.
852874
*/
853-
@NonNull Router setFlashCookie(@NonNull Cookie flashCookie);
875+
Router setFlashCookie(@NonNull Cookie flashCookie);
854876

855-
@NonNull ValueFactory getValueFactory();
877+
/**
878+
* Value factory.
879+
*
880+
* @return Value factory.
881+
*/
882+
ValueFactory getValueFactory();
856883

857-
@NonNull Router setValueFactory(@NonNull ValueFactory valueFactory);
884+
/**
885+
* Set value factory, useful for custom value factory.
886+
*
887+
* @param valueFactory Value factory.
888+
* @return This router.
889+
*/
890+
Router setValueFactory(@NonNull ValueFactory valueFactory);
858891

859892
/**
860893
* Ensure path start with a <code>/</code>(leading slash).
861894
*
862895
* @param path Path to process.
863896
* @return Path with leading slash.
864897
*/
865-
static @NonNull String leadingSlash(@Nullable String path) {
898+
static String leadingSlash(@Nullable String path) {
866899
if (path == null || path.length() == 0 || path.equals("/")) {
867900
return "/";
868901
}

0 commit comments

Comments
 (0)