﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
20456	[Patch] Classloader problem with loading look and feel from plugin (FlatLaf)	DevCharly	team	"There is a problem with classloaders and look and feel plugins.
JOSM uses two different classloaders for same laf plugin:

* PluginClassLoader to load laf plugin
* DynamicURLClassLoader for laf initialization 

Both classloaders include the laf plugin jar (`flatlaf.jar` in my case).
So it seems to work, but FlatLaf can not find the properties files in the plugin and JOSM specific colors and UI delegates are missing.

The necessary information to load plugin properties files is stored in a static variable in class `FlatLaf`.
Because class `FlatLaf` is loaded into two classloaders, there are **two** instances of the static variable.

The static variable is set in `FlatLafPlugin` constructor by invoking `FlatLaf.registerCustomDefaultsSource()`.
This is done with a `PluginClassLoader`.

Later when the laf is initialized with `UIManager.setLookAndFeel()`, this static variable is `null` because this is done in `DynamicURLClassLoader`.

Tried to workaround this without success.

The reason for the different classloaders is that `PluginHandler.getResourceClassLoaders()` is used in `MainApplication.setupUIManager()` to find/load the laf class from a plugin.

See:
https://josm.openstreetmap.de/browser/josm/trunk/src/org/openstreetmap/josm/gui/MainApplication.java#L1075

IMO `PluginHandler.getPluginClassLoaders()` should be used instead.
This fixes the issue.
Can we change this?"	defect	closed	normal	21.02	Core		fixed		
