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
MapMessage(convertForLogging(fields)));

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 <boa...@gmail.com>

Reply via email to