skylot / jadx

Dex to Java decompiler
Apache License 2.0
41.96k stars 4.9k forks source link

give ability to plugins to edit blocks before locking #2336

Closed eybisi closed 3 weeks ago

eybisi commented 3 weeks ago

Plugins can use .before('BlockFinisher') to edit blocks before they are locked.

Description

If any plugin wants to edit control flow graph after BlockProcessor, blocks are locked. This PR moves mth.finishBasicBlocks(); line to another visitor called BlockFinisher. So plugins can use .before('BlockFinisher') to edit blocks before they are locked.

BlockProcessor adds many informations to methodnode, loops, dominators etc.. These are very useful for tracing control flow and editing (for example removing control flow flattening) Fixes : https://github.com/skylot/jadx/issues/2335