atteo / classindex

Index classes, do not scan them!
Apache License 2.0
263 stars 42 forks source link

ClassIndex.getAnnotated(MyAnnotation.class) returns no results #66

Closed TobiasDeBruijn closed 3 years ago

TobiasDeBruijn commented 3 years ago

Hi,

ClassIndex.getAnnotated(PluginCommandExecutor.class) returns no results for me:

@Documented
@IndexAnnotated
public @interface PluginCommandExecutor {}

I've double checked that the final jar contains META-INF/annotations/*, and that it contains nl.thedutchmc.multiplayerevents.annotations.PluginCommandExecutor, which it does.

Though when calling the in the title mentioned method no results are returned. If it matters any, this is a Minecraft Spigot plugin, which uses it's own classloader.

sentinelt commented 3 years ago

@TheDutchMC try specifying classloader, by using ClassIndex.getAnnotated(Class<? extends Annotation> annotation, ClassLoader classLoader). By default context classloader of the current thread is used.

TobiasDeBruijn commented 3 years ago

Yep that seems to do it, thanks!