Skip to content

Phase 3.2: Convert critter-core main sources from Kotlin to Java#4197

Open
evanchooly wants to merge 1 commit intomasterfrom
phase3.2-main-to-java
Open

Phase 3.2: Convert critter-core main sources from Kotlin to Java#4197
evanchooly wants to merge 1 commit intomasterfrom
phase3.2-main-to-java

Conversation

@evanchooly
Copy link
Member

Summary

  • Converts all 20 Kotlin production files in critter/core/src/main/kotlin/ to Java equivalents
  • Removes kotlin-stdlib, kotlin-reflect, and KSP dependencies from critter-core pom.xml
  • Disables Kotlin maven plugin for critter-core (no longer has Kotlin sources)
  • Updates build-plugins generator (AnnotationNodeExtensions.kt) to produce a .java file instead of .kt, eliminating the need for Kotlin compilation of generated sources
  • Updates critter-maven's CritterProcessor.kt to use the new Java singleton API (INSTANCE pattern)
  • Updates test files to use static Java methods instead of Kotlin companion/file-level functions

Key conversion patterns used

  • Kotlin object singletons → Java class with public static final INSTANCE field
  • by lazy → null-check lazy initialization
  • Kotlin extension functions → static Java methods with explicit first parameter
  • use {} / apply {} scope functions → try-with-resources / sequential calls
  • ::class.class for Java Class<?> references

Test plan

  • All 57 critter-core unit tests pass
  • All 5 critter-maven tests pass
  • All 11 critter-integration-tests pass

Closes part of #4186 (Phase 3: Move critter-core into morphia-core)

🤖 Generated with Claude Code

- Convert all 20 Kotlin production files in critter/core/src/main/kotlin/ to Java equivalents
- Remove Kotlin stdlib, kotlin-reflect, and KSP dependencies from critter-core pom.xml
- Disable Kotlin maven plugin for critter-core (no longer has Kotlin sources)
- Update build-plugins generator (AnnotationNodeExtensions.kt) to produce Java instead of Kotlin, eliminating the generated Kotlin file and associated compilation requirement
- Update critter-maven CritterProcessor.kt to use new Java singleton API (INSTANCE pattern)
- Update test files to use static Java methods instead of Kotlin companion/file-level functions
- All 57 critter-core tests and 11 integration tests pass

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

1 participant