Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make ByteCursor implementations static final inner classes (#11662)
Motivation: People might be tempted to use mocking tools like Mockito.spy() on the ByteCursors. By returning instances where the concrete classes are final, we will be forcing integrators to use stub-like wrappers instead. Such stubs are more well-behaved since they are implemented in terms of the real instance. This prevents the mocked objects from (easily) producing behaviour that violates the API specification. Modification: All ByteCursor implementations have changed from using anonymous inner classes, to using static-final named inner classes. Result: The concrete ByteCursor classes can no longer be extended via byte code generation, such as from mocking tools.
- Loading branch information
Showing
4 changed files
with
303 additions
and
237 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.