java - Can't retrieve method annotation into Jar file -


i try retrieve cucumber annotations make content assist plugin. don't know why code not work. reflexion api return me null method.getdeclaredannotations().

public list<string> getstepdefinition() throws classnotfoundexception, ioexception {         string location = platform.getpreferencesservice().                   getstring("mypref", "jarlocation", null, null);         if(location != null) {             file f = new file(location);             url url = f.touri().tourl();               url[] urls = new url[]{url};             urlclassloader cl = new urlclassloader(urls);              class<?> clazz = cl.loadclass("mystepdefinitionfile");             method[] methods = clazz.getdeclaredmethods();             (method method : methods) {                 if(method.isannotationpresent(soit.class)) {                     soit annotation = method.getannotation(soit.class);                     annotation.value();                 }             }             cl.close();         }         return null;     } 

in debug mode, see class found , can list methods. can't list method annotations. reflexion api don't find them.

this soit.class

@retention(retentionpolicy.runtime) @target(elementtype.method) @stepdefannotation @documented public @interface soit {     /**      * @return regular expression      */     string value();      /**      * @return max amount of milliseconds allowed run for. 0 (default) means no restriction.      */     long timeout() default 0; } 

and method annoted :

@override     @soit("^ok$")     public void ok() {         this.driver.ok();     } 


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -