Title: refactor: reduce boilerplate code · Issue #461 · spotify-web-api-java/spotify-web-api-java · GitHub
Open Graph Title: refactor: reduce boilerplate code · Issue #461 · spotify-web-api-java/spotify-web-api-java
X Title: refactor: reduce boilerplate code · Issue #461 · spotify-web-api-java/spotify-web-api-java
Description: Migration: Boilerplate Reduction Summary Incrementally modernize the project by: Migrating Maven → Gradle Introducing Kotlin Replacing boilerplate in models and requests Strict requirement: No breaking changes to public API. Execution Ru...
Open Graph Description: Migration: Boilerplate Reduction Summary Incrementally modernize the project by: Migrating Maven → Gradle Introducing Kotlin Replacing boilerplate in models and requests Strict requirement: No brea...
X Description: Migration: Boilerplate Reduction Summary Incrementally modernize the project by: Migrating Maven → Gradle Introducing Kotlin Replacing boilerplate in models and requests Strict requirement: No brea...
Opengraph URL: https://github.com/spotify-web-api-java/spotify-web-api-java/issues/461
X: @github
Domain: redirect.github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"refactor: reduce boilerplate code","articleBody":"# Migration: Boilerplate Reduction\n\n## Summary\n\nIncrementally modernize the project by:\n- Migrating Maven → Gradle\n- Introducing Kotlin\n- Replacing boilerplate in models and requests\n\n**Strict requirement:** No breaking changes to public API.\n\n---\n\n## Execution Rules\n\n- Work in **small, reviewable commits**\n- Each step must:\n - Compile successfully\n - Pass all tests\n- Do NOT combine phases in a single commit\n- Prefer incremental migration over large rewrites\n- Maintain Java ↔ Kotlin interoperability at all times\n\n---\n\n## Phase 1: Gradle Migration\n\n### Tasks\n- Create `build.gradle.kts`\n- Port dependencies from `pom.xml`\n- Add required plugins (`java`, `jacoco`, publishing)\n- Keep existing directory structure\n- Update CI to use Gradle\n\n### Checkpoint\n- `./gradlew build` succeeds\n- All tests pass\n\n### Commit Boundary\n- `chore: migrate build system from Maven to Gradle`\n\n---\n\n## Phase 2: Enable Kotlin\n\n### Tasks\n- Add Kotlin plugin and stdlib\n- Verify mixed Java/Kotlin compilation works\n\n### Checkpoint\n- Project builds with Kotlin enabled\n- No functional changes\n\n### Commit Boundary\n- `chore: add Kotlin support to project`\n\n---\n\n## Phase 3: Model Migration (Incremental)\n\n### Tasks\n- Convert model classes to a Kotlin representation in small batches, respecting this library's public API stability as described by [jakewharton.com/public-api-challenges-in-kotlin](https://jakewharton.com/public-api-challenges-in-kotlin/).\n- Use kotlinx.serialization for JSON handling\n- Remove custom JSON utilities only for migrated models\n\n### Execution Strategy\n- Start with simple, dependency-free models\n- Progress to dependent and complex models\n\n### Per-Batch Checkpoint\n- Build succeeds\n- Serialization/deserialization tests pass\n- No API breakage\n\n### Commit Boundaries (repeat per batch)\n- `refactor(models): convert \u003cModelName\u003e to Kotlin data class`\n\n---\n\n## Phase 4: Request Layer Simplification\n\n### Tasks\n- Introduce a mechanism to reduce request boilerplate:\n - Option A: Code generation\n - Option B: Shared abstractions/annotations\n- Apply incrementally to request classes\n\n### Execution Strategy\n- Start with simplest request classes\n- Migrate complex ones later\n\n### Per-Batch Checkpoint\n- Requests produce identical HTTP behavior\n- Tests pass\n\n### Commit Boundaries (repeat per batch)\n- `refactor(requests): simplify \u003cRequestName\u003e implementation`\n\n---\n\n## Phase 5: Remove Remaining JSON Boilerplate\n\n### Tasks\n- Eliminate remaining custom JSON parsing\n- Centralize common behavior if needed\n\n### Checkpoint\n- All JSON fixtures deserialize correctly\n- No regressions\n\n### Commit Boundary\n- `refactor: remove remaining JSON utility boilerplate`\n\n---\n\n## Phase 6: Kotlin Conversion (Core)\n\n### Tasks\n- Convert core classes (API entry point, base request classes, utilities) to Kotlin\n- Improve readability using Kotlin features (null safety, defaults)\n\n### Checkpoint\n- Public API unchanged\n- Full test suite passes\n\n### Commit Boundaries\n- `refactor(core): convert core classes to Kotlin`\n\n---\n\n## Phase 7: Tests \u0026 Quality\n\n### Tasks\n- Migrate test utilities to Kotlin (optional but preferred)\n- Improve readability and reduce duplication\n- Ensure coverage is maintained or improved\n\n### Checkpoint\n- All tests pass\n- Coverage ≥ previous baseline\n\n### Commit Boundary\n- `test: modernize and clean up test suite`\n\n---\n\n## Phase 8: Documentation \u0026 Release\n\n### Tasks\n- Update README (Gradle + Kotlin usage)\n- Document contribution workflow\n- Prepare release notes\n\n### Checkpoint\n- Docs reflect new setup accurately\n\n### Commit Boundary\n- `docs: update documentation for Kotlin + Gradle migration`\n\n---\n\n## Final Validation\n\n- Full build passes\n- All tests pass\n- No public API changes\n- Artifacts publish successfully\n\n---\n\n## Guidance\n\n- Prefer **safe refactors over clever optimizations**\n- If uncertain, keep existing behavior unchanged\n- Avoid large diffs; split work into minimal steps\n- Validate continuously after each change\n","author":{"url":"https://github.com/dargmuesli","@type":"Person","name":"dargmuesli"},"datePublished":"2026-04-30T21:11:28.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/461/spotify-web-api-java/issues/461"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:30e28aa8-0fd2-424c-1e28-0ebd0e0c97d4 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D778:118906:2639C4C:2736CAB:6A62F3B4 |
| html-safe-nonce | 4106229f87a9462aa0ef26bccc665ce2b7916fc35cd66037a0e88eca574263ff |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENzc4OjExODkwNjoyNjM5QzRDOjI3MzZDQUI6NkE2MkYzQjQiLCJ2aXNpdG9yX2lkIjoiNTYwODU1NTc1MDc0OTMwMzczMiIsInJlZ2lvbl9lZGdlIjoic2VhIiwicmVnaW9uX3JlbmRlciI6InNlYSJ9 |
| visitor-hmac | 7ed53f7c7d7b04d28c642499415dfc1a3b79206356710daa8baae47f05768a3e |
| hovercard-subject-tag | issue:4361286145 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/spotify-web-api-java/spotify-web-api-java/461/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5b7ca6a2714ef1628fccb3d8e68be74d28b871a5622ccf7171875f09ac16e1b5/spotify-web-api-java/spotify-web-api-java/issues/461 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5b7ca6a2714ef1628fccb3d8e68be74d28b871a5622ccf7171875f09ac16e1b5/spotify-web-api-java/spotify-web-api-java/issues/461 |
| og:image:alt | Migration: Boilerplate Reduction Summary Incrementally modernize the project by: Migrating Maven → Gradle Introducing Kotlin Replacing boilerplate in models and requests Strict requirement: No brea... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dargmuesli |
| hostname | github.com |
| expected-hostname | github.com |
| None | b415018e190e73858133ddcaa36acce7b3f3572fe54dda84bd3b21a6ec714c30 |
| turbo-cache-control | no-preview |
| go-import | github.com/spotify-web-api-java/spotify-web-api-java git https://github.com/spotify-web-api-java/spotify-web-api-java.git |
| octolytics-dimension-user_id | 90800172 |
| octolytics-dimension-user_login | spotify-web-api-java |
| octolytics-dimension-repository_id | 18928344 |
| octolytics-dimension-repository_nwo | spotify-web-api-java/spotify-web-api-java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 18928344 |
| octolytics-dimension-repository_network_root_nwo | spotify-web-api-java/spotify-web-api-java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 22f98521e99f504294ab0812b66104d50eb75a70 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width