-
Notifications
You must be signed in to change notification settings - Fork 674
Add a null-check to java enum safeValueOf #5904
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
Conversation
✅ Deploy Preview for apollo-android-docs canceled.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments. Also, can we do the same for Kotlin codegen?
.../example/case_sensitive_enum/java/operationBased/case_sensitive_enum/type/Enum.java.expected
Outdated
Show resolved
Hide resolved
.../example/case_sensitive_enum/java/operationBased/case_sensitive_enum/type/Enum.java.expected
Outdated
Show resolved
Hide resolved
...src/main/kotlin/com/apollographql/apollo3/compiler/codegen/java/schema/EnumAsClassBuilder.kt
Show resolved
Hide resolved
You're right! We can make the class constructor private. I'd keep the Kotlin |
I'd try to keep the symmetry with Java as much as possible.
I'd go for that. And rename the |
Turns out, actually in Kotlin we can't make the |
Make enums as sealed classes generate sealed interfaces
* Add a null-check to java enum safeValueOf * Make java enum as class' equals and hashcode call super * Update expected * Fix test * Re-generate expected * Add a comment to checkNotNull * Fix hashCode equals and toString * Rename ApolloEnumConstructor to ApolloUnknownEnum and apply it to safeValueOf * Update API dump * Make enums as sealed classes generate sealed interfaces * Remove ApolloUnknownEnum
Fix for #5901
UNKNOWN__
nullablesuper()
inequals()
andhashCode()