-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
The Log4j annotation processor should be enhanced to generate and store metadata related to the dependencies of plugins. This should help with implementing #3055 as dependency information needs to be scanned for reflection reachability purposes anyways.
This metadata should be sufficient for performing dependency injection on those classes without runtime discovery. While the initial implementation will rely on reflection to create and configure plugin instances, this will not require scanning over code reflectively to find members based on programmatic considerations and can rely on the previously created index. This index should replicate the dependency injection rules defined by InstanceFactory
. Such an index would make it possible to add better checking of Log4j plugins for correctness at build time and when parsing a configuration.
For example, if plugin P
has a required attribute A
and a dependency of type D
, then the metadata for P
should note its injection points, and it should also have metadata (or generated code) to specify how to bind to injection points. For reflection purposes, this would indicate which IPs are fields, which IPs are part of an injectable constructor, and which IPs are part of methods. Whatever approach is used here should remain flexible so that a code generation approach can be used as an alternative to the reflective approach in a later feature.