Does your DS component bundle import the package that contains the DataProvider annotation type? And does the bundle doing the introspection in Groovy code also import that package, from the same provider?
If these don’t match up then I would expect the getAnnotation() method to return null. Classloading for annotations is a little different than for normal classes — when something goes wrong, the JRE does not raise an exception but instead simply throws away the annotation metadata. Regards, Neil > On 10 Mar 2015, at 19:16, Artem Zhirkov <[email protected]> wrote: > > Hello, > > I'm trying to annotate some methods in my DS class and then get these > annotations from the host application. Unfortunately, when I calling > getAnnotation() from the host it always returns null. > > My annotation looks like this: > @Retention(RetentionPolicy.RUNTIME) > public @interface DataProvider { > String optionType(); > String optionTemplate(); > } > > and the code which looks for DataProvider is (dont mind groovy syntax): > for (Method method : module.class.methods){ > println("method name: " + method.name) > > println("has DataProvider annotation: " + > method.getAnnotation(DataProvider.class) ) > > } > would always print null for every method in my DS, including annotated ones. > > Any ideas what I'm doing wrong? > > Thank you > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

