jvz commented on issue #3870:
URL: 
https://github.com/apache/logging-log4j2/issues/3870#issuecomment-3156381124

   This particular issue is blocked at the moment due to how `Key` makes use of 
`Keys` for getting the name of things when constructing a key based on some 
annotated element. Fixing up how `Key` works overlaps a bit with 
https://github.com/apache/logging-log4j2/issues/1967. This is going to touch a 
lot of `log4j-plugins` files to remove unnecessary generics and casting.
   
   If `Key` is refactored into a `record` class, then the `Key<T> KEY = new 
Key<>() {};` pattern of creating typed keys will no longer be valid. It might 
work better to emulate the `ResolvableType` API in Spring here in that we don't 
want to rely on reflection on generic parameters to find type info when we can 
just be a little more explicit about it. For a more concrete example:
   
   ```java
   public static final Key<PluginNamespace> PLUGIN_NAMESPACE_KEY =
     new @Namespace(NAMESPACE) Key<>() {};
   ```
   
   This could be made more explicit to avoid reflection here, and assuming the 
type parameter is removed, the declaration would look like this (using the 
existing `Key.Builder` DSL):
   
   ```java
   public static final Key PLUGIN_NAMESPACE_KEY =
     Key.builder(PluginNamespace.class).setNamespace(NAMESPACE).get();
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to