The org.reflections library does not function correctly when it's used inside an Eclipse Plugin project.
For instance, the following code should return all classes of a given subtype in a given package:
Reflections reflections = new Reflections("my.package");
Set<Class<? extends Subtype>> classes = reflections.getSubTypesOf(Subtype.class);
When running the project as a Plugin, classes
will be empty. Inserting a main() and running it as a normal Java application will correctly return the expected classes.
I've tried to:
Include the Reflections library as a normal third-party jar dependency
Include the Reflections library as an OSGi bundle (http://stackoverflow.com/questions/8339845/reflections-library-not-working-when-used-in-an-eclipse-plug-in)
Edit: current process (based on stackoverflow answer above):
1) New Plugin-Project (OSGIReflections called) based on external JARs (Reflections and Javassist)
2) In my actual Plugin-project (X) I add a dependency on OSGIReflections in Dependencies -> Required Plug-ins
2.a) If I run the project as normal java app: Reflections is working
2.b) If I run the project as plugin project: Reflections is not working
3) Create the BundleUrlType class
4) How do I activate this BundleUrlType? In my plugin Activator I call the createReflections(context.getBundle()) function but I do not have a .data file. How do I generate that?