dnsjava / dnsjava

dnsjava - an implementation of the DNS protocol in Java
BSD 3-Clause "New" or "Revised" License
932 stars 241 forks source link

Usage of removed JDK API #140

Closed MatanSabag closed 3 years ago

MatanSabag commented 3 years ago

In a migration process from Java 8 to 11, I executed jdeps on my code and noticed that this code uses JDK removed internal APIs.

dns-2.1.5.jar -> JDK removed internal API
   org.xbill.DNS.spi.DNSJavaNameServiceDescriptor     -> sun.net.spi.nameservice.NameService                JDK internal API (JDK removed internal API)
   org.xbill.DNS.spi.DNSJavaNameServiceDescriptor     -> sun.net.spi.nameservice.NameServiceDescriptor      JDK internal API (JDK removed internal API)

I searched this repository and noticed that this code still exists in the codebase. Is there any plan to make this repository to JDK9+ safe?

ibauersachs commented 3 years ago

You analysis is against the very old version 2.1.5, current is 3.3.1.

The mentioned classes are only used when you specify dnsjava as the DNS SPI. This is no longer possible on Java 9+ as the SPI was removed, hence the classes aren't even loaded. If you compile dnsjava with a Java 9+ JDK, the classes are excluded.

All this is already mentioned in the README. There is nothing "unsafe" here.

AlanBateman commented 12 months ago

JEP 418 defines a standard service-provider interface for host name and address resolution. I assume dnsjava should implement a provider if it wants to be used for lookup with the InetAddress API.

ibauersachs commented 12 months ago

@AlanBateman I'm working on it, see #290.