w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Class.getAnnotations() / getDeclaredAnnotations() returns empty array for subclass

From the javadocs of java.lang.annotation.Inherited:

    Note that this meta-annotation type has no effect if the
annotated type is used to annotate 
    anything other than a class. Note also that this meta-annotation only
causes annotations to be 
    inherited from superclasses; annotations on implemented interfaces have
no effect.

so change interface to class. it will affect

class MyClass {
    public void myMethod(){


class MySecondClass extends MyClass {


© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.