If I create a Converter plugin with ConverterKeys of "d" or "m" then there will be a collision with the built-in DatePatternConverter or MessagePatternConverter.
It is unpredictable which plugin gets used.
I see two resolutions:
(1) detect collisions in PatternParser and emit a warning so we know which implementation will be used
(2) use whichever Log4j2Plugins.dat appeared first in the CLASSPATH
Predictable iteration order is usually accomplished by replacing HashMaps with LinkedHashMaps. Could easily do this for thie PluginManager.plugins field. But PluginRegistry uses a ConcurrentHashMap.
Is there a good reason to use ConcurrentHashMaps in PluginRegistry? It doesn't really give you any concurrency – a caller to PluginManager.getPlugins could see a partially-loaded map if collectPlugins was still running. Why not synchronize collectPlugins and/or loadPlugins, and force any concurrent caller to getPlugins to wait until the loading was complete.