-
Notifications
You must be signed in to change notification settings - Fork 684
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
Fix Controller.shouldBeCheckedForEnhancement method #1272
base: master
Are you sure you want to change the base?
Conversation
Rename the method Controller.shouldBeCheckedForEnhancement to Controller.enhancementCheckComplete to accurately reflect what the code is doing.
@dcrall I agree that current name |
@asolntsev Thank you for reviewing the change. When the condition in this method is true, we actually return from the method, so the enhancement check is complete. We check for enhancements while we see application code. As soon as we're back in framework code, we know all application code is enhanced and the enhancement check is complete. I believe my method name is correct. |
@dcrall You are talking about the code that calls method If method does FOO, it should be named |
@asolntsev If your argument is that the method should describe what it is mechanically checking, then the name should be something like Additionally, this is not a general purpose method. This is a method that was extracted to provide clarity in the calling code. It is hard to see how it will be used in any other context. Regardless, the method has nothing to do with if that class should be checked for enhancement. I think if we want to focus on the enhancement check, which makes sense. I would suggest something like this:
This structure complements the |
Modified names to mark the entrance into and out of application code to better highlight when we need to verify a class on the stack needs to be enhanced. Extract method for checking if a class is enhanced to not muddy the structure of iterating over the stack.
@dcrall No, I agree, this is not a general-purpose method, and it's not intended to be used from outside. I don't think it should be paired with
|
- Renamed isFrameworkClass() to isFrameworkCode(). The check for framework code includes JDK classes. We see these in the stack as the Play framework is reflectively invoking application code. - Pulled the guard clause that detects that we are no longer examing application code away from the enhancement check to highlight that it is not merely checking if the current class should be enhanced but instead signalling the entire verification is complete and that we should exit the method.
boundaries our enhancement checks.
@asolntsev - Okay, this is my last attempt. If you don't like this, go ahead and change the name to My change is really two fold at this point. One, I changed Two, I pulled the second boundary check into its own if clause to make it clear that it is detecting when we are done with application code and the verification check as a whole. I think having it in the if/else with the enhancement check did not make it clear that we were not just examining the current class. In the end, I settled on |
Rename the method Controller.shouldBeCheckedForEnhancement to Controller.enhancementCheckComplete to accurately reflect what the code is doing. Addresses issue #1271.