-
Notifications
You must be signed in to change notification settings - Fork 37
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
[Nullability Annotations to Java Classes] Add Missing Nullability Annotations to Theme
Model Classes (breaking
)
#2897
[Nullability Annotations to Java Classes] Add Missing Nullability Annotations to Theme
Model Classes (breaking
)
#2897
Conversation
FYI: 'n-a' stands for 'nullable annotations'.
Warning: "Condition 'other == null' covered by subsequent condition '!(other instanceof ThemeModel)'" FYI: One could resolve this warning, simply by removing the unnecessary 'other == null' condition, but this would change the 'equals(...)' logic and possible introduce some kind of a regression, most liked performance wise. Thus, it is better to ignore this atm, just by suppressing it, and call this out of scope.
FYI: 'n-a' stands for 'nullability annotations'. PS: This 'NotNullFieldNotInitialized' warning got suppressed because a table related 'model' class can never have its fields initialized via a constructor initialization, or otherwise for that matter.
This is done so that clients of that model, clients like JP/WPAndroid, when trying to manually instantiating such a model (if needed), they will always use the non-default constructor. The empty default constructor was added because '@table' related models need to have one such constructor. Otherwise, its 'Mapper' related auto-generated class would fail to compile, in this case the 'ThemeModelMapper.java' class. Also, 2 full-ish-arguments constructor were added, which should be the preferred and goto constructor for most cases, one for a WP.coma theme, and one for a Jetpack theme. FYI: The trick I used to first '@deprecated' this constructor is to help clients avoid using this constructor in the future, that is, when they manually construct one. Suppressing the 'DeprecatedIsStillUsed' warning was necessary because otherwise, even if every occurrence in the codebase is being switched to the non-default constructor, the auto-generated 'Mapper' related class will anyway use that default constructor, thus this warning will persist no matter what.
FYI: 'n-a' stands for 'nullability annotations'
FYI: 'n-a' stands for 'nullability annotations'
FYI: 'n-a' stands for 'nullability annotations'
FYI: 'n-a' stands for 'nullability annotations'
FYI: 'n-a' stands for 'nullability annotations'
FYI: 'n-a' stands for 'nullability annotations'
FYI: 'n-a' stands for 'nullability annotations'
FYI: 'n-a' stands for 'nullability annotations'
Makes sense @ParaskP7 👍 Heads up that I would probably get to it after the division meetup on the week starting on November 20th. |
Thanks for the heads-up @antonis and no worries, please take your time with it. And actually, since I am on paternity leave from next week, feel free to move forward with this, and its accompanying JP/WPAndroid PR as you see fit. 😊 |
…s-to-theme-model-classes # Conflicts: # fluxc/src/main/java/org/wordpress/android/fluxc/model/ThemeModel.java # fluxc/src/main/java/org/wordpress/android/fluxc/network/rest/wpcom/theme/ThemeRestClient.java # fluxc/src/main/java/org/wordpress/android/fluxc/persistence/ThemeSqlUtils.java # fluxc/src/main/java/org/wordpress/android/fluxc/store/ThemeStore.java
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.
Parent #2799
Closes #2840
This PR adds any missing nullability annotation to ThemeModel.java model and all related store & sql-util classes.
FYI: This change is
breaking
, meaning that any client that depended on the ThemeModel.java model should update to the new APIs (non-default constructors
) as the existing API (default constructor
) are now deprecated. As such, this change is inherentlyrisky
, meaning that there are compile-time changes associated with this change and thus needs testing to verify correctness, both on the library's and client's side.PS: Any other changes on any other class are just some propagating missing nullability annotation changes, which stem from the main set of classes being updated, this PR's focus, plus, some other extra minor analysis, refactor and test related changes.
PS: @antonis I added you as the main reviewer, not so randomly (it being a continuation of #2893), since I just wanted someone from the Jetpack/WordPress mobile team to be aware of and sign-off on that change. Feel free to merge this PR directly yourself if you deem so.
Nullability Annotations List (
Model
):Nullability Annotations List (
Store
):Warnings Suppression List:
Associated Clients
It is highly recommending that this change is being tested on the below associated clients:
To Test (
REST
):FluxC Example
app via theTHEME
screen. Verify everything is working as expected.To Test (
XMLRPC
):N/A
1. [JP/WP] Themes Screen [ThemeBrowserActivity.java + ThemeBrowserFragment.kt]
ℹ️ This test applies to both, the
Jetpack
andWordPress
apps.Themes
screen, verify it is shown and functioning as expected.Customize
,Details
andSupport
buttons. Verify that everything works as expected.Customize
,Details
andSupport
buttons. Verify that everything works as expected.Details
andSupport
buttons. Verify that everything works as expected.View
andTry & Customize
buttons. Verify that everything works as expected.Activate
button. Verify that the selected theme is activated and that everything works as expected.2. [JP] Site Creation Screens [SiteCreationActivity.kt + HomePagePickerFragment.kt + DesignPreviewFragment.kt]
ℹ️ This test applies to the
Jetpack
app only.Choose Site
, tap on the+
button on top and via theCreate WordPress.com site
, go toSite Creation
screen, verify it is shown and functioning as expected.What's your website about?
screen, select a topic from the list of topics (ie.Food
).Choose a theme
screen, select a theme from the list of themes (per category, ieAbout
).Preview
screen is shown and functioning as expected.Merge instructions:
[PR] Not Ready for Merge
label.