Skip to content
Snippets Groups Projects
Commit 6b96811d authored by Thiébaud Weksteen's avatar Thiébaud Weksteen Committed by Automerger Merge Worker
Browse files

Merge changes I04c68e95,I9ab2b654,Ic0104961 into main am: c0857666

parents fa8ce651 c0857666
No related branches found
No related tags found
No related merge requests found
......@@ -197,6 +197,15 @@ class EnforcePermissionDetector : Detector(), SourceCodeScanner {
/* Check that we are connected to the super class */
val overridingMethod = node as PsiMethod
val parents = overridingMethod.findSuperMethods()
if (parents.isEmpty()) {
context.report(
ISSUE_MISUSING_ENFORCE_PERMISSION,
node,
context.getLocation(node),
"The method ${node.name} does not override an AIDL generated method"
)
return
}
for (overriddenMethod in parents) {
// The equivalence check can be skipped, if both methods are
// annotated, it will be verified by visitAnnotationUsage.
......
......@@ -28,7 +28,8 @@ class EnforcePermissionHelperDetectorCodegenTest : LintDetectorTest() {
override fun getDetector(): Detector = EnforcePermissionDetector()
override fun getIssues(): List<Issue> = listOf(
EnforcePermissionDetector.ISSUE_ENFORCE_PERMISSION_HELPER
EnforcePermissionDetector.ISSUE_ENFORCE_PERMISSION_HELPER,
EnforcePermissionDetector.ISSUE_MISUSING_ENFORCE_PERMISSION
)
override fun lint(): TestLintTask = super.lint().allowMissingSdk(true)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment