commit | 98bee659f15e078efbc7444eabca81c9656cf058 | [log] [tgz] |
---|---|---|
author | mattgilbride <mattgilbride@google.com> | Mon Jun 27 01:17:19 2022 +0000 |
committer | Matt Gilbride <mattgilbride@google.com> | Tue Jun 28 11:09:36 2022 +0000 |
tree | 8dcfe2b63f7e33cf8810af559fa114fe278abb9f | |
parent | 406f90085e7a79904d5cb54c89115805d37ca856 [diff] |
236262744: Don't compute platform annotations from merge context The parsing environment is not available when lint is only filtering and merging module analysis results. The permission error detector was looking up the platform annotations when analyzing the merged manifest, which would throw exceptions (flakily, because it can normally access the cached platform annotations from the module analysis phase, but this won't run if the module analysis results have been cached). However, it didn't actually *need* to compute the platform annotations, because while it does look them up, it doesn't actually use them when running on the merged manifest (it computes the nearest match, but then discards the result if it's looking at a merged manifest). This is deliberate; when we're analyzing the merged manifest, we can (and usually do) come across permission declarations from libraries, and we don't want to flag issues in these; there's nothing a developer can do here. We actually only use the merged manifest to check the CustomPermissionTypo issue type. Therefore, the fix here is to use lint's built in `visitElement` method for all other checks, and use `checkMergedProject` ONLY for CustomPermissionTypo. Test: Existing (though the unit test now nulls out the cached permissions between phases, which means the test would crash as it did flakily earlier if we were trying to compute platform annotations from the merge phase.) Fixes: 236262744 Change-Id: I505dffc7aee1d267362fdf72a70f5bf2217f9006
This project contains: