Re: [PR] XBEAN-453 - honor Option.CASE_INSENSITIVE_PRO PERTIES for ctors [geronimo-xbean]
rmannibucau (via GitHub) <[email protected]>
| Newsgroups | gmane.comp.java.geronimo.devel |
|---|---|
| Message-ID | <PR_kwDOAAOrUs669nAv-1c86f622-27fa-4a9a-90d5-bf3db1dece25@gitbox.apache.org> |
rmannibucau commented on code in PR #47:
URL: https://github.com/apache/geronimo-xbean/pull/47#discussion_r2653513905
##########
xbean-reflect/src/main/java/org/apache/xbean/recipe/ReflectionUtil.java:
##########
@@ -656,7 +656,33 @@ public int compare(Constructor constructor1, Constructor constructor2) {
//
// Only consider methods where we can supply a value for all of the parameters
parameterNames = getParameterNames(constructor);
- if (parameterNames == null || !availableProperties.containsAll(parameterNames)) {
+ if (parameterNames == null) {
+ continue;
+ }
+
+ boolean parametersMatch;
+ if (options.contains(Option.CASE_INSENSITIVE_PROPERTIES)) {
Review Comment:
same
##########
xbean-reflect/src/main/java/org/apache/xbean/recipe/ReflectionUtil.java:
##########
@@ -1039,7 +1065,7 @@ private static String toParameterList(List<? extends Class<?>> parameterTypes) {
for (int i = 0; i < parameterTypes.size(); i++) {
Class type = parameterTypes.get(i);
if (i > 0) buffer.append(", ");
- buffer.append(type.getName());
+ buffer.append(type != null ? type.getName() : "...");
Review Comment:
when can it be null?
##########
xbean-reflect/src/main/java/org/apache/xbean/recipe/ObjectRecipe.java:
##########
@@ -577,18 +577,33 @@ private Factory findFactory(Type expectedType) {
return constructor;
}
- private Object[] extractConstructorArgs(Map propertyValues, Factory factory) {
+ private Object[] extractConstructorArgs(Map<Property, Object> propertyValues, Factory factory) {
List<String> parameterNames = factory.getParameterNames();
List<Type> parameterTypes = factory.getParameterTypes();
Object[] parameters = new Object[parameterNames.size()];
for (int i = 0; i < parameterNames.size(); i++) {
- Property name = new Property(parameterNames.get(i));
Type type = parameterTypes.get(i);
+ String name = parameterNames.get(i);
+
+ Property property = null;
+ if (options.contains(Option.CASE_INSENSITIVE_PROPERTIES)) {
Review Comment:
what about testing if the map is case insensitive and if not just copy it in a treemap or alike?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe-nmThH5wfGryY1pf4d8vP8EB+6BGkLq7r@public.gmane.org
For queries about this service, please contact Infrastructure at:
users-pF6z+fRhj9EyzMRdD/[email protected]