Java & Kotlin Code Hygiene

Compiler, type-contract, resource, concurrency, and coroutine hygiene for JVM repositories.

Choose a focused Java & Kotlin recipe

This collection contains 7 bounded Java & Kotlin workflows. Choose the recipe whose objective matches the repository evidence instead of combining unrelated cleanup into one run.

How to use this collection

Read the repository’s configured runtime, compiler, framework, analyzer, and test commands before selecting a workflow. Start in audit mode, record file and symbol evidence, and authorize a fix only after the candidate scope is reviewable. Preserve supported versions, public behavior, and existing tool configuration.

If the evidence is a named CVE, scanner finding, exposed secret, authorization flaw, or injection path, use the focused vulnerability-remediation playbook instead of a code-hygiene recipe. Stop when the safe result requires an owner decision about architecture, compatibility, production data, or deployment state.

Full recipe list

Java compiler warning, deprecation, and suppression debt

development

Java compiler warning, deprecation, and suppression debt: Resolve javac warnings and narrow SuppressWarnings annotations.

author security-recipes.ai contributorsteam Security EngineeringTested withgpt-5-codexupdated 2026-08-21
code-hygienejvmjavajavacdeprecationsuppresswarnings

Java nullability, Optional, and boundary contracts

development

Java nullability, Optional, and boundary contracts: Make null contracts explicit without misusing Optional in storage or fields.

author security-recipes.ai contributorsteam Security EngineeringTested withgpt-5-codexupdated 2026-08-21
code-hygienejvmjavanullabilityoptionalcontracts

Java AutoCloseable and resource lifecycle

development

Java AutoCloseable and resource lifecycle: Close files, streams, clients, cursors, and scopes on every exit path.

author security-recipes.ai contributorsteam Security EngineeringTested withgpt-5-codexupdated 2026-08-21
code-hygienejvmjavaautocloseableresourcestry-with-resources

Java executor, Future, and ThreadLocal lifecycle

development

Java executor, Future, and ThreadLocal lifecycle: Bound background work and clean executor and thread-local state.

author security-recipes.ai contributorsteam Security EngineeringTested withgpt-5-codexupdated 2026-08-21
code-hygienejvmjavaexecutorfuturethreadlocal

Kotlin compiler, Detekt, and suppression debt

development

Kotlin compiler, Detekt, and suppression debt: Resolve Kotlin diagnostics and narrow file or declaration suppressions.

author security-recipes.ai contributorsteam Security EngineeringTested withgpt-5-codexupdated 2026-08-21
code-hygienejvmkotlindetektcompilersuppressions

Kotlin coroutine scope, cancellation, and Flow lifecycle

development

Kotlin coroutine scope, cancellation, and Flow lifecycle: Replace orphaned coroutines and uncollected or multiply collected flows with owned lifecycles.

author security-recipes.ai contributorsteam Security EngineeringTested withgpt-5-codexupdated 2026-08-21
code-hygienejvmkotlincoroutinesflowcancellation

Kotlin nullability, platform types, and immutability

development

Kotlin nullability, platform types, and immutability: Contain Java platform types and remove unsafe assertions and unintended mutation.

author security-recipes.ai contributorsteam Security EngineeringTested withgpt-5-codexupdated 2026-08-21
code-hygienejvmkotlinnullabilityplatform-typesimmutability