Skip to content

Java and Kotlin docs drift

Rimfe parses changed .java, .kt and .kts files without compiling them and records the public surface: classes, records, interfaces, enums, methods and fields with their annotations, Spring MVC routes in Java, and System.getenv reads. A docs section that names a changed one is checked, and a stale line gets a finding with a suggested edit.

Updated

What Rimfe reads

In Java, public and protected members are the public surface, and interface members are public without a modifier. In Kotlin, public is the default and private and internal are internal.

SurfaceWhat is read
JavaClasses, records with their components, interfaces, enums and their constants, annotation types, methods, constructors, fields and static final constants. Annotations and Javadoc are kept.
KotlinTop-level functions and properties, classes, objects and companion objects, val and var properties of a data class constructor, enums, type aliases, parameter defaults and vararg.
RoutesSpring @GetMapping, @PostMapping, @PutMapping, @PatchMapping, @DeleteMapping and @RequestMapping with value or path and method = RequestMethod.X. A class-level @RequestMapping prefix is joined. Java files only.
Env varsSystem.getenv in Java and Kotlin.
Deprecations@Deprecated, with since and forRemoval = true read, and a Javadoc or KDoc @deprecated tag.
Build filespom.xml, Gradle and .properties changes are reviewed from their diff: names on the changed lines are looked up in your docs. Their keys and versions are not compared as facts.

Example: a controller prefix changes

Rimfe joins the class prefix to each mapping, so every route in the controller changes path. docs/api/orders.adoc still documents GET /api/v1/orders/{id}, and Rimfe posts a Docs conflict on that line with the new path.

src/main/java/dev/acme/orders/OrderController.java
  @RestController- @RequestMapping("/api/v1/orders")+ @RequestMapping("/api/v2/orders")  public class OrderController {

Example: a Kotlin default changes

docs/configuration.md says timeoutSeconds defaults to 30. The data class default is now 10, so the page gets a Docs conflict that quotes both lines.

src/main/kotlin/dev/acme/ClientConfig.kt
  data class ClientConfig(-     val timeoutSeconds: Int = 30,+     val timeoutSeconds: Int = 10,  )

Example: a method is marked for removal

The getting started guide still recommends submit with no notice. Rimfe reports an Undocumented deprecation and points at the pages that mention it. The repository overview lists submit under Deprecations with its version and the docs notice Missing.

src/main/java/dev/acme/Client.java
+ @Deprecated(since = "2.4", forRemoval = true)  public Order submit(OrderRequest request) {

Docs tools beside Java and Kotlin

Java projects often publish with Antora, which builds from AsciiDoc. Rimfe reads .adoc and .asciidoc pages as well as Markdown, so Antora modules, MkDocs and Docusaurus sites all work. Javadoc and Dokka output is generated from comments at build time and is not a page Rimfe reads; comments are code to Rimfe.

Set up a Java or Kotlin repository

Map controller and config packages to their pages, so those pages are read first. Spring keys such as acme.server.port live in .properties files Rimfe reads only as diffs, so list the ones that matter in surface to count them in docs coverage. The file applies when Documentation scope is set to .rimfe.json at the PR base.

.rimfe.json
{  "$schema": "https://rimfe.com/schema/rimfe.json",  "docsGlobs": ["README.md", "docs/modules/**/*.adoc"],  "codeMappings": [    { "source": "src/main/java/dev/acme/orders/**", "target": "docs/modules/api/pages/orders.adoc" }  ],  "surface": [{ "name": "acme.server.port", "kind": "config" }]}

Limits

  • Spring routes are read in Java only. Kotlin controllers are read for their classes and methods, not their paths.
  • JAX-RS, Micronaut and Quarkus annotations produce no route facts.
  • Code is parsed, never compiled, so members that Lombok or another annotation processor generates are not seen.
  • Package-private Java members are internal. Files under test/, tests/ and build/ are skipped.

Try it on your next pull request.

Free for public repositories, with unlimited members.

Start free with GitHub