GeezerVison is showing github.com — getAddress() in ARecord/AAAARecord should return Inet4Address/Inet6Address · Issue #101 · dnsjava/dnsjava
getAddress() in ARecord/AAAARecord should return Inet4Address/Inet6Address #101
Description
To avoid having to cast in client code,
ARecord.getAddress() should return Inet4Address
AAAARecord.getAddress() should return Inet6Address (not feasible since Java creates Inet4Address instances for ::ffff:0.0.0.0/96)
I tried to change the return type (adding casts inside the method), but then I got
Failed to execute goal com.github.siom79.japicmp:japicmp-maven-plugin:0.14.0:cmp (check-compatibility) on project dnsjava: Versions of archives indicate a minor change but binary incompatible changes found.
While this changes the public API, usages of those methods should work like before, as the new return types can still be assigned to InetAddress. What could fail with this change is overriding those methods. Maybe the methods or the classes should be final.
Activity
ibauersachs commented on May 2, 2020
Unfortunately apicmp is right. While the change is source compatible, it isn't binary compatible and would result in java.lang.NoSuchMethodError: org.xbill.DNS.ARecord.getAddress()Ljava/net/InetAddress.
I'll stick to semver for this project, so I will consider this for the next major version.
Reacted by Ruurtjan and Thilo Schwarz
maffe commented on Sep 12, 2024
Since Java creates Inet4Address instances for IPv4 mapped addresses (::ffff:0:0/96, Java 22 example: Inet6Address.ofLiteral("::ffff:192.0.2.1")), it’s not possible to map all AAAA records to Inet6Address. But Inet4Address would always be possible for A records.
Metadata
Metadata
Development
No branches or pull requestsIssue actions