Skip to content

Builds using DNSJava 3.6.0 from Maven fail unless you are using JDK 21 #328

@guss77

Description

@guss77

When trying to build my Android application, that uses DNSJava "latest version", build started failing today with the error:

Execution failed for task ':MyApp:compileArm64ReleaseJavaWithJavac'.
> Could not resolve all files for configuration ':MyApp:arm64ReleaseCompileClasspath'.
   > Failed to transform dnsjava-3.6.0.jar (dnsjava:dnsjava:3.6.0) to match attributes {artifactType=android-classes-jar, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-api}.
      > Execution failed for JetifyTransform: /home/odeda/.gradle/caches/modules-2/files-2.1/dnsjava/dnsjava/3.6.0/98d783fb6db3fbf6c0d4b6e65527b4ee7a05a5a2/dnsjava-3.6.0.jar.
         > Failed to transform '/home/odeda/.gradle/caches/modules-2/files-2.1/dnsjava/dnsjava/3.6.0/98d783fb6db3fbf6c0d4b6e65527b4ee7a05a5a2/dnsjava-3.6.0.jar' using Jetifier. Reason: IllegalArgumentException, message: Unsupported class file major version 65. (Run with --stacktrace for more details.)
           Suggestions:
            - Check out existing issues at https://issuetracker.google.com/issues?q=componentid:460323&s=modified_time:desc, it's possible that this issue has already been filed there.
            - If this issue has not been filed, please report it at https://issuetracker.google.com/issues/new?component=460323 (run with --stacktrace and provide a stack trace if possible).

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1m 14s

The problems seems to be that the DNSJava 3.6.0 JAR uploaded to Maven (https://repo1.maven.org/maven2/dnsjava/dnsjava/3.6.0/dnsjava-3.6.0.jar) contains some class files created as version 65 class files (the JDK 21 version).

Here's the test:

$ mkdir tmp
$ cd tmp
$ curl https://repo1.maven.org/maven2/dnsjava/dnsjava/3.6.0/dnsjava-3.6.0.jar -O
$ unzip -q dnsjava-3.6.0.jar
$ file ./META-INF/versions/21/org/xbill/DNS/spi/DnsjavaInetAddressResolver*.class
./META-INF/versions/21/org/xbill/DNS/spi/DnsjavaInetAddressResolver.class:
         compiled Java class data, version 65.0
./META-INF/versions/21/org/xbill/DNS/spi/DnsjavaInetAddressResolverProvider.class:
         compiled Java class data, version 65.0

Most files are compiled for class file version 52, with just these two files and a module-info file compiled as 65. I'm not sure I understand the process that created this situation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions