Method extension evolves an existing API by adding support for new behavior while preserving the earlier call pattern. Optional parameters let older clients continue working without endpoint proliferation. section 9.4.2
Keep the old call valid
A report-generation method can gain new options while clients using the original form continue unchanged. If the earlier method is eventually replaced, mark it deprecated and leave it available long enough for migration. section 9.4.2
This technique minimizes disruption and avoids maintaining multiple endpoints. Use it carefully: repeated extensions can make a method complex and ambiguous. Compatibility adapters and versioned entry points remain alternatives when one interface can no longer express change clearly. section 9.4.2
@Deprecated(since = "2.1", forRemoval = true)
public void generateReport() { ... }
See a deprecation annotation marking an older method for removal while preserving a migration window. section 9.4.2
