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.16k stars 86 forks source link

Classes with `$` in their name may produce illegal output code #171

Open SilverAndro opened 2 years ago

SilverAndro commented 2 years ago

Due to, I believe, the usage of $ to denote inner classes, if a class is decompiled which references a class like that, without that other class being on the decompilation classpath, the output code unconditionally splits, resulting in illegal code.

I've provided some example files (apologies for the package, it was simply the dev env I had open at the time, and I wanted to submit this before sleep), comments added by me:

A.class:

import mc.itemflexer.A..B; // Illegal import

public class A {
    B b = new B(this);

    public A() {
    }
}

C.class:

import mc.itemflexer.C..2; // Illegal import + class name

public class C {
    2 b = new 2(this); // Illegal class name

    public C() {
    }
}

E.class (Same as C, but not compiled as an inner class):

import mc.itemflexer..1; // Illegal import + class name

public class E {
    1 one = new 1(); // Illegal class name

    public E() {
    }
}
SilverAndro commented 2 years ago

Whoops, forgot the files, haha IllegalDolalrSignOutput.zip