You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by paulk-asert <gi...@git.apache.org> on 2016/06/03 04:17:07 UTC

[GitHub] groovy pull request #345: GROOVY-7853: o.c.g.r.t.DefaultTypeTransformation d...

GitHub user paulk-asert opened a pull request:

    https://github.com/apache/groovy/pull/345

    GROOVY-7853: o.c.g.r.t.DefaultTypeTransformation does not apply the r\u2026

    \u2026ight toString on primitve arrays when transforming to String

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/paulk-asert/groovy groovy7853

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/groovy/pull/345.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #345
    
----
commit 5c914153d3c97708d10cf210cf62989e51008368
Author: paulk <pa...@asert.com.au>
Date:   2016-06-03T04:15:09Z

    GROOVY-7853: o.c.g.r.t.DefaultTypeTransformation does not apply the right toString on primitve arrays when transforming to String

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] groovy pull request #345: GROOVY-7853: o.c.g.r.t.DefaultTypeTransformation d...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/groovy/pull/345


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] groovy pull request #345: GROOVY-7853: o.c.g.r.t.DefaultTypeTransformation d...

Posted by paulk-asert <gi...@git.apache.org>.
Github user paulk-asert commented on a diff in the pull request:

    https://github.com/apache/groovy/pull/345#discussion_r67152793
  
    --- Diff: src/main/org/codehaus/groovy/runtime/typehandling/ShortTypeHandling.java ---
    @@ -41,7 +43,15 @@ public static Class castToClass(Object object) {
     
         public static String castToString(Object object) {
             if (object==null) return null;
    -        if (object instanceof Class) return (String) object;
    +        if (object instanceof boolean[]) return Arrays.toString((boolean[])object);
    --- End diff --
    
    Good catch. Yes, that's probably a good optimization. Thanks for the
    suggestion.
    
    On Wed, Jun 15, 2016 at 10:27 PM, Jason Winnebeck <no...@github.com>
    wrote:
    
    > In
    > src/main/org/codehaus/groovy/runtime/typehandling/ShortTypeHandling.java
    > <https://github.com/apache/groovy/pull/345#discussion_r67151385>:
    >
    > > @@ -41,7 +43,15 @@ public static Class castToClass(Object object) {
    > >
    > >      public static String castToString(Object object) {
    > >          if (object==null) return null;
    > > -        if (object instanceof Class) return (String) object;
    > > +        if (object instanceof boolean[]) return Arrays.toString((boolean[])object);
    >
    > Would it be more efficient to put this within an
    > if(object.getClass().isArray) block?
    >
    > \u2014
    > You are receiving this because you authored the thread.
    > Reply to this email directly, view it on GitHub
    > <https://github.com/apache/groovy/pull/345/files/5c914153d3c97708d10cf210cf62989e51008368#r67151385>,
    > or mute the thread
    > <https://github.com/notifications/unsubscribe/AARF0Pnh0PV29an3T3l9GqZFHA3iJZtvks5qL--pgaJpZM4ItMJP>
    > .
    >



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] groovy pull request #345: GROOVY-7853: o.c.g.r.t.DefaultTypeTransformation d...

Posted by gillius <gi...@git.apache.org>.
Github user gillius commented on a diff in the pull request:

    https://github.com/apache/groovy/pull/345#discussion_r67151385
  
    --- Diff: src/main/org/codehaus/groovy/runtime/typehandling/ShortTypeHandling.java ---
    @@ -41,7 +43,15 @@ public static Class castToClass(Object object) {
     
         public static String castToString(Object object) {
             if (object==null) return null;
    -        if (object instanceof Class) return (String) object;
    +        if (object instanceof boolean[]) return Arrays.toString((boolean[])object);
    --- End diff --
    
    Would it be more efficient to put this within an `if(object.getClass().isArray)` block?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---