首页 > 编程知识 正文

java多线程,注解是怎么起作用的

时间:2023-05-05 12:49:54 阅读:24497 作者:3104

正在进行Java(JavaX )注释处理。

假设有一种评论的方法:

@target(elementtype.method )。

public @ interfacemethodannotation { }

现在,我想使用带注释的方法来处理类型涵盖的所有方法:

接口my接口(

@MethodAnnotation

void f () )

}

classmyclassimplementsmyinterface {

override void f () /

}

@Inherited元注释在此似乎不合适:

notethatthismeta -注释类型pehasnoeffectiftheannotatedtypeisusedtoannotateanythingotherthanaclass。

另外,是否可以处理未被子类覆盖的继承类方法? 我喜欢这个:

class MyClass {

@MethodAnnotation

void f () }

}

classmysubclassextendsmyclass { }//

//oratleasttofindoutthatitdoesn ' t

//override the method

如何在AbstractProcessor中访问某种方法的覆盖方法?

为了实现这一点,我认为有必要找到eclosing类的子类,但还没有找到实现它的方法。

我认为可以使用upd:round environment.getrootelements () ),但还没有找到正确的方法。

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。