You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by pk...@apache.org on 2024/12/29 10:01:35 UTC
(logging-log4j2) branch fix/2.x/stacklocator-incompatibility created (now f9e4eea76b)
This is an automated email from the ASF dual-hosted git repository.
pkarwasz pushed a change to branch fix/2.x/stacklocator-incompatibility
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git
at f9e4eea76b Uniformize API of `StackLocator` versions
This branch includes the following new commits:
new f9e4eea76b Uniformize API of `StackLocator` versions
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(logging-log4j2) 01/01: Uniformize API of `StackLocator` versions
Posted by pk...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
pkarwasz pushed a commit to branch fix/2.x/stacklocator-incompatibility
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git
commit f9e4eea76b1d77ab9c3f78cf87cf2aaa3e66fbc9
Author: Piotr P. Karwasz <pi...@karwasz.org>
AuthorDate: Sun Dec 29 11:01:24 2024 +0100
Uniformize API of `StackLocator` versions
The Java 9 version of `StackLocator` has an additional public `getCallerClass(String)` method. This method makes the Java 8 and 9 versions of `StackLocator` expose different APIs to the user. To prevent API compatibility problems, we remove the additional method.
This incompatibility was accidentally discovered during the work in #3339: `japicmp` did randomly compare a `StackLocator` class from the old version with a `StackLocator` class from the new version.
This is part of #1867.
---
.../src/main/java/org/apache/logging/log4j/util/StackLocator.java | 4 ----
.../java/org/apache/logging/log4j/util/java9/StackLocatorTest.java | 2 +-
2 files changed, 1 insertion(+), 5 deletions(-)
diff --git a/log4j-api-java9/src/main/java/org/apache/logging/log4j/util/StackLocator.java b/log4j-api-java9/src/main/java/org/apache/logging/log4j/util/StackLocator.java
index f8915071da..e928777ed6 100644
--- a/log4j-api-java9/src/main/java/org/apache/logging/log4j/util/StackLocator.java
+++ b/log4j-api-java9/src/main/java/org/apache/logging/log4j/util/StackLocator.java
@@ -53,10 +53,6 @@ public final class StackLocator {
.orElse(null));
}
- public Class<?> getCallerClass(final String fqcn) {
- return getCallerClass(fqcn, "");
- }
-
public Class<?> getCallerClass(final String fqcn, final String pkg) {
return WALKER.walk(s -> s.dropWhile(f -> !f.getClassName().equals(fqcn))
.dropWhile(f -> f.getClassName().equals(fqcn))
diff --git a/log4j-api-java9/src/test/java/org/apache/logging/log4j/util/java9/StackLocatorTest.java b/log4j-api-java9/src/test/java/org/apache/logging/log4j/util/java9/StackLocatorTest.java
index 2ccebbde0f..cc8f61218a 100644
--- a/log4j-api-java9/src/test/java/org/apache/logging/log4j/util/java9/StackLocatorTest.java
+++ b/log4j-api-java9/src/test/java/org/apache/logging/log4j/util/java9/StackLocatorTest.java
@@ -73,7 +73,7 @@ class StackLocatorTest {
private static void assertCallerClassViaName() {
final Class<?> expected = StackLocatorTest.class;
final StackLocator stackLocator = StackLocator.getInstance();
- final Class<?> actual = stackLocator.getCallerClass(Inner.class.getName());
+ final Class<?> actual = stackLocator.getCallerClass(Inner.class.getName(), "");
assertSame(expected, actual);
}