Fixed
Status Update
Comments
yb...@google.com <yb...@google.com> #2
Please include a sample project that reproduces your issue.
ro...@gmail.com <ro...@gmail.com> #3
Sample project linked here:
ro...@gmail.com <ro...@gmail.com> #4
Project: platform/frameworks/support
Branch: androidx-master-dev
commit e3ae9332249aad7636d3050afb3278ada0199fad
Author: Jeremy Woods <jbwoods@google.com>
Date: Thu Jul 30 15:49:25 2020
Ensure ActivityResult lint works with newer lint versions
Previously the lint rule only worked for version 26.3.0 of lint since it
used API that had been deleted in later versions. We have a problem
where we need to be able to on older versions, but should also support
newer versions.
This changes use reflection to access the APIs from version 26.3.0 and
27.1.0, which means the rule should now work no matter what version of
lint.
Test: added tests for 27.1.0, tested in app for 26.3.0
Bug: 162155191
Change-Id: I732ca50aa629fc8a0c2df4c183f363e4a286c490
M activity/activity-lint/src/main/java/androidx/activity/lint/ActivityResultFragmentVersionDetector.kt
M activity/activity-lint/src/test/java/androidx/activity/lint/ActivityResultFragmentVersionDetectorTest.kt
https://android-review.googlesource.com/1380294
Branch: androidx-master-dev
commit e3ae9332249aad7636d3050afb3278ada0199fad
Author: Jeremy Woods <jbwoods@google.com>
Date: Thu Jul 30 15:49:25 2020
Ensure ActivityResult lint works with newer lint versions
Previously the lint rule only worked for version 26.3.0 of lint since it
used API that had been deleted in later versions. We have a problem
where we need to be able to on older versions, but should also support
newer versions.
This changes use reflection to access the APIs from version 26.3.0 and
27.1.0, which means the rule should now work no matter what version of
lint.
Test: added tests for 27.1.0, tested in app for 26.3.0
Bug: 162155191
Change-Id: I732ca50aa629fc8a0c2df4c183f363e4a286c490
M activity/activity-lint/src/main/java/androidx/activity/lint/ActivityResultFragmentVersionDetector.kt
M activity/activity-lint/src/test/java/androidx/activity/lint/ActivityResultFragmentVersionDetectorTest.kt
yb...@google.com <yb...@google.com> #5
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 09a87685c459896deb8f152376b2460c5d759891
Author: Jeremy Woods <jbwoods@google.com>
Date: Fri Jul 31 13:47:02 2020
Ensure check fails on all calls to regsiterForActivityResult
Although fixing one of the errors will fix them all, we should still
make sure we show the errors on all of the calls to
registerForActivityResult, not just the last one.
Test: added test
Bug: 162155191
Change-Id: I28c694547c71ebd97576cf2786e7154cccdf3d22
M activity/activity-lint/src/main/java/androidx/activity/lint/ActivityResultFragmentVersionDetector.kt
M activity/activity-lint/src/test/java/androidx/activity/lint/ActivityResultFragmentVersionDetectorTest.kt
https://android-review.googlesource.com/1384201
Branch: androidx-master-dev
commit 09a87685c459896deb8f152376b2460c5d759891
Author: Jeremy Woods <jbwoods@google.com>
Date: Fri Jul 31 13:47:02 2020
Ensure check fails on all calls to regsiterForActivityResult
Although fixing one of the errors will fix them all, we should still
make sure we show the errors on all of the calls to
registerForActivityResult, not just the last one.
Test: added test
Bug: 162155191
Change-Id: I28c694547c71ebd97576cf2786e7154cccdf3d22
M activity/activity-lint/src/main/java/androidx/activity/lint/ActivityResultFragmentVersionDetector.kt
M activity/activity-lint/src/test/java/androidx/activity/lint/ActivityResultFragmentVersionDetectorTest.kt
yb...@google.com <yb...@google.com> #6
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 09a87685c459896deb8f152376b2460c5d759891
Author: Jeremy Woods <jbwoods@google.com>
Date: Fri Jul 31 13:47:02 2020
Ensure check fails on all calls to regsiterForActivityResult
Although fixing one of the errors will fix them all, we should still
make sure we show the errors on all of the calls to
registerForActivityResult, not just the last one.
Test: added test
Bug: 162155191
Change-Id: I28c694547c71ebd97576cf2786e7154cccdf3d22
M activity/activity-lint/src/main/java/androidx/activity/lint/ActivityResultFragmentVersionDetector.kt
M activity/activity-lint/src/test/java/androidx/activity/lint/ActivityResultFragmentVersionDetectorTest.kt
https://android-review.googlesource.com/1384201
Branch: androidx-master-dev
commit 09a87685c459896deb8f152376b2460c5d759891
Author: Jeremy Woods <jbwoods@google.com>
Date: Fri Jul 31 13:47:02 2020
Ensure check fails on all calls to regsiterForActivityResult
Although fixing one of the errors will fix them all, we should still
make sure we show the errors on all of the calls to
registerForActivityResult, not just the last one.
Test: added test
Bug: 162155191
Change-Id: I28c694547c71ebd97576cf2786e7154cccdf3d22
M activity/activity-lint/src/main/java/androidx/activity/lint/ActivityResultFragmentVersionDetector.kt
M activity/activity-lint/src/test/java/androidx/activity/lint/ActivityResultFragmentVersionDetectorTest.kt
Description
Version used:
Devices/Android versions reproduced on: Android API 26
- Sample project is here:
- Kotlin annotation processor throws this error: "e: [kapt] An exception occurred: java.lang.IllegalArgumentException: ? extends com.codepath.apps.restclienttemplate.models.Tweetcannot be converted to an Element".
The particular line in question is here:
@Query("SELECT * FROM User WHERE userId = :id")
UserTweetsFail byId(long id); // change to UserTweetsWorks to see this pass
Where UserTweetsFail.kt is:
class UserTweetsFail {
@Embedded var user: User? = null
@Relation(parentColumn = "userId", entityColumn = "id", entity=Tweet::class)
var tweets: List<Tweet> = listOf()
}
If I change to use UserTweetWorks to use the Java version
UserTweetWorks.java:
public class UserTweetsWorks {
@Embedded
User user;
@Relation(parentColumn = "userId", entityColumn = "id", entity=Tweet.class)
List<Tweet> tweets;
}
The difference seems to be that a Kotlin collection of tweets is essentially:
@Relation(parentColumn = "userId", entityColumn = "id", entity=Tweet.class)
List<? extends Tweet> tweets;
This seems to break the Auto library, since the list is now a subtype of Tweet.
I'm confused why this didn't show up in the integration tests in AOSP -- there seems to be an exact class (