Building a plugin architecture

I’ve been trying to build a robust architecture for plugins for a while. I’m having a lot of trouble trying to come up with a robust way to register plugins that doesn’t depend of reflection (since I’d like my plugin modules to work after being obfuscated).

The best way to do this that I’ve found so far is to:

  • Create a common interface that all my plugins will extend
  • Use the new java apt tool to automatically compile an index of all the modules I want to use as plugins
  • Assign each plugin a static String to use as an ID. This is so that the plugin can be uniquely identified should I ever need to write plugin specific information to a saved file.

While the above works, it is complex and a little clumsy. Is there a better way to design robust plugins that work under obfuscation?

Mark McKay

does obfuscation prevent you from writing your own loader? or is that reflection?

if neither, that’s how my plugin system works.