Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DROOLS-7197] fix generics introspection on superclasses during exec … #5944

Merged
merged 1 commit into from
May 15, 2024

Conversation

mariofusco
Copy link
Contributor

This fixes both problems reported in #5925 and https://issues.redhat.com/browse/DROOLS-7197

@@ -164,59 +162,6 @@ public void setter_intToPrimitiveLongCoercionVarargs() {
assertThat(fact.getValueList()).containsExactly(10L, 20L); // Coerced with both cases
}

@Test
public void property_subClassMethod_genericsReturnType() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since this is no longer a difference between interpreted mode and executable model I moved these 2 tests in a different class.

} else {
return Optional.empty();
}
private static boolean typeNeedsCast(Type t) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The Optional wasn't really necessary here since the result was used only as a boolean testing if the Optional was present or not.

} else {
return new TypedExpressionCursor(methodCallExpr, genericReturnType);
}
return new TypedExpressionCursor(methodCallExpr, actualTypeFromGenerics(originalTypeCursor, m.getGenericReturnType(), rawClassCursor));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

All the logic to deal with generics introspection has been moved in static utility methods of ClassUtils.

Copy link
Contributor

@tkobayas tkobayas left a comment

Choose a reason for hiding this comment

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

Thank you, and sorry that I was not aware that execmodel tried to resolve actual type from generics at the time of DROOLS-7197.

@mariofusco mariofusco merged commit 785ef86 into apache:main May 15, 2024
10 checks passed
@mariofusco mariofusco deleted the d7197 branch May 15, 2024 06:58
rgdoliveira pushed a commit to rgdoliveira/drools that referenced this pull request Jun 10, 2024
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