2

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?

beigirad
  • 4,986
  • 2
  • 29
  • 52
  • 1
    https://stackoverflow.com/questions/4745798/why-java-classes-do-not-inherit-annotations-from-implemented-interfaces/4745820 – Sweeper Nov 18 '18 at 11:02

1 Answers1

1

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

itsjwala
  • 106
  • 7