-
-
Notifications
You must be signed in to change notification settings - Fork 27.3k
Declares the template methods as final (Issue 1099) #1100
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
Conversation
The reason for the failing tests is Mockito (which has problems with final methods in the version currently used, i.e. in version 1.10.19). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The build is failing, and the PR can't be accepted due to that.
Is there already an open issue in Mockito about this? |
The What's new in Mockito 2 document claims that it should be possible to mock final methods, but you are still using Mockito version 1.10.19. Since I do not know Mockito, I did not want to touch on that one, and I also did not want to do an easy patch by simply removing the test. |
I just changed the version of Mockito, and depending on the version I get different errors in other packages, but I have to admit that I never worked with Mockito. |
I changed the version of Mockito to 3.1.0 and explicitly added a dependency to bytebuddy (as read in issue1606@mockito). This version can handle final methods. However, the test in class
The line marked with (*) will raise the following error:
but it is not clear to me why these additional invocations are reported. If method |
I opened an issue at Mockito: mockito/mockito#1826 |
I can't understand |
@13998206131 what can you not understand? |
@dgruntz Please comment to let us know you are still working on this. We have assigned the issue to @elouie-code. Please have a look into this PR to get a better insight. @iluwatar we can try building this PR again by updating the fork. What would you say? |
The issue seems to be still open so I doubt the code in this PR will work. Also there's some conflicts preventing merge. |
@ohbus, as @iluwatar mentioned, the issue/bug has not yet fixed (at least the issue mockito/mockito#1826 is still open). Regarding the merge conflict: this is only a conflict with the version of mockito in the |
Replaced by PR #2057. |
As described in issue #1099 it is recommended to declare the template method as final. This pull request changes the implementation in the sample code of the following patterns:
The template pattern used in the callback pattern was already declared final (method
executeWith
in classcom.iluwatar.callback.Task
).