Skip to content

I20210516-0600

tagged this 15 May 13:15
Moves an inner if condition around the outer if condition:
 - The inner if condition should be common to both if/else clauses of
the outer if statement,
 - The if conditions should be passive.

Given:
        if (b1) {
            if (b2) {
                System.out.println("foo");
            }
        } else {
            if (b2) {
                System.out.println("bar");
            }
        }

When:
Applying "Pull out a duplicate 'if' from an if/else" clean up...

Then:
        if (b2) {
            if (b1) {
                System.out.println("foo");
            } else {
                System.out.println("bar");
            }
        }

Change-Id: I2908d6433760691b61d227804c7854044c4851c2
Signed-off-by: Fabrice Tiercelin <fabrice.tiercelin@yahoo.fr>
Reviewed-on: https://git.eclipse.org/r/c/jdt/eclipse.jdt.ui/+/180171
Reviewed-by: Carsten Hammer <carsten.hammer@t-online.de>
Tested-by: JDT Bot <jdt-bot@eclipse.org>
Assets 2
Loading