From b61401f61ddb9dbc63a756da26ca65b6e5e692fd Mon Sep 17 00:00:00 2001 From: nbauma109 Date: Mon, 14 Feb 2022 22:29:31 +0100 Subject: [PATCH 1/5] Create fork-sync.yml --- .github/workflows/fork-sync.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/fork-sync.yml diff --git a/.github/workflows/fork-sync.yml b/.github/workflows/fork-sync.yml new file mode 100644 index 00000000..ed8d4c86 --- /dev/null +++ b/.github/workflows/fork-sync.yml @@ -0,0 +1,18 @@ +name: Sync Fork + +on: + schedule: + - cron: '*/30 * * * *' # every 30 minutes + workflow_dispatch: # on button click + +jobs: + sync: + + runs-on: ubuntu-latest + + steps: + - uses: tgymnich/fork-sync@v1.4 + with: + owner: mstrobel + base: develop + head: develop From d52e076cb1fef1bd64c05caf76faecf97d9330b9 Mon Sep 17 00:00:00 2001 From: nbauma109 Date: Tue, 15 Feb 2022 07:09:16 +0100 Subject: [PATCH 2/5] Update fork-sync.yml --- .github/workflows/fork-sync.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/fork-sync.yml b/.github/workflows/fork-sync.yml index ed8d4c86..c3efb312 100644 --- a/.github/workflows/fork-sync.yml +++ b/.github/workflows/fork-sync.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: tgymnich/fork-sync@v1.4 + - uses: tgymnich/fork-sync@v1.6.3 with: owner: mstrobel base: develop From e8a4d90dbf8d87cccf0af6fb6587f628a66209f4 Mon Sep 17 00:00:00 2001 From: nbauma109 Date: Sat, 19 Mar 2022 11:56:02 +0100 Subject: [PATCH 3/5] try/catch formatting --- .../decompiler/languages/java/JavaOutputVisitor.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Procyon.CompilerTools/src/main/java/com/strobel/decompiler/languages/java/JavaOutputVisitor.java b/Procyon.CompilerTools/src/main/java/com/strobel/decompiler/languages/java/JavaOutputVisitor.java index 90cb2546..a36a2af2 100644 --- a/Procyon.CompilerTools/src/main/java/com/strobel/decompiler/languages/java/JavaOutputVisitor.java +++ b/Procyon.CompilerTools/src/main/java/com/strobel/decompiler/languages/java/JavaOutputVisitor.java @@ -958,10 +958,19 @@ else if (parent instanceof WhileStatement) { closeBrace(style); } - if (!(parent instanceof Expression || parent instanceof DoWhileStatement)) { + if (!(parent instanceof Expression || parent instanceof DoWhileStatement || parent instanceof TryCatchStatement || parent instanceof CatchClause)) { newLine(); } + if (parent instanceof TryCatchStatement || parent instanceof CatchClause) { + if (node.getRole() == TryCatchStatement.FINALLY_BLOCK_ROLE) { + newLine(); + } else { + space(); + } + } + + endNode(node); return null; From 5961f420d02ac9ebde349d6f76f18b01e707284a Mon Sep 17 00:00:00 2001 From: nbauma109 Date: Sat, 19 Mar 2022 22:39:22 +0100 Subject: [PATCH 4/5] try/catch/finally and if/else formatting policy --- .../languages/java/JavaOutputVisitor.java | 32 ++++++++++++------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/Procyon.CompilerTools/src/main/java/com/strobel/decompiler/languages/java/JavaOutputVisitor.java b/Procyon.CompilerTools/src/main/java/com/strobel/decompiler/languages/java/JavaOutputVisitor.java index a36a2af2..df324d2c 100644 --- a/Procyon.CompilerTools/src/main/java/com/strobel/decompiler/languages/java/JavaOutputVisitor.java +++ b/Procyon.CompilerTools/src/main/java/com/strobel/decompiler/languages/java/JavaOutputVisitor.java @@ -19,7 +19,6 @@ import com.strobel.assembler.ir.attributes.AttributeNames; import com.strobel.assembler.ir.attributes.LineNumberTableAttribute; import com.strobel.assembler.ir.attributes.ModuleAttribute; -import com.strobel.assembler.ir.attributes.PermittedSubclassesAttribute; import com.strobel.assembler.ir.attributes.SourceAttribute; import com.strobel.assembler.metadata.*; import com.strobel.core.ArrayUtilities; @@ -958,19 +957,30 @@ else if (parent instanceof WhileStatement) { closeBrace(style); } - if (!(parent instanceof Expression || parent instanceof DoWhileStatement || parent instanceof TryCatchStatement || parent instanceof CatchClause)) { - newLine(); - } - - if (parent instanceof TryCatchStatement || parent instanceof CatchClause) { - if (node.getRole() == TryCatchStatement.FINALLY_BLOCK_ROLE) { - newLine(); + if (!(parent instanceof Expression || parent instanceof DoWhileStatement)) { + if (parent.getNextSibling() != null && parent.getNextSibling().getRole() == TryCatchStatement.FINALLY_BLOCK_ROLE) { + if (policy.PlaceFinallyOnNewLine) { + newLine(); + } else { + space(); + } + } else if (parent.getNextSibling() instanceof CatchClause || (parent instanceof TryCatchStatement && node.getNextSibling() instanceof CatchClause)) { + if (policy.PlaceCatchOnNewLine) { + newLine(); + } else { + space(); + } + } else if (parent instanceof IfElseStatement && node.getRole() == IfElseStatement.TRUE_ROLE && node != parent.getLastChild()) { + if (policy.PlaceElseOnNewLine) { + newLine(); + } else { + space(); + } } else { - space(); + newLine(); } } - endNode(node); return null; @@ -2704,7 +2714,7 @@ public Void visitArrayCreationExpression(final ArrayCreationExpression node, fin boolean needType = true; - //noinspection RedundantIfStatement + // noinspection RedundantIfStatement if (node.getDimensions().isEmpty() && node.getType() != null && (node.getParent() instanceof ArrayInitializerExpression || From 8f1471afde13f1e410c916770f490a38ca60ec37 Mon Sep 17 00:00:00 2001 From: nbauma109 Date: Fri, 25 Mar 2022 17:21:05 +0100 Subject: [PATCH 5/5] format try/finally --- .../strobel/decompiler/languages/java/JavaOutputVisitor.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Procyon.CompilerTools/src/main/java/com/strobel/decompiler/languages/java/JavaOutputVisitor.java b/Procyon.CompilerTools/src/main/java/com/strobel/decompiler/languages/java/JavaOutputVisitor.java index df324d2c..bc650909 100644 --- a/Procyon.CompilerTools/src/main/java/com/strobel/decompiler/languages/java/JavaOutputVisitor.java +++ b/Procyon.CompilerTools/src/main/java/com/strobel/decompiler/languages/java/JavaOutputVisitor.java @@ -958,7 +958,7 @@ else if (parent instanceof WhileStatement) { } if (!(parent instanceof Expression || parent instanceof DoWhileStatement)) { - if (parent.getNextSibling() != null && parent.getNextSibling().getRole() == TryCatchStatement.FINALLY_BLOCK_ROLE) { + if ((parent.getNextSibling() != null && parent.getNextSibling().getRole() == TryCatchStatement.FINALLY_BLOCK_ROLE) || (node.getRole() == TryCatchStatement.TRY_BLOCK_ROLE && node.getNextSibling().getRole() == TryCatchStatement.FINALLY_BLOCK_ROLE)) { if (policy.PlaceFinallyOnNewLine) { newLine(); } else { @@ -970,7 +970,7 @@ else if (parent instanceof WhileStatement) { } else { space(); } - } else if (parent instanceof IfElseStatement && node.getRole() == IfElseStatement.TRUE_ROLE && node != parent.getLastChild()) { + } else if (parent instanceof IfElseStatement && node.getRole() == IfElseStatement.TRUE_ROLE && node != parent.getLastChild()) { if (policy.PlaceElseOnNewLine) { newLine(); } else {