Recaf
Recaf copied to clipboard
4x assembler failing on javac bytecode
Description
I opened the assembler on a method that contains what seems to be a finally block, a lot of uninitialized var errors pop up.
To Reproduce
Steps to reproduce the behavior:
- This was the jar
- At com/strobel/core/ExceptionUtilities in method getStackTraceString(Ljava/lang/Throwable;)Ljava/lang/String;
- Open the assembler and the errors are there
Exception
If applicable, add the exception/stacktrace.
stacktrace goes here
Screenshots
full code:
.method public static getStackTraceString (Ljava/lang/Throwable;)Ljava/lang/String; {
parameters: { t },
exceptions: { { K, L, M, Ljava/lang/Throwable; }, { P, Q, R, Ljava/lang/Throwable; }, { F, J, U, Ljava/lang/Throwable; }, { F, J, V, * }, { X, Y, Z, Ljava/lang/Throwable; }, { U, W, V, * }, { D, O, AC, Ljava/lang/Throwable; }, { U, AC, AC, Ljava/lang/Throwable; }, { D, O, AD, * }, { AF, AG, AH, Ljava/lang/Throwable; }, { U, AE, AD, * }, { B, T, AK, Ljava/lang/Throwable; }, { U, AK, AK, Ljava/lang/Throwable; } },
code: {
A:
line 66
aload t
ldc "t"
invokestatic com/strobel/core/VerifyArgument.notNull (Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;
pop
B:
line 68
new java/io/ByteArrayOutputStream
dup
sipush 1024
invokespecial java/io/ByteArrayOutputStream.<init> (I)V
astore stream
C:
aconst_null
astore v2
D:
line 69
new java/io/PrintWriter
dup
aload stream
invokespecial java/io/PrintWriter.<init> (Ljava/io/OutputStream;)V
astore writer
E:
line 68
aconst_null
astore v4
F:
line 71
aload t
aload writer
invokevirtual java/lang/Throwable.printStackTrace (Ljava/io/PrintWriter;)V
G:
line 73
aload writer
invokevirtual java/io/PrintWriter.flush ()V
H:
line 74
aload stream
invokevirtual java/io/ByteArrayOutputStream.flush ()V
I:
line 76
aload stream
invokevirtual java/io/ByteArrayOutputStream.toString ()Ljava/lang/String;
invokestatic com/strobel/core/StringUtilities.trimRight (Ljava/lang/String;)Ljava/lang/String;
astore v5
J:
line 77
aload writer
ifnull O
aload v4
ifnull N
K:
aload writer
invokevirtual java/io/PrintWriter.close ()V
L:
goto O
M:
astore v6
aload v4
aload v6
invokevirtual java/lang/Throwable.addSuppressed (Ljava/lang/Throwable;)V
goto O
N:
aload writer
invokevirtual java/io/PrintWriter.close ()V
O:
aload stream
ifnull T
aload v2
ifnull S
P:
aload stream
invokevirtual java/io/ByteArrayOutputStream.close ()V
Q:
goto T
R:
astore v6
aload v2
aload v6
invokevirtual java/lang/Throwable.addSuppressed (Ljava/lang/Throwable;)V
goto T
S:
aload stream
invokevirtual java/io/ByteArrayOutputStream.close ()V
T:
line 76
aload v5
areturn
U:
line 68
astore v5
aload v5
astore v4
aload v5
athrow
V:
line 77
astore v7
W:
aload writer
ifnull AB
aload v4
ifnull AA
X:
aload writer
invokevirtual java/io/PrintWriter.close ()V
Y:
goto AB
Z:
astore v8
aload v4
aload v8
invokevirtual java/lang/Throwable.addSuppressed (Ljava/lang/Throwable;)V
goto AB
AA:
aload writer
invokevirtual java/io/PrintWriter.close ()V
AB:
aload v7
athrow
AC:
line 68
astore v3
aload v3
astore v2
aload v3
athrow
AD:
line 77
astore v9
AE:
aload stream
ifnull AJ
aload v2
ifnull AI
AF:
aload stream
invokevirtual java/io/ByteArrayOutputStream.close ()V
AG:
goto AJ
AH:
astore v10
aload v2
aload v10
invokevirtual java/lang/Throwable.addSuppressed (Ljava/lang/Throwable;)V
goto AJ
AI:
aload stream
invokevirtual java/io/ByteArrayOutputStream.close ()V
AJ:
aload v9
athrow
AK:
line 78
astore ignored
AL:
line 79
aload t
invokevirtual java/lang/Throwable.toString ()Ljava/lang/String;
areturn
AM:
}
}
Looks like scoping problems with the catch block handling and how we propagate (or don't in this case) variables into them.
Yeah, make it be a warning instead of an error, asm has no trouble computing the frames
Addressed with 81e49e6363dac1e24a0f34ae74d16873650263da