Teaches AI agents to write idiomatic Kotlin instead of Java-in-a-.kt-file.
98
98%
Does it follow best practices?
Impact
99%
1.20xAverage score across 8 eval scenarios
Passed
No known issues
Process steps in order. Do not skip ahead.
src/main if the user said "everywhere")java.util.Optional, Optional<T> return types, Optional.of, Optional.empty, Optional.ofNullable, .orElse, .orElseGet, .orElseThrow, .ifPresent, .map, .flatMap (on Optional)A site is a SAFE conversion target if:
If a site is exposed to Java code and you can't verify the consumer is OK with T?, leave it and report it. Don't break Java callers silently.
For each safe conversion target:
Optional<T> return type → T? return typeOptional.of(x) → x (drop the wrapper)Optional.empty() → nullOptional.ofNullable(x) → x (already nullable)opt.orElse(default) → value ?: defaultopt.orElseGet { default() } → value ?: default()opt.orElseThrow { e } → value ?: throw eopt.ifPresent { x -> … } → value?.let { … }opt.map { x -> f(x) } → value?.let { f(it) } or value?.let(::f)opt.flatMap { x -> g(x) } → value?.let(::g) (when g returns nullable)import java.util.Optional and any related imports.orElse(x) on what is now T?, or destructuring expected Optional shapeFinish here. Do not commit — that's the operator's call.