Skip to content
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

Fix dualkotlintest #1064

Closed
wants to merge 6 commits into from
Closed

Fix dualkotlintest #1064

wants to merge 6 commits into from

Conversation

ZacSweers
Copy link
Collaborator

This wasn't actually running reflection before because the reflection adapter will use generated adapters anyway if available. I've added an overload that allows controlling this behavior (default is enabled), as I'm not sure how else to set this up.

This also makes an opportunistic optimization to defer checking for generated classes until just before the ClassJsonAdapter, as it avoids unnecessary reflection checks before other non-generatable-types like collections/maps/arrays.

Copy link
Collaborator

@rharter rharter left a comment

Choose a reason for hiding this comment

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

The code looks good, here, but I'm a little unclear about the use case. Why would someone choose to use the reflection adapter and have that override generated adapters? If you didn't want codegen wouldn't you just not include the kapt dependency?

@rharter
Copy link
Collaborator

rharter commented Jan 13, 2020

If this is just for the test, I wonder if there's a way to either make the test more representative by breaking out the functional reflection test into it's own module that doesn't include codegen, or using some internal constant or something that the compiler can optimize away, so we don't add an if check and constructor param confusion, adding complexity to the code for a test case.

@ZacSweers
Copy link
Collaborator Author

Yeah it's kind of just for the test. Breaking out tests would be a lot of duplication. Maybe just a simple internal backdoor but there's no package private in Kotlin :/

@rharter
Copy link
Collaborator

rharter commented Jan 13, 2020 via email

@ZacSweers
Copy link
Collaborator Author

I've got another idea. Involves a backdoor but it's at least not public API

@ZacSweers ZacSweers closed this Mar 28, 2020
@oldergod oldergod deleted the z/fixedDual branch August 5, 2020 17:21
@ZacSweers ZacSweers mentioned this pull request Sep 10, 2021
3 tasks
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.

None yet

2 participants