Skip to content

4.0.0

Latest

Choose a tag to compare

@oschwald oschwald released this 10 Nov 21:36
73d600c

This is a major release with several breaking changes. Please see
UPGRADING.md for detailed migration instructions.

  • Java 17 or greater is now required.
  • Added support for MaxMind DB files larger than 2GB. The library now uses
    an internal Buffer abstraction that can handle databases exceeding the
    2GB ByteBuffer limit. Files under 2GB continue to use a single ByteBuffer
    for optimal performance. Requested by nonetallt. GitHub #154. Fixed by
    Silvano Cerza. GitHub #289.
  • Metadata.getBuildDate() has been replaced with buildTime(), which returns
    java.time.Instant instead of java.util.Date. The instant represents the
    database build time in UTC.
  • DatabaseRecord, Metadata, Network, and internal DecodedValue classes
    have been converted to records. The following API changes were made:
    • DatabaseRecord.getData() and DatabaseRecord.getNetwork() have been
      replaced with record accessor methods data() and network().
    • Simple getter methods on Metadata (e.g., getBinaryFormatMajorVersion(),
      getDatabaseType(), etc.) have been replaced with their corresponding record
      accessor methods (e.g., binaryFormatMajorVersion(), databaseType(), etc.).
    • Network.getNetworkAddress() and Network.getPrefixLength() have been
      replaced with record accessor methods networkAddress() and prefixLength().
    • Removed the legacy DatabaseRecord(T, InetAddress, int) constructor; pass a
      Network when constructing records manually.
  • Deserialization improvements:
    • If no constructor is annotated with @MaxMindDbConstructor, records now
      use their canonical constructor automatically. For non‑record classes with
      a single public constructor, that constructor is used by default.
    • @MaxMindDbParameter annotations are now optional when parameter names
      match field names in the database: for records, component names are used;
      for classes, Java parameter names are used (when compiled with
      -parameters). Annotations still take precedence when present.
    • Added @MaxMindDbIpAddress and @MaxMindDbNetwork annotations to inject
      the lookup IP address and resulting network into constructors. Annotation
      metadata is cached per type to avoid repeated reflection overhead.