- KPluginLoader::forEachPlugin is very rarely used. When it is used it displays debug information, like that a plugin got considered for loading and warns if the MetaData is invalid. This warning can not be emitted in findPlugins filter callback, because an early return is made in that case.
My suggestion would be to print out a debug message in KPluginLoader::findPlugins if the MetaData is invalid and marking this method as internal.
- KPluginLoader::instantiatePlugins is very rarely used. It is supposed to be a utility method, but it lacks debug output and requires a manual qobject_cast after calling the method.
The usage (and comment) of this method in knotificationmanager.cpp does not make sense to me, because KPluginLoader::findPlugins is used internally in KPluginLoader::instantiatePlugins. In dolphin I could not found any providers for the KOverlayIconPlugin. in ksystemstats unsing the KPluginFactory directly would be simpler anyways.
My suggestion would be to clean up/port those usages and deprecate the method.