-
Notifications
You must be signed in to change notification settings - Fork 20
Upcast efficiently in sink #222
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
Upcast efficiently in sink #222
Conversation
@mina-asham PTAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! LGTM!
@@ -191,7 +191,7 @@ private static Object toProtoValue( | |||
if (convertedValue != value) { | |||
return convertedValue; | |||
} | |||
return Long.valueOf(value.toString()); | |||
return ((Number) value).longValue(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be (It does the same AFAIK):
return ((Number) value).longValue(); | |
return (long) value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Throws java.lang.ClassCastException
@@ -207,7 +207,7 @@ private static Object toProtoValue( | |||
return (boolean) value; | |||
case FLOAT: | |||
case DOUBLE: | |||
return Double.valueOf(value.toString()); | |||
return ((Number) value).doubleValue(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here too:
return ((Number) value).doubleValue(); | |
return (double) value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Throws java.lang.ClassCastException
/gcbrun