You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2021/04/12 09:23:37 UTC

[groovy] 20/25: GROOVY-9649: Sonar refactoring

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 7dac3e7aea61a24922b6c44b17e7897c47be996c
Author: Esko Toivonen <es...@tuni.fi>
AuthorDate: Fri Apr 9 12:16:18 2021 +0300

    GROOVY-9649: Sonar refactoring
    
    Avoid NPE by not using a Boolean as an expression
---
 .../org/codehaus/groovy/runtime/DefaultGroovyMethodsSupport.java  | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethodsSupport.java b/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethodsSupport.java
index 14f2b9d..0becd0a 100644
--- a/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethodsSupport.java
+++ b/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethodsSupport.java
@@ -108,17 +108,17 @@ public class DefaultGroovyMethodsSupport {
 
         // Undo inclusiveness effects done by subListBorders()
         if (!info.reverse) {
-            if (!range.getInclusiveLeft()) {
+            if (Boolean.FALSE.equals(range.getInclusiveLeft())) {
                 from--;
             }
-            if (!range.getInclusiveRight()) {
+            if (Boolean.FALSE.equals(range.getInclusiveRight())) {
                 to++;
             }
         } else {
-            if (!range.getInclusiveLeft()) {
+            if (Boolean.FALSE.equals(range.getInclusiveLeft())) {
                 to++;
             }
-            if (!range.getInclusiveRight()) {
+            if (Boolean.FALSE.equals(range.getInclusiveRight())) {
                 from--;
             }
         }