-
-
Notifications
You must be signed in to change notification settings - Fork 80
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
Update isMethodCallable() logic, re-introduce its usage for getReadMethod() #110
Update isMethodCallable() logic, re-introduce its usage for getReadMethod() #110
Conversation
Small updates to OgnlRuntime, attempting to ensure more consistent behaviour for JDK7-11. - Update OgnlRuntime isMethodCallable(). Removed (now) unnecessary isJDK15 check, added clearer logic and explanatory JavaDoc comments. - Added OgnlRuntime isMethodCallable_BridgeOrNonSynthetic() for specialized usage such as choosing valid Read and Write methods. - Made checks in getReadMethod() and getWiteMethod symmetric again. - Added new unit tests to confirm expected behaviour with respect to bridge methods and synthetic methods.
Hello OGNL Team. This PR follows some discussion following the introduction of PR#104. It was discovered that the Changing isMethodCallable() to also include bridge methods caused additional unit test failures to occur, and even after several debugging attempts I was unable to isolate the underlying reason (just that it appeared to cause OGNL to choose the wrong method signature in some cases). So, this PR leaves the behaviour of isMethodCallable() unchanged (rejects all synthetic/bridge methods), and introduced a isMethodCallable_BridgeOrNonSynthetic() that can be used in specific cases (after careful consideration). Currently the new method is only used so that bridge methods are considered as valid by OGNL for Read or Write methods. The changes appear to be safe, and the build tests succeed for JDK7, JDK8 and JDK11 locally. Let me know if you think the changes look OK, or if things could be improved for this PR. |
…ic() was introduced.
Nice work, @JCgH4164838Gh792C124B5 ! I was wondering if you could find a test case that verifies the effect of |
Hello @harawata . I was not able to think up a direct way to confirm the effect of The new unit tests, combined with the previous tests that check As you pointed out, the current tests in this PR do pass even if Other than bridge methods, I could not find any examples of synthetic methods that that have consistent/known names (just compiler-chosen names like access$x, where x is an integer). There does not seem to be any valid use case for trying to call non-bridge synthetic methods, but let me know if you know otherwise ? Even if there are use cases, it seems it would still be risky to allow OGNL to call non-bridge synthetic methods (which seem to be purely for the compiler's internal use). Please let me know if the reasoning above seems sound or not ? |
Thanks for the update, @JCgH4164838Gh792C124B5 ! I agree that there is no valid use case for calling non-bridge synthetic methods. |
LGTM 👍 |
Follow-up to PR #104.
Small updates to OgnlRuntime, attempting to ensure more consistent behaviour for JDK7-11.