This is an automated email from the ASF dual-hosted git repository. paulk pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/groovy.git
commit 8aa8cbab344362025288910d9b86cc270cbb7063 Author: Otto Vayrynen <[email protected]> AuthorDate: Fri Apr 9 12:49:37 2021 +0300 GROOVY-9649: Sonar refactoring Refactor getInclusive and toString ternary operations --- src/main/java/groovy/lang/IntRange.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/groovy/lang/IntRange.java b/src/main/java/groovy/lang/IntRange.java index aeb97fe..a605a4b 100644 --- a/src/main/java/groovy/lang/IntRange.java +++ b/src/main/java/groovy/lang/IntRange.java @@ -326,7 +326,7 @@ public class IntRange extends AbstractList<Integer> implements Range<Integer>, S * Returns the same as <code>getInclusiveRight</code>, kept here for backwards compatibility. */ public Boolean getInclusive() { - return inclusiveRight; + return getInclusiveRight(); } /** @@ -414,9 +414,11 @@ public class IntRange extends AbstractList<Integer> implements Range<Integer>, S @Override public String toString() { - return (inclusiveRight == null && inclusiveLeft == null) ? (reverse ? "" + to + ".." + from : "" + from + ".." + to) - : ("" + from + ((inclusiveLeft != null && inclusiveLeft) ? "" : "<") + ".." - + ((inclusiveRight != null && inclusiveRight) ? "" : "<") + to); + if (inclusiveRight == null && inclusiveLeft == null) { + return reverse ? "" + to + ".." + from : "" + from + ".." + to; + } + return "" + from + ((inclusiveLeft != null && inclusiveLeft) ? "" : "<") + ".." + + ((inclusiveRight != null && inclusiveRight) ? "" : "<") + to; } @Override
