You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2020/04/19 03:54:24 UTC

[groovy] branch master updated: Revert "Trivial refactoring: Remove redundant type casting"

This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/master by this push:
     new 9efa404  Revert "Trivial refactoring: Remove redundant type casting"
9efa404 is described below

commit 9efa4040327b159578268de1705d9cc28ba678cd
Author: Daniel Sun <su...@apache.org>
AuthorDate: Sun Apr 19 11:54:12 2020 +0800

    Revert "Trivial refactoring: Remove redundant type casting"
    
    We will get an integer without type casting
---
 src/main/java/org/codehaus/groovy/runtime/InvokerHelper.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/codehaus/groovy/runtime/InvokerHelper.java b/src/main/java/org/codehaus/groovy/runtime/InvokerHelper.java
index 81c9cd5..64aedd0 100644
--- a/src/main/java/org/codehaus/groovy/runtime/InvokerHelper.java
+++ b/src/main/java/org/codehaus/groovy/runtime/InvokerHelper.java
@@ -287,11 +287,11 @@ public class InvokerHelper {
         }
         if (value instanceof Short) {
             Short number = (Short) value;
-            return -number;
+            return (short) -number;
         }
         if (value instanceof Byte) {
             Byte number = (Byte) value;
-            return -number;
+            return (byte) -number;
         }
         if (value instanceof ArrayList) {
             // value is a list.