-
Notifications
You must be signed in to change notification settings - Fork 906
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
Improve KDoc on ActivityLifecycleEvent
by explaining ordering semantics.
#586
Conversation
bfcb313
to
5d21e2c
Compare
Also, a couple of minor fixes: - A small warning on `RibActivity` against importing `android.R`. - Replaces deprecated `String.toLowerCase()` and `String.capitalize()` with the equivalent `String.lowercase()` and `String.replaceFirstChar(Char::titlecase)`.
ActivityLifecycleEvent
explaining ordering semantics.ActivityLifecycleEvent
by explaining ordering semantics.
* | ||
* The equality does not hold: | ||
* ``` | ||
* assertThat(a == b).isFalse() |
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.
Should they be?
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.
IMO, no, because Android bundles also do not implement equals. From its Javadoc:
Warning: Note that [Bundle](https://developer.android.com/reference/android/os/Bundle) is a lazy container
and as such it does NOT implement
[Object.equals(java.lang.Object)](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))
or [Object.hashCode()](https://developer.android.com/reference/java/lang/Object#hashCode()).
@@ -79,7 +109,7 @@ private constructor( | |||
Type.DESTROY -> DESTROY_EVENT | |||
else -> | |||
throw IllegalArgumentException( | |||
"Use the createOn${type.name.toLowerCase().capitalize()}Event() method for this type!", | |||
"Use the createOn${type.name.lowercase().replaceFirstChar(Char::titlecase)}Event() method for this type!", |
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.
Kind of surprised they replaced capitalize with this, it's much more verbose and less obvious for folks.
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.
Actually the drop in replacement is even more verbose (suggested by ReplaceWith):
replaceFirstChar { if (it.isLowerCase()) it.titlecase(locale) else it.toString() }
From googling It, it seems the original deprecated capitalize function had issues with
- Not taking a locale (deprecated in favor of
capitalize(Locale)
capitalize(Locale)
is also deprecated, because of surprising behavior on characters that are one char in Unicode, but actually two chars in the natural language.
Both of which don't matter at this particular call site of ours
Also, a couple of minor fixes:
RibActivity
against importingandroid.R
.String.toLowerCase()
andString.capitalize()
with the equivalentString.lowercase()
andString.replaceFirstChar(Char::titlecase)
.