Skip to content

Prefer Class-File API on Java 24 or above#477

Open
Goooler wants to merge 5 commits intoJakeWharton:trunkfrom
Goooler:asm-to-class-file
Open

Prefer Class-File API on Java 24 or above#477
Goooler wants to merge 5 commits intoJakeWharton:trunkfrom
Goooler:asm-to-class-file

Conversation

@Goooler
Copy link
Contributor

@Goooler Goooler commented Mar 10, 2026

Closes #474.

@JakeWharton
Copy link
Owner

While I generally want this, I think we don't win much with it. Only annoying any users we have that are running older than JDK 24. No one should be running old JDKs, but as we know most people generally do. Maybe once AGP requires JDK 24 (or newer) this will be less hostile of a change.

@Goooler
Copy link
Contributor Author

Goooler commented Mar 11, 2026

Reasonable. Alternatively, there could be two impls for Java 24 newer or not (Multi-Release JAR?).

@Goooler Goooler changed the title Migrate from ASM to Class-File API Prefer Class-File API on Java 24 or above Mar 11, 2026
okio = "com.squareup.okio:okio:3.16.4"
byteunits = "com.jakewharton.byteunits:byteunits:0.9.1"
asm = "org.ow2.asm:asm:9.9.1"
asm = "org.ow2.asm:asm:9.6"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tree ~/IdeaProjects/diffuse/diffuse/build/install

/Users/goooler/IdeaProjects/diffuse/diffuse/build/install
└── diffuse
    ├── bin
    │   ├── diffuse
    │   └── diffuse.bat
    └── lib
        ├── aapt2-proto-9.1.0-14792394.jar
        ├── annotations-13.0.jar
        ├── apksig-9.1.0.jar
        ├── asm-9.6.jar
        ├── auto-value-annotations-1.6.2.jar
        ├── binary-resources-32.1.0.jar
        ├── bundletool-1.18.3.jar
        ├── byteunits-0.9.1.jar
        ├── checker-qual-3.5.0.jar
        ├── clikt-jvm.jar
        ├── clikt-mordant-jvm.jar
        ├── colormath-jvm.jar
        ├── crossword-jvm.jar
        ├── dagger-2.28.3.jar
        ├── dalvik-dx-16.0.1.jar
        ├── diffuse-0.4.0-SNAPSHOT.jar
        ├── error_prone_annotations-2.11.0.jar
        ├── failureaccess-1.0.1.jar
        ├── formats-0.4.0-SNAPSHOT.jar
        ├── gson-2.8.9.jar
        ├── guava-30.1-jre.jar
        ├── io-0.4.0-SNAPSHOT.jar
        ├── j2objc-annotations-1.3.jar
        ├── java-diff-utils-4.16.jar
        ├── javax.inject-1.jar
        ├── jna-5.14.0.jar
        ├── jose4j-0.9.5.jar
        ├── jsr305-3.0.2.jar
        ├── kotlin-stdlib-2.3.20-RC3.jar
        ├── kotlin-stdlib-jdk7-1.9.10.jar
        ├── kotlin-stdlib-jdk8-1.9.10.jar
        ├── listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar
        ├── mordant-jvm-ffm-jvm.jar
        ├── mordant-jvm-graal-ffi-jvm.jar
        ├── mordant-jvm-jna-jvm.jar
        ├── mordant-jvm.jar
        ├── mordant-omnibus-jvm.jar
        ├── okio-jvm-3.16.4.jar
        ├── picnic-jvm.jar
        ├── protobuf-java-4.34.0.jar
        ├── protobuf-java-util-3.22.3.jar
        ├── reports-0.4.0-SNAPSHOT.jar
        └── slf4j-api-1.7.30.jar

4 directories, 45 files

sh ~/IdeaProjects/diffuse/diffuse/build/install/diffuse/bin/diffuse diff --jar ~/Downloads/old.jar ~/Downloads/new.jar

OLD: old.jar
NEW: new.jar

 JAR   │ old     │ new     │ diff  
───────┼─────────┼─────────┼───────
 class │ 1.2 KiB │ 1.2 KiB │ +59 B 
 other │    72 B │    72 B │   0 B 
───────┼─────────┼─────────┼───────
 total │ 1.3 KiB │ 1.3 KiB │ +59 B 

 CLASSES │ old │ new │ diff       
─────────┼─────┼─────┼────────────
 classes │   1 │   1 │  0 (+0 -0) 
 methods │   4 │   5 │ +1 (+1 -0) 
  fields │   1 │   1 │  0 (+0 -0) 

=================
====   JAR   ====
=================

 size    │ diff  │ path                       
─────────┼───────┼────────────────────────────
 1.2 KiB │ +59 B │ ∆ org/example/MainKt.class 
─────────┼───────┼────────────────────────────
 1.2 KiB │ +59 B │ (total)                    


=====================
====   CLASSES   ====
=====================

METHODS:

   old │ new │ diff       
  ─────┼─────┼────────────
   4   │ 5   │ +1 (+1 -0) 
  
  + org.example.MainKt main2()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate from ASM to Class-File API

2 participants