Making sure all transitive dependencies exclude older versions of slf4j is
also a fun issue here. Would this be slf4j-api 1.8.0 at least?

On 24 December 2016 at 10:50, Apache <ralph.go...@dslextreme.com> wrote:

> The only downside is that anyone who has an implementation of SLF4J will
> have to add the new methods in order to upgrade.
>
> Log4j 2 has supported lambdas for quite a while doing exactly what you are
> proposing here. Obviously the SLF4J Supplier and the Log4j 2 Supplier won’t
> know anything about each other so the Log4j 2 SLF4J binding will have to
> wrap the SLF4J Supplier with an instance of a Log4j 2 Supplier. Although
> this adds slight overhead I don’t see that as a big deal. The only real
> impact I see is that there will probably be a fair number of new methods
> added that we will have to implement.
>
> Of course this will mean that anyone using SLF4J lambdas will be required
> to upgrade Log4j2 (and Logback for that matter) to at least the earliest
> version that supports it.
>
> Ralph
>
> > On Dec 22, 2016, at 7:52 AM, Ceki Gülcü <c...@qos.ch> wrote:
> >
> > Hello all,
> >
> > Given that JDK 7 earlier are used by over 50% of Java projects, I do not
> think we can force users to upgrade to Java 8. Thus, SLF4J is unlikely to
> bump its JDK requirement to version 8 for yet some time.
> >
> > On the bright side, there is a way for org.slf4j.Logger to support Java8
> lambdas, or just lambdas, without requiring Java 8. As stated in [1], the
> compiler will treat any interface meeting the definition of a functional
> interface as a functional interface regardless of whether or not a
> @FunctionalInterface annotation is present on the interface declaration.
> >
> > This means that we can create a Supplier interface such as
> >
> > public interface Supplier<T> {
> >    T get();
> > }
> >
> > and then add the following method to org.slf4j.Logger interface.
> >
> > package org.slf4j;
> >
> > public interface Logger {
> >  ....
> >  public void debug(Supplier<T> supplier);
> >  ....
> > }
> >
> > This will add lambda support without requiring Java 8 support at build
> time.
> >
> > The downside of this approach is that implementations of the
> org.slf4j.Logger interface as found in logback and modules such as
> slf4j-simple, slf4j-log412, slf4j-jdk14 will need to be updated. Given that
> the number of such implementations is limited, I think the requirement is
> quite acceptable.
> >
> > Your comments are welcome,
> >
> > --
> > Ceki Gülcü
> >
> >
> > [1] https://docs.oracle.com/javase/8/docs/api/java/lang/
> FunctionalInterface.html
> > _______________________________________________
> > slf4j-dev mailing list
> > slf4j-...@qos.ch
> > http://mailman.qos.ch/mailman/listinfo/slf4j-dev
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org
> For additional commands, e-mail: log4j-dev-h...@logging.apache.org
>
>


-- 
Matt Sicker <boa...@gmail.com>

Reply via email to