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

InitializerProcessor NPE #400

Closed
InventivetalentDev opened this issue May 22, 2024 · 9 comments
Closed

InitializerProcessor NPE #400

InventivetalentDev opened this issue May 22, 2024 · 9 comments
Labels
bug Something isn't working Priority: Medium Medium priority Subsystem: Writing Anything concerning how expressions are written

Comments

@InventivetalentDev
Copy link

InventivetalentDev commented May 22, 2024

Vineflower version

1.10.0/1.10.1/1.11.0

Describe the bug

Failing to properly decompile most classes of the latest MC snapshots 24w21a and 24w21b.
Worked without issues on 24w20a.

Most classes just contain that stacktrace, but a couple start with properly decompiled code and then fail halfway through.

Additional information

(same stacktrace for all failed classes as far as I can tell)

// $VF: Couldn't be decompiled
// Please report this to the Vineflower issue tracker, at https://github.com/Vineflower/vineflower/issues with a copy of the class file (if you have the rights to distribute it!)
// java.lang.NullPointerException: Cannot invoke "String.equals(Object)" because "varName" is null
//   at org.jetbrains.java.decompiler.main.InitializerProcessor.isExprentIndependent(InitializerProcessor.java:423)
//   at org.jetbrains.java.decompiler.main.InitializerProcessor.extractDynamicInitializers(InitializerProcessor.java:335)
//   at org.jetbrains.java.decompiler.main.InitializerProcessor.extractInitializers(InitializerProcessor.java:44)
//   at org.jetbrains.java.decompiler.main.ClassWriter.invokeProcessors(ClassWriter.java:97)
//   at org.jetbrains.java.decompiler.main.ClassWriter.writeClass(ClassWriter.java:348)
//   at org.jetbrains.java.decompiler.main.ClassesProcessor.writeClass(ClassesProcessor.java:474)
//   at org.jetbrains.java.decompiler.main.Fernflower.getClassContent(Fernflower.java:191)
//   at org.jetbrains.java.decompiler.struct.ContextUnit.lambda$save$3(ContextUnit.java:187)
WARN:  Class BookSlotModelCacheKey couldn't be written.
java.lang.NullPointerException: Cannot invoke "String.equals(Object)" because "varName" is null
        at org.jetbrains.java.decompiler.main.InitializerProcessor.isExprentIndependent(InitializerProcessor.java:423)
        at org.jetbrains.java.decompiler.main.InitializerProcessor.extractDynamicInitializers(InitializerProcessor.java:335)
        at org.jetbrains.java.decompiler.main.InitializerProcessor.extractInitializers(InitializerProcessor.java:44)
        at org.jetbrains.java.decompiler.main.ClassWriter.invokeProcessors(ClassWriter.java:97)
        at org.jetbrains.java.decompiler.main.ClassWriter.writeClass(ClassWriter.java:348)
        at org.jetbrains.java.decompiler.main.ClassWriter.writeClass(ClassWriter.java:492)
        at org.jetbrains.java.decompiler.main.ClassesProcessor.writeClass(ClassesProcessor.java:474)
        at org.jetbrains.java.decompiler.main.Fernflower.getClassContent(Fernflower.java:191)
        at org.jetbrains.java.decompiler.struct.ContextUnit.lambda$save$3(ContextUnit.java:187)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
        at java.base/java.lang.Thread.run(Thread.java:1570)
@InventivetalentDev InventivetalentDev added the bug Something isn't working label May 22, 2024
@MiniDigger
Copy link
Contributor

Working fine here on some slightly outdated 1.11 snapshot, consider trying 1.10.1 too

@InventivetalentDev
Copy link
Author

@MiniDigger I tried again with 1.10.1 and 1.11.0 and I'm getting the same exception 🤔

// $VF: Couldn't be decompiled
// Please report this to the Vineflower issue tracker, at https://github.com/Vineflower/vineflower/issues with a copy of the class file (if you have the rights to distribute it!)
// java.lang.NullPointerException: Cannot invoke "String.equals(Object)" because "varName" is null
//   at org.jetbrains.java.decompiler.main.InitializerProcessor.isExprentIndependent(InitializerProcessor.java:423)
//   at org.jetbrains.java.decompiler.main.InitializerProcessor.extractDynamicInitializers(InitializerProcessor.java:335)
//   at org.jetbrains.java.decompiler.main.InitializerProcessor.extractInitializers(InitializerProcessor.java:44)
//   at org.jetbrains.java.decompiler.main.ClassWriter.invokeProcessors(ClassWriter.java:98)
//   at org.jetbrains.java.decompiler.main.ClassWriter.writeClass(ClassWriter.java:352)
//   at org.jetbrains.java.decompiler.main.ClassesProcessor.writeClass(ClassesProcessor.java:485)
//   at org.jetbrains.java.decompiler.main.Fernflower.getClassContent(Fernflower.java:191)
//   at org.jetbrains.java.decompiler.struct.ContextUnit.lambda$save$3(ContextUnit.java:192)

@MiniDigger
Copy link
Contributor

what arguments do you use?
for reference, we use: https://github.com/PaperMC/sculptor/blob/main/sculptor-shared/src/main/kotlin/io/papermc/sculptor/shared/MacheExtension.kt#L71 on 1.11.0-20240522.034251-27 for 24w21b right now and it decompiler properly both locally and in CI

@jaskarth jaskarth added Subsystem: Writing Anything concerning how expressions are written Priority: Medium Medium priority labels May 22, 2024
@InventivetalentDev
Copy link
Author

@InventivetalentDev
Copy link
Author

I got things working with sculptor/mache, so I guess there's something weird in my setup that suddenly broke with the new snapshots

@MiniDigger
Copy link
Contributor

worth noting is that mache/sculptor has a preprocessor step using codebook, maybe that is fixing it for us, I think neoforge also does some preprocessing.
didnt have time to test using a vanilla jar yet.

@mat-1
Copy link

mat-1 commented Jul 2, 2024

I have the same issue. Adding a varName == null || to the line where it's erroring appears to fix it, but this probably isn't the best solution.

@jaskarth
Copy link
Member

Yeah, it's possible for the method to return null but there's no null check. I think that's an error, we should really be adding the null check.

@jaskarth
Copy link
Member

Fixed in 7d12f99. Thanks for the report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Priority: Medium Medium priority Subsystem: Writing Anything concerning how expressions are written
Projects
None yet
Development

No branches or pull requests

4 participants