Skip to content

Excluding local classes created by Parcelize #300

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 13, 2025
Merged

Conversation

shanshin
Copy link
Contributor

In some rare cases, JVM accepts not to specify method name (passing to outerMethod) in EnclosingMethod attribute, only class name. It's relevant for cases if local class is enclosed in an instance initializer, static initializer, instance variable initializer, or class variable initializer (see https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.7)

Normally Kotlin compiler always fills method name but kotlin-parcelize can generate different instructions because it is a compiler plugin.

Fixes #112

In some rare cases, JVM accepts not to specify method name (passing to `outerMethod`) in `EnclosingMethod` attribute, only class name.
It's relevant for cases if local class is enclosed in an instance initializer, static initializer, instance variable initializer, or class variable initializer (see https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.7)

Normally Kotlin compiler always fills method name but kotlin-parcelize can generate different instructions because it is a compiler plugin.

Fixes #112
@shanshin shanshin requested a review from fzhinkin June 12, 2025 21:12
Copy link
Collaborator

@fzhinkin fzhinkin left a comment

Choose a reason for hiding this comment

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

Nice! I have just a few minor comments.

Copy link
Collaborator

Choose a reason for hiding this comment

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

It seems like this class could be removed safely, for test purposes it's enough to have only the $Creator one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmmm, yes )

@shanshin shanshin requested a review from fzhinkin June 13, 2025 11:37
@shanshin shanshin merged commit 0403f92 into master Jun 13, 2025
1 check passed
@shanshin shanshin deleted the fix-parcelize branch June 13, 2025 12:26
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.

After upgrading to kotlin 1.5.0, the kotlin-parcelize generated code started to be reported as public by binary-compatibility-validator
2 participants