Description
Log4j 2.24
Not technically a bug??? But not a feature-request either...just pointing it out...if no interest in changing this from L4J team go ahead and close it
The appender Builders (ConsoleAppender.Builder, FileAppender.Builder, etc) have been generically defiined.
For example:
/**
* Builds ConsoleAppender instances.
* @param <B> The type to build
*/
public static class Builder<B extends Builder<B>>
extends AbstractOutputStreamAppender.Builder<B>
implements org.apache.logging.log4j.core.util.Builder<ConsoleAppender> {
...
}
This means when not chaining you need to handle the generics:
ConsoleAppender.Builder<?> builder = ConsoleAppender.newBuilder();
This is OK for the abstract Builders that are inherited, but a wee bit non-standard for concrete builder implementations.
Since the appender classes are final one might assume its builders can also be final and don't need the generics on the class itself.
I think it could be simplified::
For example ConsoleAppender:
public static final class Builder
extends AbstractOutputStreamAppender.Builder<Builder>
implements org.apache.logging.log4j.core.util.Builder<ConsoleAppender>
ConsoleAppender.Builder builder = ConsoleAppender.newBuilder();
From a coding perspective a trivial change but more of a binary compatibility problem.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status