cfr
cfr copied to clipboard
Try catch block with handler as start is decompiled wrongly
CFR version
Description
TryCatch: L3 to L4 handled by L3: java/lang/NullPointerException
L1 {
aconst_null
}
L3 {
f_new (Locals[1]: [Ljava/lang/String;) (Stack[1]: java/lang/NullPointerException)
getstatic java/lang/System.out:java.io.PrintStream
swap
invokevirtual java/lang/Object.getClass()Ljava/lang/Class;
invokevirtual java/lang/Class.getName()Ljava/lang/String;
invokevirtual java/io/PrintStream.println(Ljava/lang/String;)V
}
L4 {
return
}
is decompiled as
/*
* WARNING - Removed try catching itself - possible behaviour change.
*/
public static void main(String[] args) {
System.out.println(((Object)null).getClass().getName());
}
the output of the real program is this:
C:\Users\Admin\Desktop>java -cp . TryCatchLoop
java.lang.NullPointerException
Possible way of decompilation:
public static void main(String[] a) {
Object o = null;
while(true) {
try {
System.out.println(o.getClass().getName());
return;
} catch(NullPointerException e) {
o = e;
}
}
}