This is to be able to implement a JRebel plugin, where each class is reloaded.
From experiments, I've discovered that using Eclipse IDE with the DN enhancer plugin actually causes JRebel to reload the class twice:
- the first time, JRebel picks up the unenhanced class. At this point we want to remove the class' metadata from the MetaDataManager
- the second time (called a few milliseconds later), JRebel picks up the enhanced class (after the DN plugin has done the enhancement process). This is a no-op for the JRebel plugin; DN can simply lazily recreate the metadata when the class is next used.
The above hopefully is sufficient to implement the plugin. (There are other more exotic designs whereby we could look to support do the enhancement itself within the JRebel plugin, but they shouldn't require any further DN changes).