Add three build guardrails: Error Prone Class.forName ban, @since validation, Vale version-name block#5044
Merged
Merged
Conversation
Introduce checks that catch documentation/build hygiene issues that have slipped in repeatedly: - Error Prone BanClassForName: forbids Class.forName(...) anywhere under CodenameOne/src because ParparVM (iOS) cannot resolve classes by string name at runtime. Lives in a new maven/errorprone-checks module wired into core via an opt-in `errorprone` profile (Error Prone needs JDK 11+; the primary build runs on JDK 8). CI workflow runs `mvn -Perrorprone` on JDK 17. - scripts/check-since-tags.sh: fails the build when any @SInCE javadoc tag references a version with no matching git tag. Wired up via a dedicated GitHub Actions workflow that fetches tags and runs the check. - Vale rule CodenameOneRules.NonexistentVersions: blocks prose like "Codename One 8", "Codename One 9", "Codename One 7.1" in the developer guide, while still allowing the live release line (Codename One 7 / 7.0.x) and historical releases. The rule needs `vocab: false` because the Codename entry in accept.txt would otherwise swallow every match. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
✅ Continuous Quality ReportTest & Coverage
Static Analysis
Generated automatically by the PR CI workflow. |
Collaborator
Author
|
Compared 20 screenshots: 20 matched. |
Contributor
|
Developer Guide build artifacts are available for download from this workflow run:
Developer Guide quality checks: |
Collaborator
Author
|
Compared 110 screenshots: 110 matched. Native Android coverage
✅ Native Android screenshot tests passed. Native Android coverage
Benchmark ResultsDetailed Performance Metrics
|
Collaborator
Author
|
Compared 110 screenshots: 110 matched. Benchmark Results
Build and Run Timing
Detailed Performance Metrics
|
Collaborator
Author
|
Compared 110 screenshots: 110 matched. Benchmark Results
Build and Run Timing
Detailed Performance Metrics
|
- check-since-tags: also accept the *next patch* of every X.Y.Z release line, since @SInCE markers are necessarily written before the release is tagged. With the highest 7.0.x tag at v7.0.244, the existing @SInCE 7.0.245 entries are now valid. Next-minor/next-major bumps still require an explicit prior tag because those are the values Claude hallucinates most often. - check-since-tags: only scan javadoc-style @SInCE (lines containing `*` or `///` before the tag), so plain `//` comments — which in vendored MiG Layout code reference the upstream library's changelog, not a Codename One release — no longer trigger the check. - errorprone CI: explicitly add errorprone-checks to -pl. The custom checker is wired in via annotationProcessorPaths, which Maven's -am does not recognise as a build-time dependency. - Suppress BanClassForName at the three deliberate framework-internal reflective lookups (NativeLookup.create, GeofenceManager.getListenerClass, DeviceRunner.runTest) with @SuppressWarnings and a justifying comment. - Drop the "From Codename One 9.0," prefix from the ImageViewer prose in the developer guide — a real preexisting false advertisement of an unreleased version that the new Vale rule correctly flagged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Maven's reactor schedules modules by declared dependencies. `core` references `errorprone-checks` only via the maven-compiler-plugin's `annotationProcessorPaths`, which Maven does not treat as a build-time dependency, so the reactor scheduled core first and failed to resolve com.codenameone:errorprone-checks:8.0-SNAPSHOT. Fix by splitting the CI command into two invocations: first install errorprone-checks to the local repo, then compile core with the errorprone profile active. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds three independent checks that catch documentation and build hygiene issues that have slipped into the framework repeatedly. Each check fires on existing code, which is intentional — the violations they catch are real bugs.
BanClassForName— newmaven/errorprone-checksmodule + customBugCheckerthat refuses anyClass.forName(...)call underCodenameOne/src. ParparVM (iOS) cannot resolve classes by string name at runtime, so these calls silently break on iOS. Wired into core via an opt-inerrorproneMaven profile (Error Prone needs JDK 11+; the primary build runs on JDK 8). Other Error Prone rules are disabled with-XepDisableAllChecksso only this one rule fires. Currently catches 3 real usages inNativeLookup,GeofenceManager, andDeviceRunner.scripts/check-since-tags.sh— scans@since X.Y.Zreferences in framework sources and fails the build when the referenced version has no matching git tag (with or without a leadingv). Currently flags 30@since 7.0.245/@since 3.7.2references that point at versions that never shipped.CodenameOneRules.NonexistentVersions— blocks prose like "Codename One 8", "Codename One 9", "Codename One 7.1" in the developer guide while still allowing the live release line (Codename One 7/7.0.x) and historical releases (Codename One 3.4). Needsvocab: falseto escape Vale's vocab-pre-filtering, which would otherwise silently swallow every match becauseCodenameis inaccept.txt. Catches a real preexisting hit atThe-Components-Of-Codename-One.asciidoc:2568.Notes on integration
mvn -Perrorprone install) and runs on its own CI job (.github/workflows/errorprone.yml, JDK 17). The default JDK 8 build is untouched.@sincecheck has its own workflow (.github/workflows/check-since-tags.yml). It usesactions/checkoutwithfetch-tags: truesogit tag --listsees the full release history.developer-guide-docs.ymlworkflow (no changes needed there)..gitignorewhitelist (!styles/CodenameOneRules/) because Vale syncs upstream style packages understyles/*which is otherwise excluded.Test plan
mvn -Perrorprone -pl core -am install -DskipTestsfails with[BanClassForName]errors on the three known usagesscripts/check-since-tags.shexits non-zero and prints the 30 unresolved@sinceversionsvale --filter='.Name == "CodenameOneRules.NonexistentVersions"' docs/developer-guide/*.asciidoc docs/developer-guide/*.adocflagsThe-Components-Of-Codename-One.asciidoc:2568and nothing elsemvn installon JDK 8 still works (theerrorprone-checksmodule is gated behind theerrorproneprofile)@since/Error Prone hits are addressed in follow-up PRs (this PR is the guardrail, not the cleanup)🤖 Generated with Claude Code