private void unloadIncompatiblePlugins ( ) { // loop as long as the previous loop ignored some plugins. That allows to support dependencies // on many levels, for example D extends C, which extends B, which requires A. If A is not installed, // then B, C and D must be ignored. That's not possible to achieve this algorithm with a single // iteration over plugins. Set < String > removedKeys = new HashSet <> ( ) ; do { removedKeys . clear ( ) ; for ( PluginInfo plugin : pluginInfosByKeys . values ( ) ) { if ( ! isCompatible ( plugin , runtime , pluginInfosByKeys ) ) { removedKeys . add ( plugin . getKey ( ) ) ; } } for ( String removedKey : removedKeys ) { pluginInfosByKeys . remove ( removedKey ) ; } } while ( ! removedKeys . isEmpty ( ) ) ; }
Removes the plugins that are not compatible with current environment .