Skip to content

Prettify the version diff reports - #491

Open
Goooler wants to merge 1 commit into
JakeWharton:trunkfrom
Goooler:improve-bytecode-version-diff
Open

Prettify the version diff reports#491
Goooler wants to merge 1 commit into
JakeWharton:trunkfrom
Goooler:improve-bytecode-version-diff

Conversation

@Goooler

@Goooler Goooler commented Mar 20, 2026

Copy link
Copy Markdown
Contributor
OLD: old.jar
NEW: new.jar

       │         compressed         │        uncompressed         
       ├──────────┬─────────┬───────┼──────────┬──────────┬───────
 JAR   │ old      │ new     │ diff  │ old      │ new      │ diff  
───────┼──────────┼─────────┼───────┼──────────┼──────────┼───────
 class │    969 B │   978 B │  +9 B │   1012 B │ 1.01 KiB │ +22 B 
 other │    634 B │   659 B │ +25 B │     82 B │     81 B │  -1 B 
───────┼──────────┼─────────┼───────┼──────────┼──────────┼───────
 total │ 1.57 KiB │ 1.6 KiB │ +34 B │ 1.07 KiB │ 1.09 KiB │ +21 B 

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

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

    compressed     │   uncompressed    │                                               
──────────┬────────┼──────────┬────────┤                                               
 size     │ diff   │ size     │ diff   │ path                                          
──────────┼────────┼──────────┼────────┼───────────────────────────────────────────────
    487 B │ +487 B │    516 B │ +516 B │ + org/example/MainKt.class                    
          │ -484 B │          │ -506 B │ - org/example/Main3Kt.class                   
    210 B │ +210 B │     56 B │  +56 B │ + META-INF/org.example_untitled.kotlin_module 
          │ -185 B │          │  -57 B │ - META-INF/untitled.kotlin_module             
    491 B │   +6 B │    518 B │  +12 B │ ∆ org/example/Main2Kt.class                   
──────────┼────────┼──────────┼────────┼───────────────────────────────────────────────
 1.16 KiB │  +34 B │ 1.06 KiB │  +21 B │ (total)                                       


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

CLASSES:

   old │ new │ diff      
  ─────┼─────┼───────────
   2   │ 2   │ 0 (+1 -1) 
  
  + org.example.MainKt
  
  - org.example.Main3Kt
  

BYTECODE VERSIONS:

   version │ old │ new │ diff       
  ─────────┼─────┼─────┼────────────
        65 │   0 │   2 │ +2 (+2 -0) 
        69 │   2 │   0 │ -2 (+0 -2) 

  org.example.Main2Kt: 69 → 65

KOTLIN METADATA VERSIONS:

   version │ old │ new │ diff       
  ─────────┼─────┼─────┼────────────
     2.3.0 │   2 │   0 │ -2 (+0 -2) 
     2.4.0 │   0 │   2 │ +2 (+2 -0) 

  org.example.Main2Kt: 2.3.0 → 2.4.0

METHODS:

   old │ new │ diff      
  ─────┼─────┼───────────
   4   │ 4   │ 0 (+2 -2) 
  
  + org.example.MainKt main()
  + org.example.MainKt main(String[])
  
  - org.example.Main3Kt main()
  - org.example.Main3Kt main(String[])
Apk diff

======================
====   MANIFEST   ====
======================

@@ -11,3 +11,3 @@
   <uses-sdk
-      android:minSdkVersion="23"
+      android:minSdkVersion="26"
       android:targetSdkVersion="37"



=================
====   DEX   ====
=================

FORMAT VERSIONS:

   version │ old │ new │ diff       
  ─────────┼─────┼─────┼────────────
        35 │   3 │   0 │ -3 (+0 -3) 
        38 │   0 │   2 │ +2 (+2 -0) 

  classes.dex: 35 → 38
  classes2.dex: 35 → 38

Closes #490.

val newCount = newVersionMap.values.count { it == version }
BytecodeVersionDiff.Count(oldCount) to BytecodeVersionDiff.Count(newCount)
}
.filter { (_, counts) -> counts.first != counts.second }

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I'm not too sure about this behavior. I'm tempted to say that if we show the diff at all, we want to show all counts just for the clarity of it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's necessary. Covered this case by VersionDiffTest.

Comment on lines +256 to +257
// Classes shifted versions but net counts per version stayed same.
// Table is hidden, but class list is shown.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Shouldn't this test fail with the filter removed? I would have expected the chart here now...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

versionCounts is emptyMap in this case.

@Goooler
Goooler force-pushed the improve-bytecode-version-diff branch from 8a36e33 to 33e0a77 Compare August 21, 2026 09:38
@Goooler Goooler changed the title Improve bytecode version diff Prettify the version diff reports Aug 21, 2026
@Goooler
Goooler force-pushed the improve-bytecode-version-diff branch from 33e0a77 to 86def46 Compare August 30, 2026 04:55
Jar diff:

```
OLD: old.jar
NEW: new.jar

       │         compressed         │        uncompressed
       ├──────────┬─────────┬───────┼──────────┬──────────┬───────
 JAR   │ old      │ new     │ diff  │ old      │ new      │ diff
───────┼──────────┼─────────┼───────┼──────────┼──────────┼───────
 class │    969 B │   978 B │  +9 B │   1012 B │ 1.01 KiB │ +22 B
 other │    634 B │   659 B │ +25 B │     82 B │     81 B │  -1 B
───────┼──────────┼─────────┼───────┼──────────┼──────────┼───────
 total │ 1.57 KiB │ 1.6 KiB │ +34 B │ 1.07 KiB │ 1.09 KiB │ +21 B

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

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

    compressed     │   uncompressed    │
──────────┬────────┼──────────┬────────┤
 size     │ diff   │ size     │ diff   │ path
──────────┼────────┼──────────┼────────┼───────────────────────────────────────────────
    487 B │ +487 B │    516 B │ +516 B │ + org/example/MainKt.class
          │ -484 B │          │ -506 B │ - org/example/Main3Kt.class
    210 B │ +210 B │     56 B │  +56 B │ + META-INF/org.example_untitled.kotlin_module
          │ -185 B │          │  -57 B │ - META-INF/untitled.kotlin_module
    491 B │   +6 B │    518 B │  +12 B │ ∆ org/example/Main2Kt.class
──────────┼────────┼──────────┼────────┼───────────────────────────────────────────────
 1.16 KiB │  +34 B │ 1.06 KiB │  +21 B │ (total)

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

CLASSES:

   old │ new │ diff
  ─────┼─────┼───────────
   2   │ 2   │ 0 (+1 -1)

  + org.example.MainKt

  - org.example.Main3Kt

BYTECODE VERSIONS:

   version │ old │ new │ diff
  ─────────┼─────┼─────┼────────────
        65 │   0 │   2 │ +2 (+2 -0)
        69 │   2 │   0 │ -2 (+0 -2)

  org.example.Main2Kt: 69 → 65

KOTLIN METADATA VERSIONS:

   version │ old │ new │ diff
  ─────────┼─────┼─────┼────────────
     2.3.0 │   2 │   0 │ -2 (+0 -2)
     2.4.0 │   0 │   2 │ +2 (+2 -0)

  org.example.Main2Kt: 2.3.0 → 2.4.0

METHODS:

   old │ new │ diff
  ─────┼─────┼───────────
   4   │ 4   │ 0 (+2 -2)

  + org.example.MainKt main()
  + org.example.MainKt main(String[])

  - org.example.Main3Kt main()
  - org.example.Main3Kt main(String[])
```

Apk diff:

```
======================
====   MANIFEST   ====
======================

@@ -11,3 +11,3 @@
   <uses-sdk
-      android:minSdkVersion="23"
+      android:minSdkVersion="26"
       android:targetSdkVersion="37"

=================
====   DEX   ====
=================

FORMAT VERSIONS:

   version │ old │ new │ diff
  ─────────┼─────┼─────┼────────────
        35 │   3 │   0 │ -3 (+0 -3)
        38 │   0 │   2 │ +2 (+2 -0)

  classes.dex: 35 → 38
  classes2.dex: 35 → 38
```
@Goooler
Goooler force-pushed the improve-bytecode-version-diff branch from 86def46 to 4a8fb76 Compare August 30, 2026 05:27
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.

Bytecode version diff should use a different rendering

2 participants