Konloch / Konloch/bytecode-viewer

java.lang.NullPointerException: Cannot invoke "com.strobel.decompiler.languages.java.ast.Statement.remove()" because "initializerStatement" is null

Open
#531 2 comments 0 reactions 0 assignees View on GitHub
Bug Dependency Related Need More Information
Dominant language
Java
Stars
15.6k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

I tried decompiling a whole apk (with compile and save all classes) and all compilers, i got an output folder for proycon but only some parts of the code and i got an output folder for cfr, which is empty.

Please send this error log to https://github.com/Konloch/bytecode-viewer/issues or Konloch at https://the.bytecode.club or konloch@gmail.com
If you hold appropriate legal rights to the relevant class/jar/apk file please include that as well.
Bytecode Viewer Version: 2.12 [Fat Jar], OS: Windows 11, Java: 23.0.2

java.lang.NullPointerException: Cannot invoke "com.strobel.decompiler.languages.java.ast.Statement.remove()" because "initializerStatement" is null
at com.strobel.decompiler.languages.java.ast.transforms.EnumRewriterTransform$Visitor.rewrite(EnumRewriterTransform.java:342)
at com.strobel.decompiler.languages.java.ast.transforms.EnumRewriterTransform$Visitor.visitTypeDeclarationOverride(EnumRewriterTransform.java:77)
at com.strobel.decompiler.languages.java.ast.transforms.EnumRewriterTransform$Visitor.visitTypeDeclarationOverride(EnumRewriterTransform.java:46)
at com.strobel.decompiler.languages.java.ast.ContextTrackingVisitor.visitTypeDeclaration(ContextTrackingVisitor.java:60)
at com.strobel.decompiler.languages.java.ast.ContextTrackingVisitor.visitTypeDeclaration(ContextTrackingVisitor.java:31)
at com.strobel.decompiler.languages.java.ast.TypeDeclaration.acceptVisitor(TypeDeclaration.java:98)
at com.strobel.decompiler.languages.java.ast.DepthFirstAstVisitor.visitChildren(DepthFirstAstVisitor.java:41)
at com.strobel.decompiler.languages.java.ast.DepthFirstAstVisitor.visitCompilationUnit(DepthFirstAstVisitor.java:274)
at com.strobel.decompiler.languages.java.ast.CompilationUnit.acceptVisitor(CompilationUnit.java:82)
at com.strobel.decompiler.languages.java.ast.transforms.EnumRewriterTransform.run(EnumRewriterTransform.java:42)
at com.strobel.decompiler.languages.java.ast.transforms.TransformationPipeline.runTransformationsUntil(TransformationPipeline.java:101)
at com.strobel.decompiler.languages.java.ast.AstBuilder.runTransformations(AstBuilder.java:122)
at com.strobel.decompiler.languages.java.JavaLanguage.runTransforms(JavaLanguage.java:97)
at com.strobel.decompiler.languages.java.JavaLanguage.buildAst(JavaLanguage.java:72)
at com.strobel.decompiler.languages.java.JavaLanguage.decompileType(JavaLanguage.java:59)
at the.bytecode.club.bytecodeviewer.decompilers.impl.ProcyonDecompiler.doSaveJarDecompiled(ProcyonDecompiler.java:187)
at the.bytecode.club.bytecodeviewer.decompilers.impl.ProcyonDecompiler.decompileToZip(ProcyonDecompiler.java:141)
at the.bytecode.club.bytecodeviewer.resources.ResourceDecompiling.decompileSaveAll(ResourceDecompiling.java:262)
at the.bytecode.club.bytecodeviewer.resources.ResourceDecompiling.lambda$decompileSaveAll$0(ResourceDecompiling.java:108)
at java.base/java.lang.Thread.run(Thread.java:1575)

Contributor guide

Open the contributing guide

Research direction

Start with EnumRewriterTransform.java at lines 342 and 77, then trace the Procyon save-all path through ProcyonDecompiler.java and ResourceDecompiling.java. Reproduce with the reported APK or another input that triggers the stack trace; done means whole-APK decompilation no longer crashes there and produces the expected class output.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
compilers, reverse-engineering
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.