Closed Marcono1234 closed 3 years ago
CFR suffers from this more than 'trusting' decompilers - because the whole 'I have no idea if you're a short, int, byte or bool' thing can be real fun - you're definitely right though - those cases are gross - the ternary can be useful as a fixup, but it shouldn't be applied that early......
Thanks for the excellent test set btw.
CFR version
CFR 0.151-SNAPSHOT (b79446a)
Exists in 00f0a883 as well, so was not introduced by recent changes.
Compiler
javac 11.0.5
Description
When decompiling a bitwise AND (
&
), OR (|
) or XOR (^
) whose result is cast to a smaller type (narrowing conversion), CFR emits a malformed ternary expression which tries to apply the bitwise operator with an integer variable andtrue
/false
as operands.Example
Source:
Decompiled output:
Extensive tests are provided by https://github.com/leibnitz27/cfr_tests/pull/8