Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some code is not present in the decompilation #279

Open
Gaming32 opened this issue May 18, 2023 · 1 comment
Open

Some code is not present in the decompilation #279

Gaming32 opened this issue May 18, 2023 · 1 comment
Assignees
Labels
bug Something isn't working Priority: High High priority Subsystem: Statement Structure Anything concerning how statements are structured in a method

Comments

@Gaming32
Copy link

Gaming32 commented May 18, 2023

The decompilation:

@SafeVarargs
static <T> HolderSet.Direct<T> direct(Holder<T>... var0) {
   return new HolderSet.Direct<>(List.of(var0));
   HolderSet.Direct var10000 = new HolderSet.Direct;
   Holder[] var10002 = var0;
   int var10003 = 0;

   while(var10003 < var10002.length) {
      var10003 += 1;
   }

   var10000./* $QF: Unable to resugar constructor */<init>(Collections.unmodifiableList(Arrays.asList(var10002)));
   return var10000;
}

The bytecode:

 0: new           #13                 // class net/minecraft/core/HolderSet$Direct
 3: dup
 4: aload_0
 5: iconst_0
 6: dup_x1
 7: swap
 8: dup_x2
 9: arraylength
10: if_icmpge     24
13: dup2
14: aaload
15: invokestatic  #61                 // Method java/util/Objects.requireNonNull:(Ljava/lang/Object;)Ljava/lang/Object;
18: pop
19: iconst_1
20: iadd
21: goto          6
24: pop
25: invokestatic  #67                 // Method java/util/Arrays.asList:([Ljava/lang/Object;)Ljava/util/List;
28: invokestatic  #73                 // Method java/util/Collections.unmodifiableList:(Ljava/util/List;)Ljava/util/List;
31: invokespecial #76                 // Method net/minecraft/core/HolderSet$Direct."<init>":(Ljava/util/List;)V
34: areturn

Class file: class.zip

@Gaming32
Copy link
Author

CFR decompilation:

@SafeVarargs
public static <T> Direct<T> direct(Holder<T> ... holderArray) {
    Holder<T>[] holderArray2 = holderArray;
    int n = 0;
    while (n < holderArray2.length) {
        holderArray2 = holderArray2;
        Objects.requireNonNull(holderArray2[n]);
        n = n + 1;
    }
    return new Direct(Collections.unmodifiableList(Arrays.asList(holderArray2)));
}

@jaskarth jaskarth added bug Something isn't working Subsystem: Statement Structure Anything concerning how statements are structured in a method Priority: High High priority labels May 18, 2023
@jaskarth jaskarth self-assigned this May 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Priority: High High priority Subsystem: Statement Structure Anything concerning how statements are structured in a method
Projects
None yet
Development

No branches or pull requests

2 participants