Conversation
This is an accompanying commit to a previous such commit, which was mainly targeted Kotlin classes. As such, this commit now mainly targets Java classes. You will also notice that not all such Java classes are being annotated with the '@SuppressWarnings("deprecation")'. This is due to the fact that different versions of libraries are using different implementation of 'onActivityResult(...)', which result to this suppression being redundant if added, or at least seeming so. Thus, by adding that, another set of such redundant suppression warnings are adding to the list of overall warnings, and thus, at least for now, this is being avoided in order to not having to then remove those again afterwards. For more info see this commit: 103b90c
Warning Message: "'onActivityResult(Int, Int, Intent?): Unit' is deprecated. Overrides deprecated member in 'androidx.activity.ComponentActivity'. Deprecated in Java" Explanation: "This deprecation overrides deprecated member but not marked as deprecated itself. This deprecation won't be inherited in future releases. Please add @deprecated or suppress. See https://youtrack.jetbrains.com/issue/KT-47902 for details."
Warning Message: "'toUpperCase(Locale): String' is deprecated. Use uppercase() instead." Replacing 'toUpperCase(...)' with 'uppercase(...)' is the recommended action to resolve this kind of deprecated warnings.
Warning Message: "'toLowerCase(Locale): String' is deprecated. Use lowercase() instead." Replacing 'toLowerCase(...)' with 'lowercase(...)' is the recommended action to resolve this kind of deprecated warnings.
Warning Message: "'AVATAR' is deprecated. Use AVATAR_WITH_BACKGROUND or AVATAR_WITHOUT_BACKGROUND instead." It is still unclear whether it is safe to replace 'AVATAR' with 'AVATAR_WITH_BACKGROUND', see it being suggested by the 'replaceWith' deprecated annotation field. As such, there deprecated warnings are suppressed, that is, instead of being resolved, since a resolution would require a proper investigation. For more info see: - Issue/deprecate avatar type #8468 (Introduced In): #8468
Warning Message: "'sumBy((T) -> Int): Int' is deprecated. Use sumOf instead." Replacing 'sumBy(...)' with 'sumOf(...)' is the recommended action to resolve this kind of deprecated warnings.
Warning Messages: "'capitalize(Locale): String' is deprecated.
Use replaceFirstChar instead."
This deprecated warning is suppressed, that is, instead of it being
resolved, since using 'replaceFirstChar { ... }' is a bit complicated
and it would need a bit more thought.
Warning Messages:
- "'PhotoPickerFragment' is deprecated. This class is being refactored,
if you implement any change, please also update
{@link org.wordpress.android.ui.mediapicker.MediaPickerFragment}"
- "'PhotoPickerViewModel' is deprecated. This class is being refactored,
if you implement any change, please also update
{@link org.wordpress.android.ui.mediapicker.MediaPickerViewModel}"
- "'PhotoPickerAdapter' is deprecated. This class is being refactored,
if you implement any change, please also update
{@link org.wordpress.android.ui.mediapicker.MedaPickerAdapter}"
- "'PhotoPickerAdapterDiffCallback' is deprecated. This class is being
refactored, if you implement any change, please also update
{@link org.wordpress.android.ui.mediapicker.
MedaPickerAdapterDiffCallback}"
- "'PhotoPickerActionModeCallback' is deprecated. This class is being
refactored, if you implement any change, please also update
{@link org.wordpress.android.ui.mediapicker.
MedaPickerActionModeCallback}"
- "'PhotoPickerItem' is deprecated. This class is being refactored, if
you implement any change, please also update
{@link org.wordpress.android.ui.mediapicker.MediaItem}"
- "'PhotoPickerUiItem' is deprecated. This class is being refactored, if
you implement any change, please also update
{@link org.wordpress.android.ui.mediapicker.MedaPickerUiItem}"
- "'ThumbnailViewHolder' is deprecated. This class is being refactored,
if you implement any change, please also update
{@link org.wordpress.android.ui.mediapicker.ThumbnailViewHolder}"
- "'PhotoThumbnailViewHolder' is deprecated. This class is being
refactored, if you implement any change, please also update
{@link org.wordpress.android.ui.mediapicker.PhotoThumbnailViewHolder}"
- "'VideoThumbnailViewHolder' is deprecated. This class is being
refactored, if you implement any change, please also update
{@link org.wordpress.android.ui.mediapicker.VideoThumbnailViewHolder}"
- "'ThumbnailViewUtils' is deprecated. This class is being refactored,
if you implement any change, please also update
{@link org.wordpress.android.ui.mediapicker.ThumbnailViewUtils}"
- "'DeviceMediaListBuilder' is deprecated. This class is being
refactored, if you implement any change, please also update
{@link org.wordpress.android.ui.mediapicker.loader.DeviceListBuilder}"
These deprecated warnings are suppressed, that is, instead of being
resolved, since a resolution would require a proper migration.
You will also notice that I optimized the deprecated imports and
suppress the deprecation closer to source wherever possible, that is,
instead on suppressing it on the file level. Thus, in this change you
will also notice some refactoring related to optimizing the imports.
Only the 'EditorPhotoPicker' related deprecation got suppressed both, on
the file level and closer to the deprecation itself.
Example Explanation: See KDoc on 'PhotoPickerFragment' class.
"This class is being refactored, if you implement any change, please
also update {@link org.wordpress.android.ui.mediapicker.
MediaPickerFragment}"
Warning Message: "'onRequestPermissionsResult(Int, Array<String>, IntArray): Unit' is deprecated. Overrides deprecated member in 'androidx.fragment.app.Fragment'. Deprecated in Java" Explanation: "This deprecation overrides deprecated member but not marked as deprecated itself. This deprecation won't be inherited in future releases. Please add @deprecated or suppress. See https://youtrack.jetbrains.com/issue/KT-47902 for details."
Warning Messages: - "'GoogleApiClient' is deprecated. Deprecated in Java" - "'Builder' is deprecated. Deprecated in Java" - "'ConnectionCallbacks' is deprecated. Deprecated in Java" - "'FirebaseInstanceId' is deprecated. Deprecated in Java" - "'deleteInstanceId(): Unit' is deprecated. Deprecated in Java" These deprecated warnings are suppressed, that is, instead of being resolved, since a resolution would require a proper migration. You will also notice that I suppressed the deprecated warning both, on the file level and closer to the deprecation itself. I did that because suppressing on the file level was necessary due to the 'com.google.android.gms.common.api.GoogleApiClient' and 'com.google.firebase.iid.FirebaseInstanceId' imports that can't be suppressed any other way. But, when doing so, every deprecated warning is suppressed as well. At which point the deprecated information is lost. This way, adding first the '@Suppress("DEPRECATION")' closer to source and then adding it on the file level makes sure that this information is not lost, at least for the existing code. For more info see: - Compiler Warnings as Errors - WordPress Module - AppInitializer - Google API Client & Firebase Instance Id #17229 (Issue:) #17229
Warning Messages: - "'CONNECTIVITY_ACTION: String' is deprecated. Deprecated in Java" - "'getter for type: Int' is deprecated. Deprecated in Java" - "'TYPE_WIFI: Int' is deprecated. Deprecated in Java" - "'TYPE_MOBILE: Int' is deprecated. Deprecated in Java" - "'getter for activeNetworkInfo: NetworkInfo?' is deprecated. Deprecated in Java" - "'getter for isConnected: Boolean' is deprecated. Deprecated in Java" These deprecated warnings are suppressed, that is, instead of being resolved, since a resolution would require a proper migration. For more info see: - Compiler Warnings as Errors - WordPress Module - Connectivity Manager & Network Info #17230 (Issue): #17230
Warning Messages: - "'getter for view: View?' is deprecated. Deprecated in Java" - "'setColorFilter(Int, PorterDuff.Mode): Unit' is deprecated. Deprecated in Java" These deprecated warnings are suppressed, that is, instead of being resolved, since a resolution would require a proper migration to snackbar (from toast). For more info see: - android.widget.Toast.getView (Docs): https://developer.android.com/reference/android/widget/Toast#getView() - android.graphics.drawable.Drawable.setColorFilter (Docs): https://developer.android.com/reference/android/graphics/drawable/ Drawable#setColorFilter(int,%20android.graphics.PorterDuff.Mode)
Warning Messages: - "'setter for systemUiVisibility: Int' is deprecated. Deprecated in Java" - "'getter for systemUiVisibility: Int' is deprecated. Deprecated in Java" - "'SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN: Int' is deprecated. Deprecated in Java" - "'SYSTEM_UI_FLAG_LAYOUT_STABLE: Int' is deprecated. Deprecated in Java" These deprecated warnings are suppressed, that is, instead of being resolved, since a resolution would require a proper migration. For more info see: - android.view.View.setSystemUiVisibility (Docs): https://developer.android.com/reference/android/view/ View#setSystemUiVisibility(int) - android.view.View.getSystemUiVisibility (Docs): https://developer.android.com/reference/android/view/ View#getSystemUiVisibility()
Warning Message: "'onActivityCreated(Bundle): Unit' is deprecated. Overrides deprecated member in 'androidx.fragment.app.Fragment'. Deprecated in Java" Explanation: "This deprecation overrides deprecated member but not marked as deprecated itself. This deprecation won't be inherited in future releases. Please add @deprecated or suppress. See https://youtrack.jetbrains.com/issue/KT-47902 for details."
Warning Message:
- "'showFullScreen(View!): Unit' is deprecated. Deprecated in Java"
- "'setLightStatusBar(Window!, Boolean): Unit' is deprecated.
Deprecated in Java"
- "'setLightNavigationBar(Window!, Boolean): Unit' is deprecated.
Deprecated in Java"
These deprecated warnings are suppressed, that is, instead of being
resolved, since a resolution would require a proper migration.
Explanation: See Javadoc on related 'WPActivityUtils' class methods.
"Use {@link WindowExtensionsKt} instead."
After resolving some of the compile related deprecated warnings, some Detekt baseline related warnings needed to be removed and suppressed closer to source because the lines on those classes got changed.
This was referenced Oct 7, 2022
Contributor
|
|||||||||||
| 💡 Scan this QR code with your Android phone to download and install the APK directly on it. | ||
| App | Jetpack | |
| Build Flavor | Jalapeno | |
| Build Type | Debug | |
| Commit | 4c2033a | |
Contributor
|
|||||||||||
| 💡 Scan this QR code with your Android phone to download and install the APK directly on it. | ||
| App | WordPress | |
| Build Flavor | Jalapeno | |
| Build Type | Debug | |
| Commit | 4c2033a | |
… into analysis/wordpress-main-deprecated-warnings-part-2 � Conflicts: � WordPress/src/main/java/org/wordpress/android/ui/mediapicker/loader/DeviceMediaLoader.kt
Generated by 🚫 dangerJS |
… into analysis/wordpress-main-deprecated-warnings-part-2
8 tasks
Contributor
Author
|
👋 @ovitrif ! FYI: I am seeing @irfano is AFK this week, as such I am assigning you to this PR as well (round robin style), just in case you find some time to review it. However, this is not that urgent so please don't be too much alerted by that, meaning, please do take your time with it, as much as you need. 🙇 |
Contributor
Author
Closed
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Parent: #17173
Partially Closes: #17181
This PR resolves one part of all
Deprecatedrelated warnings for theWordPressmodule, and in this part, the most generic ones and specific to the main, debug, wordpress and jetpack sources:Main Source (
247Leftovers +118):247warnings x'XYX' is deprecated. Deprecated in Java(Leftovers from part.1 PR)5warnings x'Xyz' is deprecated. Overrides deprecated member in 'xyz'. Deprecated in Java24warnings x'xyz' is deprecated. Use xyz instead.2warnings x'Xyz' is deprecated. This should be removed once we start receiving Xyz the source block from the backend87warnings x'Xyz' is deprecated. This class is being refactored, if you implement any change, please also update xyzDebug/WordPress/Jetpack Source (
11):11warnings x'Xyz' is deprecated. Deprecated in JavaWarnings Resolution List:
Warnings Suppression List:
In addition to the above warning resolution list, the below
Detektwarnings got resolved as well, leaving Detekt'sbaseline.xmlfile 2 entries shorter:PS: @irfano (plus @ovitrif) I added you as the main reviewer(s), that is, in addition to @wordpress-mobile/apps-infrastructure team itself, but randomly, since I want someone from the WordPress Android team to primarily sign-off on that change. 🥇
FYI: I am going to randomly add more of you in those PRs that will follow, just so you become more aware of this change and how close we are on enabling allWarningsAsErrors by default everywhere. 🎉
To test:
WordPressandJetpackapps, and see if they are both working as expected.Regression Notes
N/A
See
To testsection above.N/A
PR submission checklist:
RELEASE-NOTES.txtif necessary.