Commit 5218189
Seal GeoIp2Exception hierarchy
Make GeoIp2Exception a sealed class with an explicit permits clause
listing all allowed subclasses. This provides:
- Explicit API stability guarantees - new exception types cannot be
added externally
- Compiler-enforced exhaustiveness checking for pattern matching in
future Java versions
- Clear documentation of the complete exception hierarchy
All subclasses (AddressNotFoundException, AuthenticationException,
InvalidRequestException, OutOfQueriesException, and
PermissionRequiredException) were already marked as final, making them
compatible with the sealed parent.
Note: HttpException extends IOException, not GeoIp2Exception, so it
remains outside this sealed hierarchy.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>1 parent 79e3d9c commit 5218189
File tree
1 file changed
+6
-1
lines changed- src/main/java/com/maxmind/geoip2/exception
1 file changed
+6
-1
lines changedLines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
8 | 13 | | |
9 | 14 | | |
10 | 15 | | |
| |||
0 commit comments