Skip to content

Make generated Kotlin classes internal#502

Merged
edward3h merged 1 commit intocasid:mainfrom
MariusVolkhart:mv/kotlinInternal
Jan 15, 2026
Merged

Make generated Kotlin classes internal#502
edward3h merged 1 commit intocasid:mainfrom
MariusVolkhart:mv/kotlinInternal

Conversation

@MariusVolkhart
Copy link
Copy Markdown
Contributor

There are two reasons for this. The first is that there's no reason for these to be public. They are consumed entirely in the current compilation unit, and there's no reason for external code to ever reference these. This comes up when working in a large Spring/Micronaut project where smaller modules act as libraries to a final aggregate.

The other reason to do this is that by making this classes public, it prevents them from being used with data classes that the developer declared as internal. The compiler will complain that the generated code exposes an internal class in a public API.

There are two reasons for this. The first is that there's no reason for these to be public. They are consumed entirely in the current compilation unit, and there's no reason for external code to ever reference these. This comes up when working in a large Spring/Micronaut project where smaller modules act as libraries to a final aggregate.

The other reason to do this is that by making this classes public, it prevents them from being used with data classes that the developer declared as internal. The compiler will complain that the generated code exposes an internal class in a public API.
@MariusVolkhart
Copy link
Copy Markdown
Contributor Author

I should note that this also allows jte to be used with Kotlin projects that have explicitApi() enabled

Copy link
Copy Markdown
Collaborator

@edward3h edward3h left a comment

Choose a reason for hiding this comment

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

Seems reasonable to me, and all the tests passed.

@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.24%. Comparing base (e8d474c) to head (dd65812).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main     #502      +/-   ##
============================================
+ Coverage     91.17%   91.24%   +0.06%     
- Complexity     1223     1224       +1     
============================================
  Files            76       76              
  Lines          3174     3174              
  Branches        492      492              
============================================
+ Hits           2894     2896       +2     
+ Misses          169      168       -1     
+ Partials        111      110       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kelunik
Copy link
Copy Markdown
Collaborator

kelunik commented Jan 14, 2026

Not a kotlin user, but sounds reasonable to me.

@edward3h edward3h merged commit 23e87a7 into casid:main Jan 15, 2026
14 checks passed
@MariusVolkhart MariusVolkhart deleted the mv/kotlinInternal branch January 31, 2026 20:35
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.

3 participants