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

Local variables are sometimes declared as non-existent types. #459

Open
SpaceWalkerRS opened this issue Feb 23, 2025 · 0 comments
Open

Local variables are sometimes declared as non-existent types. #459

SpaceWalkerRS opened this issue Feb 23, 2025 · 0 comments
Labels
Priority: High High priority Subsystem: Variables Anything concerning variables, types, assignments, and casting Type: Bug Something isn't working

Comments

@SpaceWalkerRS
Copy link

Vineflower version

1.10.1

Describe the bug

Sometimes local variables are declared as types that do not exist.

Additional information

This affects old Minecraft versions. For example, class zh in the 1.0.0 client jar has a method a()[I that decompiles to the following:

    public int[] a(String string) {
        afs var2 = this.l.a;
        int[] var3 = (int[])this.e.get(string);
        if (var3 != null) {
            return var3;
        } else {
            try {
                I var6 = null;
                if (string.startsWith("##")) {
                    var6 = this.b(this.c(this.a(var2.a(string.substring(2)))));
                } else if (string.startsWith("%clamp%")) {
                    this.b = true;
                    var6 = this.b(this.a(var2.a(string.substring(7))));
                    this.b = false;
                } else if (string.startsWith("%blur%")) {
                    this.c = true;
                    this.b = true;
                    var6 = this.b(this.a(var2.a(string.substring(6))));
                    this.b = false;
                    this.c = false;
                } else {
                    InputStream var8 = var2.a(string);
                    if (var8 == null) {
                        var6 = this.b(this.m);
                    } else {
                        var6 = this.b(this.a(var8));
                    }
                }

                this.e.put(string, var6);
                return (int[])var6;
            } catch (IOException var5) {
                var5.printStackTrace();
                int[] var4 = this.b(this.m);
                this.e.put(string, var4);
                return var4;
            }
        }
    }

Notice that var6 is given type I (which does not exist), but is cast to int[] before being returned by the method.

@jaskarth jaskarth added Type: Bug Something isn't working Priority: High High priority Subsystem: Variables Anything concerning variables, types, assignments, and casting labels Feb 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: High High priority Subsystem: Variables Anything concerning variables, types, assignments, and casting Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants