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

[Lifecycle] [Lint] fixes b/184830263 Lint should use check reference too #161

Closed
wants to merge 3 commits into from

Conversation

kozaxinan
Copy link
Contributor

@kozaxinan kozaxinan commented Apr 17, 2021

Proposed Changes

  • Fix NonNullableMutableLiveDataDetector for different cases. It is possible to only set type reference and omit call's generic argument.
  • Added check for generic values because default upper bound of generic (if none specified) is Any?. If generic is not specified as <T : Any>, T can be defined null at call site. https://kotlinlang.org/docs/generics.html#upper-bounds

Testing

Test: Run NonNullableMutableLiveDataDetectorTest with new edge cases.
nullLiteralFailMultipleFields : Added type reference
justKotlinObject : Add additional test to prevent ArrayIndexOutOfBoundsException. It is fixed in 428f0ec but not tested. It is reported here with b/184830262
genericParameterDefinition : Generics are assumed as nullable, lint should ignore.

Issues Fixed

Fixes: The bug on b/184830263 being fixed
Fixes: Tests b/184830262

@googlebot
Copy link
Collaborator

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

1 similar comment
@google-cla
Copy link

google-cla bot commented Apr 17, 2021

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@kozaxinan
Copy link
Contributor Author

@googlebot I signed it!

@googlebot
Copy link
Collaborator

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

1 similar comment
@google-cla
Copy link

google-cla bot commented Apr 17, 2021

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@jbw0033 jbw0033 self-requested a review April 19, 2021 17:25
@kozaxinan
Copy link
Contributor Author

@jbw0033 Is there anything I can add to this PR?
This lint blocks us to update latest version of lifecycle.

@kozaxinan kozaxinan requested a review from jbw0033 May 3, 2021 16:41
@kozaxinan kozaxinan requested a review from jbw0033 May 5, 2021 09:02
@jbw0033
Copy link

jbw0033 commented May 5, 2021

From our internal lint:

lifecycle/lifecycle-livedata-core-ktx-lint/src/test/java/androidx/lifecycle/lint/NonNullableMutableLiveDataDetectorTest.kt
#202
Patchset 1
9:08 AM
Lint 🤖
Please remove the trailing whitespace.

#794
Patchset 1
9:08 AM
Lint 🤖
Please remove the trailing whitespace.

@kozaxinan
Copy link
Contributor Author

kozaxinan commented May 5, 2021

From our internal lint:

lifecycle/lifecycle-livedata-core-ktx-lint/src/test/java/androidx/lifecycle/lint/NonNullableMutableLiveDataDetectorTest.kt
#202
Patchset 1
9:08 AM
Lint 🤖
Please remove the trailing whitespace.

#794
Patchset 1
9:08 AM
Lint 🤖
Please remove the trailing whitespace.

I deleted whitespaces. When I run ./gradlew buildOnServer some unrelated lints fails, is that expected? (even on main branch)

@copybara-service copybara-service bot closed this in 655e08d May 6, 2021
@kozaxinan kozaxinan deleted the 184830263 branch May 6, 2021 16:02
@jbw0033
Copy link

jbw0033 commented May 6, 2021

Thank you for the pull request!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants