You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by ma...@apache.org on 2024/01/02 05:07:27 UTC

(logging-log4j2) 01/02: Revert change in type checks

This is an automated email from the ASF dual-hosted git repository.

mattsicker pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git

commit 229218fb127f95d4b98dde48122a551dc4ac2332
Author: Matt Sicker <ma...@apache.org>
AuthorDate: Mon Jan 1 22:45:21 2024 -0600

    Revert change in type checks
    
    Signed-off-by: Matt Sicker <ma...@apache.org>
---
 .../org/apache/logging/log4j/test/junit/TestPropertyResolver.java | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/log4j-api-test/src/main/java/org/apache/logging/log4j/test/junit/TestPropertyResolver.java b/log4j-api-test/src/main/java/org/apache/logging/log4j/test/junit/TestPropertyResolver.java
index 4af5001566..7957331d49 100644
--- a/log4j-api-test/src/main/java/org/apache/logging/log4j/test/junit/TestPropertyResolver.java
+++ b/log4j-api-test/src/main/java/org/apache/logging/log4j/test/junit/TestPropertyResolver.java
@@ -39,11 +39,9 @@ public class TestPropertyResolver extends TypeBasedParameterResolver<TestPropert
                 .forEach(setProperty -> props.setProperty(setProperty.key(), setProperty.value()));
         final Class<?> testClass = context.getRequiredTestClass();
         final Object testInstance = context.getRequiredTestInstance();
-        final Class<? extends TestProperties> testPropertiesType = props.getClass();
         ReflectionSupport.findFields(
                         testClass,
-                        field -> ModifierSupport.isNotStatic(field)
-                                && field.getType().isAssignableFrom(testPropertiesType),
+                        field -> ModifierSupport.isNotStatic(field) && TestProperties.class.equals(field.getType()),
                         HierarchyTraversalMode.BOTTOM_UP)
                 .forEach(field -> ReflectionUtil.setFieldValue(field, testInstance, props));
     }
@@ -54,11 +52,9 @@ public class TestPropertyResolver extends TypeBasedParameterResolver<TestPropert
         AnnotationSupport.findRepeatableAnnotations(context.getRequiredTestClass(), SetTestProperty.class)
                 .forEach(setProperty -> props.setProperty(setProperty.key(), setProperty.value()));
         final Class<?> testClass = context.getRequiredTestClass();
-        final Class<? extends TestProperties> testPropertiesType = props.getClass();
         ReflectionSupport.findFields(
                         testClass,
-                        field -> ModifierSupport.isStatic(field)
-                                && field.getType().isAssignableFrom(testPropertiesType),
+                        field -> ModifierSupport.isStatic(field) && TestProperties.class.equals(field.getType()),
                         HierarchyTraversalMode.BOTTOM_UP)
                 .forEach(field -> ReflectionUtil.setStaticFieldValue(field, props));
     }