You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "ASF subversion and git services (JIRA)" <ji...@apache.org> on 2017/02/25 05:46:44 UTC
[jira] [Commented] (LOG4J2-1823) Remove deprecation on
MessageSupplier lambda functions in Logger API
[ https://issues.apache.org/jira/browse/LOG4J2-1823?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15884050#comment-15884050 ]
ASF subversion and git services commented on LOG4J2-1823:
---------------------------------------------------------
Commit 180e7e134aa165d5a43ae6ab04501021907b3bb4 in logging-log4j2's branch refs/heads/master from [~jvz]
[ https://git-wip-us.apache.org/repos/asf?p=logging-log4j2.git;h=180e7e1 ]
[LOG4J2-1823]: Remove deprecation on MessageSupplier lambda functions in Logger API
> Remove deprecation on MessageSupplier lambda functions in Logger API
> --------------------------------------------------------------------
>
> Key: LOG4J2-1823
> URL: https://issues.apache.org/jira/browse/LOG4J2-1823
> Project: Log4j 2
> Issue Type: Improvement
> Components: API
> Affects Versions: 2.6
> Reporter: Matt Sicker
> Assignee: Matt Sicker
> Fix For: 2.8.1
>
>
> The changes done in LOG4J2-1286 to deprecate MessageSupplier were not properly tested in practice. Using log4j-api ever since the deprecation, the following code causes deprecation warnings:
> {code}
> logger.info(() -> new SimpleMessage("Hello, world!"));
> {code}
> This is because the compiler interprets this as a {{MessageSupplier}} instead of the more generic {{Supplier<Message>}} version which is the intended API. Although manual use of {{MessageSupplier}} should be discouraged, users should not have to manually cast the above lambda just to prevent a deprecation warning:
> {code}
> logger.info((Supplier<Message>) () -> new SimpleMessage("Hello, world!"));
> {code}
> {{MessageSupplier}} should become a normal part of log4j-api with a note on both it and {{Supplier<T>}} that these interfaces would be removed in a log4j-api 3.0 release and replaced with the Java 8 version.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org