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

WW-5415 Fixes accessing public constructors via expression #933

Merged
merged 2 commits into from
May 14, 2024

Conversation

lukaszlenart
Copy link
Member

@lukaszlenart lukaszlenart commented May 12, 2024

This PR fixes creating instances via OGNL expressions. The breaking change was introduced in #780

Closes WW-5415

@lukaszlenart lukaszlenart requested a review from kusalk May 12, 2024 07:49
@@ -147,7 +147,7 @@ public boolean isAccessible(Map context, Object target, Member member, String pr
if (target != null) {
// Special case: Target is a Class object but not Class.class
if (Class.class.equals(target.getClass()) && !Class.class.equals(target)) {
if (!isStatic(member)) {
if (!isStatic(member) && Arrays.stream(((Class<?>) target).getConstructors()).noneMatch(p -> p.getClass().equals(member.getClass()))) {
Copy link
Member Author

Choose a reason for hiding this comment

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

This is just a temporary solution to express where the problem is, @kusalk I count on your comment :)

Copy link
Member

Choose a reason for hiding this comment

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

Thanks @lukaszlenart for writing the test case - I did indeed overlook the constructor case, I've pushed a commit to this PR with the appropriate fix :)

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
57.1% Coverage on New Code (required ≥ 80%)

See analysis details on SonarCloud

@lukaszlenart lukaszlenart merged commit 40ccc74 into master May 14, 2024
8 of 9 checks passed
@lukaszlenart lukaszlenart deleted the fix/WW-5415-constructor branch May 14, 2024 17:56
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.

2 participants