当扩展类时,gen-class不会保留方法注释。
如果类com.bar.Foo有注解方法,那么在MyClass中所有注解都是丢失的。
(gen-class
:name com.my.MyClass
:extends com.bar.Foo
:implements (连接: com.google.common.base.Supplier)
:prefix demo-
:post-init post-init)
(defn demo-post-init (连接: this)
(info "初始化")
(swank.swank/start-server :port 68478))
(defn demo-get (连接: _)
(get-msg))
Class<?> aClass = Class.forName("com.my.MyClass");
Method(link: ) methods = aClass.getMethods();
for (Method m : methods) {
Annotation(link: ) annotations = m.getAnnotations();
System.out.println(m.getName()+" "+annotations.length);
for (Annotation a : annotations) {
System.out.println(a.annotationType().getClass().getName());
}
}