Skip to content

feat: EXPOSED-1089 Support return value checker - #2951

Open
Inf1mum wants to merge 1 commit into
JetBrains:mainfrom
Inf1mum:exposed-1089-return-value-checker
Open

Inf1mum wants to merge 1 commit into
JetBrains:mainfrom
Inf1mum:exposed-1089-return-value-checker

Conversation

@Inf1mum

@Inf1mum Inf1mum commented Oct 4, 2026 •

Copy link
Copy Markdown

Title

feat: EXPOSED-1089 Support return value checker

Body

Summary

Enables the Kotlin 2.3+ unused return value checker for Exposed, as requested in EXPOSED-1089.

  • All published modules are now compiled with -Xreturn-value-checker=full. This marks every declaration, so downstream projects that enable the checker (-Xreturn-value-checker=check or =full) also get diagnostics for ignored return values of Exposed's API. The change is metadata-only and does not affect binary compatibility.
  • Intentionally builder-style APIs whose results are ignored by design are annotated with @IgnorableReturnValue, both to keep Exposed's own build warning-free and to keep the checker quiet for these calls in downstream code (QueryBuilder.append/unaryPlus/appendTo, Column.check, StringBuilder.appendIfNotNull).
  • The remaining internal call sites that intentionally discard a result now assign it to the discard-only val _ = form, so every module compiles with zero new warnings.

The flag is applied centrally in the root build.gradle.kts to every KotlinCompilationTask of published modules; the four test-only modules are excluded, as they are not published.

Verification

  • ./gradlew compileKotlin: successful, zero Unused return value warnings across all modules.
  • ./gradlew apiCheck: passes; the binary-compatibility-validator output is unchanged, confirming binary compatibility.
  • ./gradlew detekt: passes.
  • Downstream propagation check: exposed-core/exposed-jdbc were published to Maven Local and a small consumer project compiled with -Xreturn-value-checker=check. An ignored Users.insert { ... } result is reported as Unused return value of 'insert', while a consumed result produces no warning — confirming the marking reaches dependent projects.
  • ./gradlew test_h2_v2 :exposed-r2dbc-tests:test_h2_v2: successful — 3234 test cases across all modules, 0 failures, 0 errors (421 skipped by dialect-specific preconditions, as usual).

Closes EXPOSED-1089

…ed modules

Compile all published Exposed modules with -Xreturn-value-checker=full
(Kotlin 2.3+), which marks every declaration so downstream projects that
enable the unused return value checker (check or full mode) also get
ignored return values of Exposed's API reported. This is a metadata-only
change and does not affect binary compatibility.

Internally, intentional builder-style APIs whose results are ignored by
design are annotated with @IgnorableReturnValue (QueryBuilder append
family, Column.check, StringBuilder.appendIfNotNull), and remaining
internal call sites that discard results on purpose now assign them to
the discard-only 'val _ = ' form so the modules compile warning-free.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant