A registry keyed by object identity keeps every object it has ever seen alive, so a long-running worker grows in memory with the number of distinct objects it…
A fluent method returning self promises the class it is declared in, so a subclass inherits a signature that lies about what it returns. Before 8.0 the honest…
A method with six optional parameters produced calls full of nulls to reach the seventh, and naming them fixes the call site at the cost of freezing every…
Enums are 8.1, so a set of allowed values in 2020 is class constants with a validating constructor — and the gaps are worth naming rather than discovering.…
A child class overriding a method had to declare exactly the parent’s return type, so an abstract repository could not promise that each implementation returns its own entity.…
Autowiring resolves by type, and a string has no type to resolve — so every service with a configuration value needs an explicit argument, which is the thing…
Asserting on a private property in a test usually means reflection, four lines of it, repeated — and there is a shorter route that is occasionally the right…