<https://twitter.com/sdeleuze/status/1096423498325...
# spring
g
Yep, Mockk works better than Mockito. I used it in an app with DropWizard and the replacement for Mockito was fairly straightforward. Edit: missing word
s
what does
freeCompilerArgs = ["-Xjsr305=strict"]
do exactly?
s
It make Kotlin aware of the null-safety annotation in Spring Framework codebase, making Spring Framework API nullsafe. No NPE at runtime.
s
Doesn’t kotlin already detect the presence of
@NotNull
annotations?
oh, this makes it a compile time error.
instead of just a warning.
s
Yep explicit configuration enable strict checks, like if the Spring Framework code was written in Kotlin
👍 1
s
👍🏽
fantastic. I will be adding that to our code base. Does it still use platform types for your own java -> kotlin code?
s
Yes but you can use Spring Framework
@NonNull
,
@NonNullApi
,
@NonNullFields
and
@Nullable
in your own Java codebase. You may have to include
compileOnly("com.google.code.findbugs:jsr305:3.0.2")
and
testCompileOnly("com.google.code.findbugs:jsr305:3.0.2")
to avoid compilation warnings.
You can even use directly JSR 305 annotations even if I don't recommand it.
s
We currently use jetbrain’s
@NotNull
and
@Nullable
, which I think are jsr305 compatible, so that won’t be a problem. We just don’t use them everywhere.
s
Ok great
s
I just wasnt sure if strict would cause platform types to function as strictly nullable or notnullable from that point.
also, @sdeleuze, why doesn’t the tutorial have kotlin-dsl examples as well as groovy examples? it seems like you’d want to direct people to use the kotlin-dsl as well.
s
ah! you want initializr to support it before you start writing tutorials in it. Cool! thanks!
s
Yep
b
Really nice, I learned a lot and rewrote good chunks of my project
👍 1