MinecraftForge / SrgUtils

A library for working with SRG, and other mapping variants.
GNU Lesser General Public License v2.1
12 stars 16 forks source link

Tiny v2 reader crashes when encountering local variable comment #21

Closed NebelNidas closed 2 months ago

NebelNidas commented 2 months ago

A file like this:

tiny    2   0   source  target
c   class_1 class1Ns0Rename
    m   ()I method_1    method1Ns0Rename
        v   1   1   1   var_1   var1Ns0Rename
            c   var1Comment

Leads to the following crash:

java.util.NoSuchElementException
    at java.base/java.util.ArrayDeque.removeFirst(ArrayDeque.java:361)
    at java.base/java.util.ArrayDeque.pop(ArrayDeque.java:592)
    at net.minecraftforge.srgutils.InternalUtils.loadTinyV2(InternalUtils.java:446)

Since the Tiny v2 reader doesn't handle variable mappings at all. The relevant spec is here by the way: https://fabricmc.net/wiki/documentation:tiny2

LexManos commented 2 months ago

Your example case does not produce the error in which you say. Also fun, they made another 'spec' without updating the original or bumping the version number. But hey at least they have something 'official' now.

NebelNidas commented 2 months ago

Oops, you're right, it's not the variable mapping itself, but an attached comment which lead to the crash. I've adjusted my example above.

Regarding the spec, it's actually a 1:1 copy of the original GitHub issue, just with prettier formatting and better wording in some areas. Content-wise it's the same.

LexManos commented 2 months ago

Humm guess you're right, its just a pain to read, and would of been nice to point the only 'official' spec to the new 'official' spec.