Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GROOVY-7853: o.c.g.r.t.DefaultTypeTransformation does not apply the r… #345

Merged
merged 2 commits into from Aug 23, 2016

Conversation

paulk-asert
Copy link
Contributor

…ight toString on primitve arrays when transforming to String

@@ -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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be more efficient to put this within an if(object.getClass().isArray) block?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Yes, that's probably a good optimization. Thanks for the
suggestion.

On Wed, Jun 15, 2016 at 10:27 PM, Jason Winnebeck notifications@github.com
wrote:

In
src/main/org/codehaus/groovy/runtime/typehandling/ShortTypeHandling.java
#345 (comment):

@@ -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?


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
.

@paulk-asert
Copy link
Contributor Author

Updated per (I believe) Jochen's comment in the mailing list.

…ight toString on primitve arrays when transforming to String
…ight toString on primitve arrays when transforming to String (don't use ShortTypeHandling)
@asfgit asfgit merged commit eec3b1f into apache:master Aug 23, 2016
@paulk-asert paulk-asert deleted the groovy7853 branch August 23, 2016 03:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants