This is an automated email from the ASF dual-hosted git repository. gnodet pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
commit f5891d942b4485d71a9e7a267b2dcef70d16035b Author: Guillaume Nodet <gno...@gmail.com> AuthorDate: Fri Apr 26 13:38:01 2024 +0200 Remove unused params --- .../impl/engine/CamelPostProcessorHelper.java | 4 ++-- .../impl/engine/DefaultCamelBeanPostProcessor.java | 12 +++++----- .../impl/engine/CamelPostProcessorHelperTest.java | 28 +++++++++------------- .../injection/AnnotationDependencyInjection.java | 6 ++--- 4 files changed, 21 insertions(+), 29 deletions(-) diff --git a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/CamelPostProcessorHelper.java b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/CamelPostProcessorHelper.java index 30b2d3a353e..f77caac62f4 100644 --- a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/CamelPostProcessorHelper.java +++ b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/CamelPostProcessorHelper.java @@ -546,8 +546,8 @@ public class CamelPostProcessorHelper implements CamelContextAware { if (ann.annotationType() == PropertyInject.class) { PropertyInject pi = (PropertyInject) ann; Object result - = getInjectionPropertyValue(type, genericType, pi.value(), pi.defaultValue(), pi.separator(), - null, null, null); + = getInjectionPropertyValue(type, genericType, pi.value(), pi.defaultValue(), pi.separator() + ); parameters[i] = result; } else if (ann.annotationType() == BeanConfigInject.class) { BeanConfigInject pi = (BeanConfigInject) ann; diff --git a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultCamelBeanPostProcessor.java b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultCamelBeanPostProcessor.java index 45d6e1e1011..dfd82d1e7b2 100644 --- a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultCamelBeanPostProcessor.java +++ b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultCamelBeanPostProcessor.java @@ -270,7 +270,7 @@ public class DefaultCamelBeanPostProcessor implements CamelBeanPostProcessor, Ca PropertyInject propertyInject = field.getAnnotation(PropertyInject.class); if (propertyInject != null) { injectFieldProperty(field, propertyInject.value(), propertyInject.defaultValue(), propertyInject.separator(), - bean, beanName); + bean); } BeanInject beanInject = field.getAnnotation(BeanInject.class); @@ -329,11 +329,11 @@ public class DefaultCamelBeanPostProcessor implements CamelBeanPostProcessor, Ca public void injectFieldProperty( Field field, String propertyName, String propertyDefaultValue, String propertySeparator, - Object bean, String beanName) { + Object bean) { ReflectionHelper.setField(field, bean, getPostProcessorHelper().getInjectionPropertyValue(field.getType(), field.getGenericType(), propertyName, propertyDefaultValue, - propertySeparator, field.getName(), bean, beanName)); + propertySeparator)); } protected void injectMethods(final Object bean, final String beanName, Function<Class<?>, Boolean> accept) { @@ -429,7 +429,7 @@ public class DefaultCamelBeanPostProcessor implements CamelBeanPostProcessor, Ca PropertyInject propertyInject = method.getAnnotation(PropertyInject.class); if (propertyInject != null) { setterPropertyInjection(method, propertyInject.value(), propertyInject.defaultValue(), propertyInject.separator(), - bean, beanName); + bean); } BeanInject beanInject = method.getAnnotation(BeanInject.class); @@ -467,7 +467,7 @@ public class DefaultCamelBeanPostProcessor implements CamelBeanPostProcessor, Ca public void setterPropertyInjection( Method method, String propertyValue, String propertyDefaultValue, String propertySeparator, - Object bean, String beanName) { + Object bean) { Class<?>[] parameterTypes = method.getParameterTypes(); if (parameterTypes.length != 1) { LOG.warn("Ignoring badly annotated method for injection due to incorrect number of parameters: {}", method); @@ -476,7 +476,7 @@ public class DefaultCamelBeanPostProcessor implements CamelBeanPostProcessor, Ca Class<?> type = parameterTypes[0]; Type genericType = method.getGenericParameterTypes()[0]; Object value = getPostProcessorHelper().getInjectionPropertyValue(type, genericType, propertyValue, - propertyDefaultValue, propertySeparator, propertyName, bean, beanName); + propertyDefaultValue, propertySeparator); invokeMethod(method, bean, value); } } diff --git a/core/camel-core/src/test/java/org/apache/camel/impl/engine/CamelPostProcessorHelperTest.java b/core/camel-core/src/test/java/org/apache/camel/impl/engine/CamelPostProcessorHelperTest.java index cd0720b3b2f..482f9da3ee1 100644 --- a/core/camel-core/src/test/java/org/apache/camel/impl/engine/CamelPostProcessorHelperTest.java +++ b/core/camel-core/src/test/java/org/apache/camel/impl/engine/CamelPostProcessorHelperTest.java @@ -378,13 +378,13 @@ public class CamelPostProcessorHelperTest extends ContextTestSupport { Field field = bean.getClass().getField("timeout"); PropertyInject propertyInject = field.getAnnotation(PropertyInject.class); Class<?> type = field.getType(); - Object value = helper.getInjectionPropertyValue(type, null, propertyInject.value(), "", "", "timeout", bean, "foo"); + Object value = helper.getInjectionPropertyValue(type, null, propertyInject.value(), "", ""); assertEquals(Integer.valueOf(2000), (Object) Integer.valueOf(String.valueOf(value))); field = bean.getClass().getField("greeting"); propertyInject = field.getAnnotation(PropertyInject.class); type = field.getType(); - value = helper.getInjectionPropertyValue(type, null, propertyInject.value(), "", "", "greeting", bean, "foo"); + value = helper.getInjectionPropertyValue(type, null, propertyInject.value(), "", ""); assertEquals("Hello Camel", value); } @@ -399,13 +399,13 @@ public class CamelPostProcessorHelperTest extends ContextTestSupport { Field field = bean.getClass().getField("timeout"); PropertyInject propertyInject = field.getAnnotation(PropertyInject.class); Class<?> type = field.getType(); - Object value = helper.getInjectionPropertyValue(type, null, propertyInject.value(), "5000", "", "timeout", bean, "foo"); + Object value = helper.getInjectionPropertyValue(type, null, propertyInject.value(), "5000", ""); assertEquals(Integer.valueOf(5000), (Object) Integer.valueOf(String.valueOf(value))); field = bean.getClass().getField("greeting"); propertyInject = field.getAnnotation(PropertyInject.class); type = field.getType(); - value = helper.getInjectionPropertyValue(type, null, propertyInject.value(), "", "", "greeting", bean, "foo"); + value = helper.getInjectionPropertyValue(type, null, propertyInject.value(), "", ""); assertEquals("Hello Camel", value); } @@ -422,8 +422,7 @@ public class CamelPostProcessorHelperTest extends ContextTestSupport { PropertyInject propertyInject = field.getAnnotation(PropertyInject.class); Class<?> type = field.getType(); Object value - = helper.getInjectionPropertyValue(type, null, propertyInject.value(), "", propertyInject.separator(), "ports", - bean, "foo"); + = helper.getInjectionPropertyValue(type, null, propertyInject.value(), "", propertyInject.separator()); assertIsInstanceOf(int[].class, value); int[] arr = (int[]) value; assertEquals(2, arr.length); @@ -433,9 +432,7 @@ public class CamelPostProcessorHelperTest extends ContextTestSupport { field = bean.getClass().getField("hosts"); propertyInject = field.getAnnotation(PropertyInject.class); type = field.getType(); - value = helper.getInjectionPropertyValue(type, null, propertyInject.value(), "", propertyInject.separator(), "hosts", - bean, - "foo"); + value = helper.getInjectionPropertyValue(type, null, propertyInject.value(), "", propertyInject.separator()); assertIsInstanceOf(String[].class, value); String[] arr2 = (String[]) value; assertEquals(2, arr2.length); @@ -456,8 +453,7 @@ public class CamelPostProcessorHelperTest extends ContextTestSupport { PropertyInject propertyInject = field.getAnnotation(PropertyInject.class); Class<?> type = field.getType(); Object value = helper.getInjectionPropertyValue(type, field.getGenericType(), - propertyInject.value(), "", propertyInject.separator(), "ports", - bean, "foo"); + propertyInject.value(), "", propertyInject.separator()); assertIsInstanceOf(List.class, value); List arr = (List) value; assertEquals(2, arr.size()); @@ -468,8 +464,7 @@ public class CamelPostProcessorHelperTest extends ContextTestSupport { propertyInject = field.getAnnotation(PropertyInject.class); type = field.getType(); value = helper.getInjectionPropertyValue(type, field.getGenericType(), - propertyInject.value(), "", propertyInject.separator(), "hosts", bean, - "foo"); + propertyInject.value(), "", propertyInject.separator()); assertIsInstanceOf(Set.class, value); Set arr2 = (Set) value; assertEquals(2, arr.size()); @@ -490,8 +485,7 @@ public class CamelPostProcessorHelperTest extends ContextTestSupport { PropertyInject propertyInject = field.getAnnotation(PropertyInject.class); Class<?> type = field.getType(); Object value = helper.getInjectionPropertyValue(type, field.getGenericType(), - propertyInject.value(), "", propertyInject.separator(), "servers", - bean, "foo"); + propertyInject.value(), "", propertyInject.separator()); assertIsInstanceOf(Map.class, value); Map arr = (Map) value; assertEquals(2, arr.size()); @@ -511,13 +505,13 @@ public class CamelPostProcessorHelperTest extends ContextTestSupport { Method method = bean.getClass().getMethod("setTimeout", int.class); PropertyInject propertyInject = method.getAnnotation(PropertyInject.class); Class<?> type = method.getParameterTypes()[0]; - Object value = helper.getInjectionPropertyValue(type, null, propertyInject.value(), "", "", "timeout", bean, "foo"); + Object value = helper.getInjectionPropertyValue(type, null, propertyInject.value(), "", ""); assertEquals(Integer.valueOf(2000), (Object) Integer.valueOf(String.valueOf(value))); method = bean.getClass().getMethod("setGreeting", String.class); propertyInject = method.getAnnotation(PropertyInject.class); type = method.getParameterTypes()[0]; - value = helper.getInjectionPropertyValue(type, null, propertyInject.value(), "", "", "greeting", bean, "foo"); + value = helper.getInjectionPropertyValue(type, null, propertyInject.value(), "", ""); assertEquals("Hello Camel", value); } diff --git a/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/injection/AnnotationDependencyInjection.java b/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/injection/AnnotationDependencyInjection.java index 6229d612068..1d9ef7ace70 100644 --- a/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/injection/AnnotationDependencyInjection.java +++ b/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/injection/AnnotationDependencyInjection.java @@ -222,8 +222,7 @@ public final class AnnotationDependencyInjection { Value value = field.getAnnotation(Value.class); if (value != null) { ReflectionHelper.setField(field, bean, - helper.getInjectionPropertyValue(field.getType(), field.getGenericType(), value.value(), null, null, - null, bean, beanName)); + helper.getInjectionPropertyValue(field.getType(), field.getGenericType(), value.value(), null, null)); } } @@ -294,8 +293,7 @@ public final class AnnotationDependencyInjection { df = null; } ReflectionHelper.setField(field, bean, - helper.getInjectionPropertyValue(field.getType(), field.getGenericType(), cp.name(), df, null, null, - bean, beanName)); + helper.getInjectionPropertyValue(field.getType(), field.getGenericType(), cp.name(), df, null)); } }