skylot / jadx

Dex to Java decompiler
Apache License 2.0
41.91k stars 4.89k forks source link

fix(core): fix primitive-to-primitive conversions #2326

Closed pubiqq closed 4 weeks ago

pubiqq commented 4 weeks ago

The PR fixes incorrect primitive-to-primitive conversions:

Fixes https://github.com/skylot/jadx/issues/1620, fixes https://github.com/skylot/jadx/issues/1621, fixes https://github.com/skylot/jadx/issues/1626, indirectly fixes JadxRuntimeException: Unknown type in literalToString: void.

skylot commented 4 weeks ago

@pubiqq please describe what compare got changed/improved, because it is hard to see what was wrong only from changes. Also, please provide decompilation tests or at least samples which are improved after this change.

skylot commented 4 weeks ago

Thanks. I see, so these issues was in incorrect cast removal because of incorrect type compare for long and float. Looks like this happen because type inference never compare these types (2 register types not clash with 1 register types), and that was the only usage of that compare for a long time, cast check was added later.

pubiqq commented 4 weeks ago

The issue is not related to long and float only, but anyway, it's fixed now.