Skip to content

Null-detail messages are not deobfuscated #41

Description

@quat1024

Java calls them the "extended message", the JEP calls them "null-detail messages" - whatever they're called, those handy NullPointerException "Cannot invoke (something) because the return value of (cause) is null", "Cannot read field (something) because (cause) is null" messages were introduced in Java 14, and unfortunately if a Minecraft class or method appears in the null-detail message, it is not deobfuscated.

I don't know if this is possible to fix (NEC doesn't seem to touch the original Throwable's message, and Java doesn't provide any sort of API to introspect the message other than trying to parse the string), but it would be nice to have.

Here is an example crash from a user: VazkiiMods/Botania#4027

java.lang.NullPointerException: Cannot invoke "net.minecraft.class_1792.method_40131()" because the return value of "net.minecraft.class_1799.method_7909()" is null
    at Not Enough Crashes deobfuscated stack trace.(1.18.2+build.2) ~[?:?]
    at net.minecraft.item.ItemStack.isIn(ItemStack:230) ~[?:?]
    at vazkii.botania.common.item.equipment.bauble.ItemMonocle.lambda$hasMonocle$2(ItemMonocle.java:102) ~[Botania-1.18.2-431-FABRIC.jar:?]
...

Deobfuscated, this would read

Cannot invoke "net.minecraft.item.ItemStack.isIn()" because the return value of "net.minecraft.item.ItemStack.getItem()" is null
                                                                                 ^^^^^^^^^^^^^ this part ^^^^^^^^^^^^^^

The class/method that can't be invoked (isIn) can be read off the first line of the deobfuscated stacktrace, but the cause (getItem) does not appear anywhere in the deobfuscated stacktrace and has to be manually looked up.

Again, it's not the end of the world, it'd be a small convenience though. If the Throwable's message can't be changed, maybe it'd be nice to mention by the Not Enough Crashes deobfuscated stacktrace watermark, or something like that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions