Repository: logging-log4j2 Updated Branches: refs/heads/master eec6ad270 -> a78720b08
Assume the call site knows what it is doing. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/a78720b0 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/a78720b0 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/a78720b0 Branch: refs/heads/master Commit: a78720b08cc68348b052f81e9332668b1a58be37 Parents: eec6ad2 Author: Gary Gregory <[email protected]> Authored: Sun Jul 15 18:28:16 2018 -0600 Committer: Gary Gregory <[email protected]> Committed: Sun Jul 15 18:28:16 2018 -0600 ---------------------------------------------------------------------- .../org/apache/logging/log4j/junit/LoggerContextRule.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a78720b0/log4j-core/src/test/java/org/apache/logging/log4j/junit/LoggerContextRule.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/junit/LoggerContextRule.java b/log4j-core/src/test/java/org/apache/logging/log4j/junit/LoggerContextRule.java index c0c0def..36cc883 100644 --- a/log4j-core/src/test/java/org/apache/logging/log4j/junit/LoggerContextRule.java +++ b/log4j-core/src/test/java/org/apache/logging/log4j/junit/LoggerContextRule.java @@ -145,9 +145,10 @@ public class LoggerContextRule implements TestRule, LoggerContextAccessor { * the name of the Appender to look up. * @return the named Appender or {@code null} if it wasn't defined in the configuration. */ - public Appender getAppender(final String name) { - return getConfiguration().getAppenders().get(name); - } + @SuppressWarnings("unchecked") // Assume the call site knows what it is doing. + public <T extends Appender> T getAppender(final String name) { + return (T) getConfiguration().getAppenders().get(name); + } /** * Gets a named Appender for this LoggerContext.
