From 975d5357e696cd85b4b111dce2249b3e4282b601 Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Sun, 14 May 2023 22:14:15 +0200 Subject: [PATCH 1/5] Enable SimplifyBooleanReturn --- rewrite.yml | 2 +- .../jabref/gui/openoffice/ManageCitationsDialogView.java | 5 +---- .../java/org/jabref/logic/formatter/casechanger/Word.java | 6 +----- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/rewrite.yml b/rewrite.yml index 155ca0a12cd..403f341b996 100644 --- a/rewrite.yml +++ b/rewrite.yml @@ -157,7 +157,7 @@ recipeList: - org.openrewrite.java.cleanup.ReplaceRedundantFormatWithPrintf # - org.openrewrite.java.cleanup.ShortenFullyQualifiedTypeReferences - org.openrewrite.java.cleanup.SimplifyBooleanExpression -# - org.openrewrite.java.cleanup.SimplifyBooleanReturn + - org.openrewrite.java.cleanup.SimplifyBooleanReturn # - org.openrewrite.java.cleanup.SimplifyConsecutiveAssignments # - org.openrewrite.java.cleanup.SimplifyCompoundStatement - org.openrewrite.java.cleanup.SimplifyDurationCreationUnits diff --git a/src/main/java/org/jabref/gui/openoffice/ManageCitationsDialogView.java b/src/main/java/org/jabref/gui/openoffice/ManageCitationsDialogView.java index 15bc0def40a..8bd15296863 100644 --- a/src/main/java/org/jabref/gui/openoffice/ManageCitationsDialogView.java +++ b/src/main/java/org/jabref/gui/openoffice/ManageCitationsDialogView.java @@ -84,9 +84,6 @@ private Node getText(String citationContext) { } public boolean isOkToShowThisDialog() { - if (viewModel == null || viewModel.failedToGetCitationEntries) { - return false; - } - return true; + return (viewModel != null && !viewModel.failedToGetCitationEntries); } } diff --git a/src/main/java/org/jabref/logic/formatter/casechanger/Word.java b/src/main/java/org/jabref/logic/formatter/casechanger/Word.java index 5c777df9a00..79a78ddeacb 100644 --- a/src/main/java/org/jabref/logic/formatter/casechanger/Word.java +++ b/src/main/java/org/jabref/logic/formatter/casechanger/Word.java @@ -128,11 +128,7 @@ private boolean isConjunction(char[] chars, int i) { word += chars[i]; i++; } - if (CONJUNCTIONS.contains(word)) { - return false; - } else { - return true; - } + return !(CONJUNCTIONS.contains(word)); } public void stripConsonants() { From 10d2b235c41dc571e158f368187febe0236e0472 Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Sun, 14 May 2023 23:22:22 +0200 Subject: [PATCH 2/5] Add forgotten braces --- .../org/jabref/gui/openoffice/ManageCitationsDialogView.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/jabref/gui/openoffice/ManageCitationsDialogView.java b/src/main/java/org/jabref/gui/openoffice/ManageCitationsDialogView.java index 8bd15296863..d3f7e788fa6 100644 --- a/src/main/java/org/jabref/gui/openoffice/ManageCitationsDialogView.java +++ b/src/main/java/org/jabref/gui/openoffice/ManageCitationsDialogView.java @@ -84,6 +84,6 @@ private Node getText(String citationContext) { } public boolean isOkToShowThisDialog() { - return (viewModel != null && !viewModel.failedToGetCitationEntries); + return ((viewModel != null) && (!viewModel.failedToGetCitationEntries)); } } From e6f9f19297363a4d74daecb60fbc3f1aad85f35d Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Sun, 14 May 2023 23:38:19 +0200 Subject: [PATCH 3/5] Last try? :p --- .../org/jabref/gui/openoffice/ManageCitationsDialogView.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/jabref/gui/openoffice/ManageCitationsDialogView.java b/src/main/java/org/jabref/gui/openoffice/ManageCitationsDialogView.java index d3f7e788fa6..15d99233ea5 100644 --- a/src/main/java/org/jabref/gui/openoffice/ManageCitationsDialogView.java +++ b/src/main/java/org/jabref/gui/openoffice/ManageCitationsDialogView.java @@ -84,6 +84,6 @@ private Node getText(String citationContext) { } public boolean isOkToShowThisDialog() { - return ((viewModel != null) && (!viewModel.failedToGetCitationEntries)); + return (viewModel != null) && (!viewModel.failedToGetCitationEntries); } } From d51bf2a1149376fad83ccd5ff5931c750a75fcf7 Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Sun, 14 May 2023 23:42:21 +0200 Subject: [PATCH 4/5] Update src/main/java/org/jabref/gui/openoffice/ManageCitationsDialogView.java Co-authored-by: Christoph --- .../org/jabref/gui/openoffice/ManageCitationsDialogView.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/jabref/gui/openoffice/ManageCitationsDialogView.java b/src/main/java/org/jabref/gui/openoffice/ManageCitationsDialogView.java index 15d99233ea5..986c971c9d0 100644 --- a/src/main/java/org/jabref/gui/openoffice/ManageCitationsDialogView.java +++ b/src/main/java/org/jabref/gui/openoffice/ManageCitationsDialogView.java @@ -84,6 +84,6 @@ private Node getText(String citationContext) { } public boolean isOkToShowThisDialog() { - return (viewModel != null) && (!viewModel.failedToGetCitationEntries); + return viewModel != null && !viewModel.failedToGetCitationEntries; } } From 96f3a01264ef72a440e1c4d710090189564b6ced Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Sun, 14 May 2023 23:52:58 +0200 Subject: [PATCH 5/5] Remove braces --- src/main/java/org/jabref/logic/formatter/casechanger/Word.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/jabref/logic/formatter/casechanger/Word.java b/src/main/java/org/jabref/logic/formatter/casechanger/Word.java index 79a78ddeacb..d6cee8237b0 100644 --- a/src/main/java/org/jabref/logic/formatter/casechanger/Word.java +++ b/src/main/java/org/jabref/logic/formatter/casechanger/Word.java @@ -128,7 +128,7 @@ private boolean isConjunction(char[] chars, int i) { word += chars[i]; i++; } - return !(CONJUNCTIONS.contains(word)); + return !CONJUNCTIONS.contains(word); } public void stripConsonants() {