[slf4j-user] Re: Re: Varargs for Logger methods

Ceki Gülcü listid at qos.ch
Thu Feb 16 15:42:24 CET 2006


At 03:10 PM 2/16/2006, Kostis Anagnostopoulos wrote:
>But i thought it was obvious that the method:
>
>     void log(String msg, Object[] argArray);
>
>will replace the old method:
>
>     void log(String msg, Object ... args);
>
>Since java specs guarantee that older client code (the one that using 
>Object[])
>will always work with varags,  the method:
>     void log(String msg, Object[] argArray);
>is no longer needed!

Oh, OK. I was thinking of replacing

public interface Logger {

  void debug(String msg);
  void debug(String msg, Object o);
  void debug(String msg, Object o1, Object o2);
  void debug(String msg, Object[] oArray);
  ....
}

by the more economical

public interface Logger {
  void debug(String msg, Object ... args);
  ....
}

But the above is not what you had in mind.

It looks like replacing a single method, that is debug(String, Object[]) by 
debug(String, Object...), would be quite feasible, especially since it 
seems to preserve both compile time and run time compatibility. Existing 
clients would compile fine against a modified version of SLF4J. Just as 
importantly, client classes compiled against an older version of SLF4J 
would run fine with modified versions of SLF4J (assuming JDK 1.5).

In a few years time when JDK 1.5 gains wider deployment share, we can 
revisit the issue.

>     ankostis

-- 
Ceki Gülcü




More information about the slf4j-user mailing list