Skip to content

Commit

Permalink
Properly make MessageFormatter and FormattingTuple public (#12763)
Browse files Browse the repository at this point in the history
Motivation:

_Taken from #12761_

Classes `io.netty.util.internal.logging.FormattingTuple` and `io.netty.util.internal.logging.MessageFormatter` are public classes, but the latters's format methods are package-private while the former's constructor is package-private making their use in custom in InternalLoggerFactory implementations impossible.

Modification:

Make necessary methods public

Result:

Fixes #12761.
  • Loading branch information
geoand committed Sep 2, 2022
1 parent 9f10a28 commit 5256f36
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public final class FormattingTuple {
private final String message;
private final Throwable throwable;

FormattingTuple(String message, Throwable throwable) {
public FormattingTuple(String message, Throwable throwable) {
this.message = message;
this.throwable = throwable;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public final class MessageFormatter {
* @param arg The argument to be substituted in place of the formatting anchor
* @return The formatted message
*/
static FormattingTuple format(String messagePattern, Object arg) {
public static FormattingTuple format(String messagePattern, Object arg) {
return arrayFormat(messagePattern, new Object[]{arg});
}

Expand All @@ -152,7 +152,7 @@ static FormattingTuple format(String messagePattern, Object arg) {
* anchor
* @return The formatted message
*/
static FormattingTuple format(final String messagePattern,
public static FormattingTuple format(final String messagePattern,
Object argA, Object argB) {
return arrayFormat(messagePattern, new Object[]{argA, argB});
}
Expand All @@ -167,7 +167,7 @@ static FormattingTuple format(final String messagePattern,
* anchors
* @return The formatted message
*/
static FormattingTuple arrayFormat(final String messagePattern,
public static FormattingTuple arrayFormat(final String messagePattern,
final Object[] argArray) {
if (argArray == null || argArray.length == 0) {
return new FormattingTuple(messagePattern, null);
Expand Down

0 comments on commit 5256f36

Please sign in to comment.