Warn against caching instances of plugin class

Description

See https://github.com/igniterealtime/openfire-monitoring-plugin/issues/155
This links eventually to https://github.com/guusdk/openfire-pushnotification-plugin/commit/48b408ca233f812c57ccf1316ce9441f521cc630

Caching custom instances has ClassLoader problems when reloading plugins in a cluster.

  • Raise a warning every time we see (the first?) instance of a class loaded by a PluginClassLoader being added to a cache.

  • Ideally, if there's a reflection or something we can go at boot time, that'd be better.

  • If there's something we can add as a deprecation, or a plugin compile-time warning, better still.

(Separate tickets required to fix this in our plugins)

Environment

None

Assignee

Guus der Kinderen

Reporter

Dan Caseley