polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From paulmer...@apache.org
Subject polygene-java git commit: POLYGENE-29 Special Number handling of ScriptEngines return values
Date Mon, 10 Apr 2017 12:28:01 GMT
Repository: polygene-java
Updated Branches:
  refs/heads/develop 4f2bcc307 -> 965036e0c


POLYGENE-29 Special Number handling of ScriptEngines return values


Project: http://git-wip-us.apache.org/repos/asf/polygene-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/polygene-java/commit/965036e0
Tree: http://git-wip-us.apache.org/repos/asf/polygene-java/tree/965036e0
Diff: http://git-wip-us.apache.org/repos/asf/polygene-java/diff/965036e0

Branch: refs/heads/develop
Commit: 965036e0ca33e594d7db4663fc5eabc6c26cf591
Parents: 4f2bcc3
Author: Paul Merlin <paulmerlin@apache.org>
Authored: Mon Apr 10 14:27:50 2017 +0200
Committer: Paul Merlin <paulmerlin@apache.org>
Committed: Mon Apr 10 14:27:50 2017 +0200

----------------------------------------------------------------------
 .../apache/polygene/library/scripting/ScriptMixin.java  | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/polygene-java/blob/965036e0/libraries/scripting/src/main/java/org/apache/polygene/library/scripting/ScriptMixin.java
----------------------------------------------------------------------
diff --git a/libraries/scripting/src/main/java/org/apache/polygene/library/scripting/ScriptMixin.java
b/libraries/scripting/src/main/java/org/apache/polygene/library/scripting/ScriptMixin.java
index bca28d3..651303f 100644
--- a/libraries/scripting/src/main/java/org/apache/polygene/library/scripting/ScriptMixin.java
+++ b/libraries/scripting/src/main/java/org/apache/polygene/library/scripting/ScriptMixin.java
@@ -211,27 +211,27 @@ public class ScriptMixin
             }
             if( short.class.equals( returnType ) )
             {
-                return (short) result;
+                return result.getClass().isPrimitive() ? result : ( (Number) result ).shortValue();
             }
             if( int.class.equals( returnType ) )
             {
-                return (int) result;
+                return result.getClass().isPrimitive() ? result : ( (Number) result ).intValue();
             }
             if( byte.class.equals( returnType ) )
             {
-                return (byte) result;
+                return result.getClass().isPrimitive() ? result : ( (Number) result ).byteValue();
             }
             if( long.class.equals( returnType ) )
             {
-                return (long) result;
+                return result.getClass().isPrimitive() ? result : ( (Number) result ).longValue();
             }
             if( float.class.equals( returnType ) )
             {
-                return (float) result;
+                return result.getClass().isPrimitive() ? result : ( (Number) result ).floatValue();
             }
             if( double.class.equals( returnType ) )
             {
-                return (double) result;
+                return result.getClass().isPrimitive() ? result : ( (Number) result ).doubleValue();
             }
         }
         return returnType.cast( result );


Mime
View raw message