Fixed
Status Update
Comments
il...@google.com <il...@google.com> #2
Hi Ed, Thank you so much for these suggestions. I've been reviewing them and merging them in. Hopefully it should be live. I've included a thank you note too in the article.
la...@gmail.com <la...@gmail.com> #3
Great! Thanks a lot, I'll look for the live updates soon!
il...@google.com <il...@google.com>
ap...@google.com <ap...@google.com> #4
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 7ace325454f63cfd3d574ab30cf3f28b1d349df9
Author: Rahul Ravikumar <rahulrav@google.com>
Date: Mon Feb 24 16:18:59 2020
Fix for lint UseRequireInsteadOfGet false positives
* When checking for reference expressions, ignore local variables.
Test: Added unit tests.
Fixes: b/149891163
Change-Id: I636a6d059967064f6e0c9c435fdf2f3556b2ed00
M fragment/fragment-lint/src/main/java/androidx/fragment/lint/UseRequireInsteadOfGet.kt
M fragment/fragment-lint/src/test/java/androidx/fragment/lint/UseRequireInsteadOfGetTest.kt
https://android-review.googlesource.com/1242418
Branch: androidx-master-dev
commit 7ace325454f63cfd3d574ab30cf3f28b1d349df9
Author: Rahul Ravikumar <rahulrav@google.com>
Date: Mon Feb 24 16:18:59 2020
Fix for lint UseRequireInsteadOfGet false positives
* When checking for reference expressions, ignore local variables.
Test: Added unit tests.
Fixes:
Change-Id: I636a6d059967064f6e0c9c435fdf2f3556b2ed00
M fragment/fragment-lint/src/main/java/androidx/fragment/lint/UseRequireInsteadOfGet.kt
M fragment/fragment-lint/src/test/java/androidx/fragment/lint/UseRequireInsteadOfGetTest.kt
il...@google.com <il...@google.com> #5
We've fixed this internally and it'll be available in the upcoming Fragment 1.3.0-alpha01 release (and if we do a Fragment 1.2.3, it'll also be a part of that).
Description
Version used: 1.2.2
The UseRequireInsteadOfGet lint checks in androidx-fragment 1.2.2 can detect false positives. Consider the following Java code in a Fragment:
View view = getSomeCompletelyUnrelatedView();
Objects.requireNonNull(view);
results in the following lint error:
Error: Use requireView() instead of Objects.requireNonNull(view) [UseRequireInsteadOfGet]
which would be valid if view was the result of a getView() call but it isn't.
Workaround: Rename the view variable to some other name