Welcome! Please see the About page for a little more info on how this works.

0 votes
in Java Interop by

When extending a class gen-class doesn't preserve method annotations.

If class com.bar.Foo has annotated methods then in MyClass all annotations are gone.

(gen-class
:name com.my.MyClass
:extends com.bar.Foo
:implements (link: com.google.common.base.Supplier)
:prefix demo-
:post-init post-init)

(defn demo-post-init (link: this)
(info "initialized")
(swank.swank/start-server :port 68478))

(defn demo-get (link: _)
(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());
            }
        }

1 Answer

0 votes
by
Reference: https://clojure.atlassian.net/browse/CLJ-1022 (reported by alex+import)
...