-
Notifications
You must be signed in to change notification settings - Fork 207
Modernization changes for new major version #620
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
Open
oschwald
wants to merge
10
commits into
main
Choose a base branch
from
greg/eng-3230
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,544
−2,169
Conversation
This file contains hidden or 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
Member
oschwald
commented
Oct 14, 2025
- Move model and record classes to records
- Deprecate get methods in non-record classes*
09437e4
to
98265c6
Compare
This will eventually reduce boilerplate and provide a more consistent experience for users. I am leaving the old getter methods as deprecated for one major version to give users the ability to upgrade before having to migrate to the updated accessors. There are other breaking changes, but these will likely not affect most users.
Public getter methods in non-record classes (DatabaseReader, exception classes) have been renamed to follow the same naming convention as records (e.g., metadata() instead of getMetadata()). The old getter methods are still available but have been deprecated and will be removed in version 6.0.0. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Bump maxmind-db dependency from 3.2.0 to 4.0.0-SNAPSHOT - Update method calls to use record-style accessors instead of deprecated JavaBean-style getters in DatabaseReader.java and test files - Changes include: getDatabaseType() → databaseType(), getData() → data(), getNetwork() → network(), getNetworkAddress() → networkAddress(), getPrefixLength() → prefixLength() 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
With maxmind-db 4.0.0, records automatically use their canonical constructor for deserialization when no constructor is explicitly annotated with @MaxMindDbConstructor. This change removes the annotation from most records in the codebase. Changes: - Removed empty canonical constructors from records with no logic - Removed @MaxMindDbConstructor from canonical constructors with immutability/validation logic, relying on automatic detection - Added useDefault=true to boolean parameters to leverage automatic null-to-false conversion instead of manual Boolean→boolean handling - Kept @MaxMindDbConstructor only for records requiring custom type conversions (String→LocalDate in AnonymousPlusResponse, String→enum in ConnectionTypeResponse and Traits) - Removed unused MaxMindDbConstructor imports All tests pass. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Remove copy constructors from model classes that only populated IP address and network (AnonymousIpResponse, AnonymousPlusResponse, ConnectionTypeResponse, AsnResponse, DomainResponse, IspResponse, IpRiskResponse) - Update DatabaseReader getter methods to return responses directly - Update annotations to use @MaxMindDbIpAddress and @MaxMindDbNetwork for context injection - Remove @MaxMindDbConstructor from Traits that was only needed for ConnectionType conversion - Add @MaxMindDbCreator to ConnectionType.fromString() for enum deserialization These constructors are no longer needed since IP address and network are now automatically injected via @MaxMindDbIpAddress and @MaxMindDbNetwork annotations, and enum conversion is handled by @MaxMindDbCreator. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
All the private getX methods in DatabaseReader followed similar patterns, so we've consolidated them into a single generic getResponse() method. For responses that need locale transformations (City, Country, Enterprise), we use Optional.map() to apply the transformation. This also changes the get() method to accept an explicit caller parameter instead of introspecting the stack trace, making error messages clearer and more reliable. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Changed the ipAddress field type from String to InetAddress across all model and record classes. This provides better type safety and makes it clear that these fields contain IP addresses. Key changes: - Updated ipAddress field type to InetAddress in all response/record classes - Deprecated getIpAddress() methods now call ipAddress().getHostAddress() to maintain backward compatibility (still return String) - Created InetAddressSerializer to serialize InetAddress to String in JSON - Created InetAddressDeserializer to deserialize JSON strings to InetAddress - Created InetAddressModule and registered it globally in JsonSerializable - Updated all tests to call .getHostAddress() when comparing IP addresses The new ipAddress() accessor returns InetAddress, while the deprecated getIpAddress() continues to return String for backward compatibility. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
937eb39
to
f5299b9
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.