Note that there are some explanatory texts on larger screens.

plurals
  1. POReflections library not working when used in an Eclipse plug-in
    primarykey
    data
    text
    <p>I have developed an application using the <a href="http://code.google.com/p/reflections/" rel="noreferrer">Reflections</a> library for querying all the classes having a particular annotation. Everything was working like a charm until I decided to create an Eclipse plug-in from my application. Then Reflections stop working.</p> <p>Given that my application is working fine when not part of an Eclipse plug-in, I think it should be a class-loader problem. So I added to my <code>Reflections</code> class the classloaders of the plug-in activator class, the context class loader, and all other class loaders I could imagine, without any success. This is a simplified version of my code:</p> <pre><code>ConfigurationBuilder config = new ConfigurationBuilder(); config.addClassLoaders(thePluginActivatorClassLoader); config.addClassLoaders(ClasspathHelper.getContextClassLoader()); config.addClassLoaders("all the classloaders I could imagine"); config.filterInputsBy(new FilterBuilder().include("package I want to analyze")); Reflections reflections = new Reflections(config); Set&lt;Class&lt;?&gt;&gt; classes = reflections.getTypesAnnotatedWith(MyAnnotation.class); //this Set is empty </code></pre> <p>I also tried adding URLs of the classes I want to load to the <code>ConfigurationBuilder</code> class, but it did not help.</p> <p>Could someone tell me if there is a way to make <code>Reflections</code> work as part of an Eclipse plug-in ?, or should I better look for another alternative ?. Thanks a lot, I am really puzzled about it.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload