I'm having a strange issue with inspections in a project that I created only a few days ago in IDEA 2016.3.3, which I upgraded to 2016.3.5 when I encountered this issue. The problem persists in the older project even after invalidating caches and restarting. I cannot reproduce it in a new project created in 2016.3.5.
Both projects have the same minSdkVersion
, targetSdkVersion
, compileSdkVersion
, and buildToolsVersion
. What else could cause this difference in inspection behavior?
I created an identical class in both projects:
public class PermissionWeirdness {
public void foo() {
bar();
baz();
}
@RequiresPermission(Manifest.permission.ACCESS_FINE_LOCATION)
private void bar() {}
@RequiresPermission(Manifest.permission.GET_ACCOUNTS)
private void baz() {}
}
ACCESS_FINE_LOCATION
andGET_ACCOUNTS
are both classified as "dangerous" permissions.- In both projects, as expected, warnings appear in
foo()
on the calls tobar()
andbaz()
. - In the newer project, both warnings have the same form:
Missing permission required by PermissionWeirdness.bar: android.permission.ACCESS_FINE_LOCATION
- In the older project, the warning related to
ACCESS_FINE_LOCATION
has a completely different message. The tooltip text has literal backticks in it that are interpreted here as code tags:Call requires permission which may be rejected by user: code should explicitly check to see if permission is available ( with
checkPermission
) or explicitly handle a potentialSecurityException
- In both projects, the warnings that take the shorter form can be eliminated by adding the appropriate
@RequiresPermission
annotation tofoo()
. - In the older project, the mysterious longer warning cannot be eliminated in this manner.