ForgeFlower icon indicating copy to clipboard operation
ForgeFlower copied to clipboard

Misuse of debug names when debug names are disable

Open phase opened this issue 5 years ago • 1 comments

When running ForgeFlower with -udv=0, debug names are showing up in the output. Here are the options I'm running with:

"-din=1", "-rbr=0", "-dgs=1", "-asc=1", "-hdc=0", "-rsy=1", "-iec=1", "-udv=0", "-jvn=1", "-log=WARN"

Here's a diff from vanilla FernFlower (build from a few days ago) and ForgeFlower 1.5.478.6 (06/13/20 10:44 PM):

@@ -96,17 +95,17 @@
    private final BiomeManager biomeManager;
    private final ResourceKey<Level> dimension;
    private final ResourceKey<DimensionType> dimensionTypeKey;
 
    protected Level(WritableLevelData var1, ResourceKey<Level> var2, ResourceKey<DimensionType> var3, DimensionType var4, Supplier<ProfilerFiller> var5, boolean var6, boolean var7, long var8) {
-      this.profiler = var5;
-      this.levelData = var1;
-      this.dimensionType = var4;
-      this.dimension = var2;
-      this.dimensionTypeKey = var3;
-      this.isClientSide = var6;
-      if (var4.shrunk()) {
+      this.profiler = ☃;
+      this.levelData = ☃;
+      this.dimensionType = ☃;
+      this.dimension = ☃;
+      this.dimensionTypeKey = ☃;
+      this.isClientSide = ☃;
+      if (☃.shrunk()) {
          this.worldBorder = new WorldBorder() {
             public double getCenterX() {
                return super.getCenterX() / 8.0D;
             }

full diff of Level This happens in every class

phase avatar Jun 15 '20 02:06 phase

I spent a good while trying to find the cause of this bug, and I finally found it. In patch 0010, there is a call to the getName method of the local variable which gets the name from the debug information without checking if the udv option is disabled, nor if it is even a valid identifier. I could PR a fix for this if you guys want, but I wasn't able to get the bytecode version in this context so I had to pass 0 to the last param of TextUtil.isValidIdentifier, not great, someone else can probably find a better solution there.

Alvinn8 avatar Jun 28 '21 19:06 Alvinn8