Skip to content

Clear the standing compiler warnings and gate on them in CI - #316

Merged
okhsunrog merged 2 commits into
mainfrom
chore/clear-compiler-warnings
Aug 25, 2026
Merged

Clear the standing compiler warnings and gate on them in CI#316
okhsunrog merged 2 commits into
mainfrom
chore/clear-compiler-warnings

Conversation

@okhsunrog

@okhsunrog okhsunrog commented Aug 25, 2026

Copy link
Copy Markdown
Owner

The module compiled with six warnings, which is enough noise that a seventh — a real one — would scroll past unread. Only one was a latent defect. With the module clean, CI now enforces that state.

BundleSchemaGoldenTest called File.parentFile.mkdirs() on a receiver Kotlin now types as nullable. It cannot be null for the relative path used there, so nothing is broken today, but the warning is on its way to becoming a hard error and the failure mode would be a golden-refresh path that NPEs.

The other five were deliberate, and are documented in the commit rather than left to be re-litigated: four Unit literals standing in for empty branches in Compose when slots, and one Json format rebuilt inside a test body. None needed an @Suppress in the end — written plainly, they stop warning by construction.

allWarningsAsErrors is gated behind -PvpnhideWarningsAsErrors=true, passed by the CI Gradle invocations and off by default, so a warning mid-edit doesn't stop a local build. The usual objection — a toolchain bump reddening someone else's PR — does not apply here: every input that decides what warns is pinned (Gradle by the wrapper, AGP/Kotlin/Compose in libs.versions.toml, the NDK by ndkVersion, the JDK by the CI container image), so new warnings can only arrive on the PR that does the bumping.

  • golden.parentFile?.mkdirs()
  • drop four Unit no-op branch bodies in FullResetDialog, LegacyImportUi, DiagnosticsScreen
  • build DiagnosticReportTest's Json format once per class instead of per call
  • add the vpnhideWarningsAsErrors property and pass it from the lint/test and APK-build CI steps

Testing: verified both directions — reintroducing the nullable-receiver warning passes without the flag and fails the build with it.

Six is enough noise that a seventh — a real one — scrolls past unread. Only one
of them was a latent defect; the rest are recorded here so nobody re-litigates
them later.

The real one: BundleSchemaGoldenTest called File.parentFile.mkdirs() on a
receiver Kotlin now types as nullable. It cannot actually be null for the
relative path used there, but the warning is on its way to becoming an error,
and a golden-refresh path that NPEs would be found at the worst moment.

The other five were deliberate: four `Unit` literals standing in for empty
branches in Compose `when` slots, and one Json format rebuilt inside a test
body. The `Unit`s said "nothing happens here", which is what an empty branch
already says, so the branches are now empty; the format is built once per class.

No behaviour change. Not adding allWarningsAsErrors along with this: it would
lock in a clean build today at the cost of breaking CI on the next Kotlin or AGP
bump, which is the maintainer's call rather than a side effect of a cleanup.
@claude

claude Bot commented Aug 25, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

The module now compiles clean, so make that the enforced state rather than a
snapshot. `-PvpnhideWarningsAsErrors=true` on the CI Gradle invocations, matching
how -PvpnhideEmulatorX86 is already wired; off by default, because a warning
mid-edit is information, not a reason to stop a local build.

The usual objection to allWarningsAsErrors is that a toolchain bump turns
unrelated new warnings into a red CI on someone else's PR. That does not apply
here: every input that decides what warns is pinned — Gradle by the wrapper,
AGP/Kotlin/Compose in libs.versions.toml, the NDK by ndkVersion, and the JDK by
the CI container image. New warnings can only arrive with a deliberate version
bump, on the PR that does the bumping, where they belong.

Verified both directions: reintroducing the nullable-receiver warning fixed in
the previous commit passes without the flag and fails with it.
@okhsunrog okhsunrog changed the title Clear the six standing compiler warnings Clear the standing compiler warnings and gate on them in CI Aug 25, 2026
@okhsunrog
okhsunrog merged commit d2877ca into main Aug 25, 2026
35 checks passed
@okhsunrog
okhsunrog deleted the chore/clear-compiler-warnings branch August 25, 2026 22:32
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