logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Sicker <boa...@gmail.com>
Subject Undeprecating MessageSupplier
Date Fri, 24 Feb 2017 18:07:08 GMT
In log4j-api, the interface MessageSupplier has been deprecated ever since
we realized that we didn't need it and could just use Supplier<Message> for
lambda support. However, now that I've actually tried to use this in my own
Java 8 project, I noticed that by default, the following will call the
deprecated method:

logger.info(() -> new MapMessage(convertForLogging(fields)));

However, if I cast it, it'll call the non-deprecated form:

logger.info((Supplier<Message>) () -> new

This isn't ideal. I propose we simply undeprecate MessageSupplier as it's
the more specific form that javac will use by default anyways. We should
note that it won't be available in a hypothetical 3.0 API, but I'd imagine
that hypothetical API would just use Java 8's Supplier functional interface
instead as well.

Matt Sicker <boards@gmail.com>

View raw message