Some time in the past, jOOQ has added the org.jetbrains:annotations dependency to the jOOQ API, in an effort to annotate return varieties with nullability info. For instance, the whole DSL is non-nullable:
public interface SelectWhereStep<R extends Document>
extends SelectConnectByStep<R> {
@NotNull @CheckReturnValue
@Help
SelectConditionStep<R> the place(Situation situation);
// ...
}
It is smart to present this assure particularly to kotlin customers, as they will do away with a few of the extra advanced varieties involving issues like Choose!<Document!>
, which now turns into a minimum of Choose<Document!>
. Discover additionally the @CheckReturnValue annotation, which IntelliJ makes use of for some introspections.
Different circumstances are extra apparent, equivalent to:
public interface ResultQuery<R extends Document>
extends Fields, Question, Iterable<R>, Writer<R> {
@Nullable
@Blocking
R fetchOne() throws TooManyRowsException;
@NotNull
@Blocking
R fetchSingle() throws NoDataFoundException, TooManyRowsException;
// ...
}
The distinction between these two kinds of fetch strategies is that fetchOne()
expects 0-1 ensuing information, whereas fetchSingle()
expects precisely 1 report. Each throw exceptions in any other case, however solely the latter can assure a non-nulllable report worth.
However wait, what’s this @Blocking annotation?
In jOOQ 3.17, we’ve added the org.jetbrains.annotations.Blocking
annotation to all jOOQ API that executes a question on high of JDBC. This doesn’t have an effect on customers of JDBC primarily based jOOQ queries in any respect, however when you’re utilizing R2DBC for reactive querying with jOOQ, you may be tempted to by chance name considered one of jOOQ’s many many blocking execution strategies.
No extra! IntelliJ will now complain about such a name being inappropriate:
A minimum of as quickly as you allow the introspection:
It’s as much as you to resolve whether or not you need this to be a warning or an error, however a minimum of, you’ll discover that you simply’re about to do one thing unsuitable.
Eclipse doesn’t but help this sort of introspection. In the event you agree it ought to, you could possibly upvote this difficulty right here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=578310.