beigirad
beigirad

Reputation: 5724

default annotation for method of an interface

I have an interface:

public interface PermissionCallback {
    @SuppressLint("MissingPermission")
    void grantedPermission(String permission);

    void deniedPermission(String permission);
}

and I want when I implement it, by default add @SuppressLint("MissingPermission") on overridden method. like this:

@SuppressLint("MissingPermission")
@Override
public void grantedPermission(String permission) {
   //...
}

Can anyone tell me, why it doesn't add?

Upvotes: 2

Views: 302

Answers (1)

itsjwala
itsjwala

Reputation: 106

Annotation on methods aren't inherited as properly explained in this answer though if you want to check if the method have the annotation you can explicity write a custom function that will do it for you, also well explained here

Upvotes: 1

Related Questions