Search code examples
javajavascriptgwtreflectionlibgdx

Accessing GWT reflected classes cache in LibGDX application


Is there a way to access the whole cache of GWT-reflected classes? I have checked ReflectionCache and IReflectionCache in GWT LibGDX back-end classes, but they do not seem to have direct access to the classes' collection. Basically, I want to do something similar to a component scan (finding all classes with specific annotations, without actually registering them anyway before) and I'm having trouble accessing all (reflected) classes used by the application.


Solution

  • Classes are stored in static fields (c0, c1, ..., cN) in the generated class and there are no direct getter methods, so accessing them (even with JSNI) is rather problematic. I think that writing a custom class generator that scans types similarly to LibGDX scanner and contains an array of all reflected classes is the simplest way to go.