Skip to content

ADFA-4634: Remove Jackson and kotlinx.serialization, consolidate on Gson#1505

Merged
davidschachterADFA merged 6 commits into
stagefrom
ADFA-4634-remove-two-json-libraries
Jul 10, 2026
Merged

ADFA-4634: Remove Jackson and kotlinx.serialization, consolidate on Gson#1505
davidschachterADFA merged 6 commits into
stagefrom
ADFA-4634-remove-two-json-libraries

Conversation

@davidschachterADFA

@davidschachterADFA davidschachterADFA commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Gson was already the project-wide JSON library (24 source files across 11 modules); Jackson and kotlinx.serialization were redundant
  • Replaced the single Jackson ObjectMapper.readValue() call in WebServer.kt with the Gson equivalent (Gson().fromJson())
  • Removed the kotlinx.serialization compiler plugin and runtime dependency — it was declared but had zero actual usages (one dead import)
  • Cleaned up all three orphaned kotlinx.serialization entries from libs.versions.toml

Test plan

  • Project builds without errors
  • Web server JSON parsing works (DB dump → Pebble template context)

🤖 Generated with Claude Code

davidschachterADFA and others added 2 commits July 10, 2026 13:54
Gson was already the project-wide JSON library (24 files, 11 modules).
Jackson had a single use in WebServer.kt; replaced with Gson equivalent.
kotlinx.serialization was entirely unused (dead import + declared deps only).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… catalog

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a18d1735-1459-4313-9a83-6032cc089f80

📥 Commits

Reviewing files that changed from the base of the PR and between d87814a and afb3f80.

📒 Files selected for processing (1)
  • app/src/main/java/com/itsaky/androidide/localWebServer/WebServer.kt

📝 Walkthrough
  • Consolidated JSON handling on Gson by replacing Jackson parsing in WebServer.kt.
  • Reused configured Gson and TypeToken instances across requests.
  • Preserved whole-number values as Long and rejected blank or null template contexts explicitly.
  • Removed unused Jackson and kotlinx.serialization dependencies, plugin configuration, imports, and version-catalog entries.
  • Planned validation: successful project build and end-to-end web server JSON parsing from database dump to Pebble context.
  • Risk: Gson deserialization may differ from Jackson for some JSON types or edge cases; verify compatibility with existing template data.

Walkthrough

The build removes Kotlin serialization and Jackson JSON dependencies, adds Pebble, and updates instantiatePebbleTemplate to deserialize template context data with Gson.

Changes

Template context migration

Layer / File(s) Summary
Dependency wiring
app/build.gradle.kts, build.gradle.kts, gradle/libs.versions.toml
Kotlin serialization and Jackson dependencies and plugin wiring are removed, and the Pebble template engine dependency is added.
Gson template context parsing
app/src/main/java/com/itsaky/androidide/localWebServer/WebServer.kt
Pebble template context deserialization changes from Jackson to Gson using TypeToken<Map<String, Any>>, UTF-8 decoding, and blank or "null" input validation.

Estimated code review effort: 2 (Simple) | ~10 minutes

Poem

I’m a rabbit with templates to weave,
Gson parses the data we receive.
Jackson hops out, Pebble comes near,
Clean build paths make carrots cheer.
Whiskers twitch—deploy with ease!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: removing Jackson and kotlinx.serialization in favor of Gson.
Description check ✅ Passed The description matches the changeset and test plan, describing the dependency cleanup and Gson replacement.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ADFA-4634-remove-two-json-libraries

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
app/src/main/java/com/itsaky/androidide/localWebServer/WebServer.kt (1)

454-454: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Reuse a single Gson instance and TypeToken instead of creating them per call.

Gson() and the anonymous TypeToken subclass are instantiated on every template request. Gson instances are thread-safe and can be shared. A class-level field is consistent with the existing pebbleEngine pattern.

♻️ Proposed refactor

Add class-level fields near the existing Pebble fields:

     private          val brotliCompression  : String  = "br"
+    private          val gson                        = Gson()
+    private          val contextType       = object : TypeToken<Map<String, Any>>() {}.type
     private          val pebbleEngine = PebbleEngine.Builder().loader(StringLoader()).build()

Then simplify the call site:

-        val context: Map<String, Any> = Gson().fromJson(dbContent.toString(Charsets.UTF_8), object : TypeToken<Map<String, Any>>() {}.type)
+        val context: Map<String, Any> = gson.fromJson(dbContent.toString(Charsets.UTF_8), contextType)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/src/main/java/com/itsaky/androidide/localWebServer/WebServer.kt` at line
454, In the template request handling code, avoid recreating Gson and the Map
TypeToken for every request. Add reusable class-level fields near pebbleEngine
for a single Gson instance and a typed Map<String, Any> TypeToken, then update
the deserialization call in the relevant method to use those shared fields.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@app/src/main/java/com/itsaky/androidide/localWebServer/WebServer.kt`:
- Line 454: In the template request handling code, avoid recreating Gson and the
Map TypeToken for every request. Add reusable class-level fields near
pebbleEngine for a single Gson instance and a typed Map<String, Any> TypeToken,
then update the deserialization call in the relevant method to use those shared
fields.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 07778500-1500-4123-a8c9-10a95cfb605d

📥 Commits

Reviewing files that changed from the base of the PR and between 81b6520 and 562bda0.

📒 Files selected for processing (3)
  • app/build.gradle.kts
  • app/src/main/java/com/itsaky/androidide/localWebServer/WebServer.kt
  • gradle/libs.versions.toml
💤 Files with no reviewable changes (2)
  • gradle/libs.versions.toml
  • app/build.gradle.kts

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Comment thread app/src/main/java/com/itsaky/androidide/localWebServer/WebServer.kt Outdated
Comment thread app/src/main/java/com/itsaky/androidide/localWebServer/WebServer.kt Outdated
davidschachterADFA and others added 2 commits July 10, 2026 14:57
…ontext

- Register a TypeAdapterFactory that returns Long (not Double) for whole
  numbers when deserializing Map<String, Any>, matching Jackson's behavior
- Throw explicitly before fromJson() for blank or "null" JSON strings so
  the caller gets a meaningful error instead of a null map

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…rialization

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@davidschachterADFA davidschachterADFA merged commit 232cec2 into stage Jul 10, 2026
5 checks passed
@davidschachterADFA davidschachterADFA deleted the ADFA-4634-remove-two-json-libraries branch July 10, 2026 23:33
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.

2 participants