Skip to content

Conversation

@jungm
Copy link
Member

@jungm jungm commented Dec 30, 2025

Class type = parameterTypes.get(i);
if (i > 0) buffer.append(", ");
buffer.append(type.getName());
buffer.append(type != null ? type.getName() : "...");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when can it be null?

Copy link
Member Author

@jungm jungm Dec 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tomee passes parameterTypes=null which is then converted to a list of nulls in findConstructor, and toParameterList gets invoked to generate exception messages

for example: https://ci-builds.apache.org/job/Tomee/view/tomee-10.x/job/tomee-10-build-full/org.apache.tomee$arquillian-tomee-webprofile-tests/43/testReport/junit/org.apache.openejb.arquillian.tests.bmp.local/BmpLocalEntityTest/___/

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I guessed so but why does it happen now and was not before? Is it about the ServiceProviders, did something changed ?

to be clear I'm not against the change just want to ensure it is not a misusage cause we are loosing information there in user facing error messages, will be less usable ("oh it failed in constructor Foo(..., ..., ....)")

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this happened as a side effect of XBEAN-350. Since we fixed that issue, the code path is now reachable with null type parameters through implicit constructor resolution using argument names (in which case the type list is nulled). On the TomEE side, nothing has changed in that regard

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, didn't get a change to check but was my fear, so this sounds like a regression we might want to fix before next release - and therefore not do this change in this PR, wdyt?

Copy link
Contributor

@rzo1 rzo1 Dec 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's a regression technically. More or less a bug of this utility method to produce a user facing error messages and don't account for null values.

What we might want to fix is likely another type of error message accounting for the null containing type list in case we fail via implicit ctor arg resolution and no types are available/present. That would be more helpful for the error msg.

I agree - we can change and track it in an other issue and revert it here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Proposed to use Object instead of ... to explicit it was a loose matching -> #48, feel free to take it back or rework it, it is just a proposal

}

boolean parametersMatch;
if (options.contains(Option.CASE_INSENSITIVE_PROPERTIES)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

String name = parameterNames.get(i);

Property property = null;
if (options.contains(Option.CASE_INSENSITIVE_PROPERTIES)) {
Copy link
Contributor

@rmannibucau rmannibucau Dec 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about testing if the map is case insensitive and if not just copy it in a treemap or alike (or do it in the caller)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tbh i wasnt aware treemap/treeset could to that, updated my PR and it makes the diff a lot smaller

// clone the properties so they can be used again
Map<Property,Object> propertyValues = new LinkedHashMap<Property,Object>(properties);
Map<Property,Object> propertyValues = options.contains(Option.CASE_INSENSITIVE_PROPERTIES)
? new TreeMap<>(Comparator.comparing(property -> property.name, String.CASE_INSENSITIVE_ORDER))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new TreeMap<>(String.CASE_INSENSITIVE_ORDER) should be sufficient

Copy link
Contributor

@rmannibucau rmannibucau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall ok, I'd simplify the treemap thing and review why tomee fails but core change looks good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants