Vineflower / vineflower

Modern Java decompiler aiming to be as accurate as possible, with an emphasis on output quality. Fork of the Fernflower decompiler.
https://vineflower.org/
Apache License 2.0
1.13k stars 83 forks source link

Non-redundant casts removed #387

Closed jpenilla closed 1 month ago

jpenilla commented 1 month ago

The following is a diff from VF 1.11-SNAPSHOT to 1.10.1 output:

diff --git a/net/minecraft/world/level/levelgen/BitRandomSource.java b/net/minecraft/world/level/levelgen/BitRandomSource.java
--- a/net/minecraft/world/level/levelgen/BitRandomSource.java    (revision 945cfbb91d450971c7076db24b5a76a4ea97cd0c)
+++ b/net/minecraft/world/level/levelgen/BitRandomSource.java    (date 1714775725817)
@@ -18,7 +18,7 @@
         if (bound <= 0) {
             throw new IllegalArgumentException("Bound must be positive");
         } else if ((bound & bound - 1) == 0) {
-            return (int)(bound * this.next(31) >> 31);
+            return (int)((long)bound * (long)this.next(31) >> 31);
         } else {
             int i;
             int i1;

the no-longer-emitted casts to long are actually not redundant, removing them causes an error when starting Minecraft (but compiles fine).

jpenilla commented 1 month ago

dupe #388