You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Jens Geyer (Jira)" <ji...@apache.org> on 2020/10/08 13:22:00 UTC

[jira] [Updated] (THRIFT-5292) No Need to Explicitly Print Null

     [ https://issues.apache.org/jira/browse/THRIFT-5292?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jens Geyer updated THRIFT-5292:
-------------------------------
    Component/s: Java - Compiler

> No Need to Explicitly Print Null
> --------------------------------
>
>                 Key: THRIFT-5292
>                 URL: https://issues.apache.org/jira/browse/THRIFT-5292
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Java - Compiler
>            Reporter: David Mollitor
>            Assignee: David Mollitor
>            Priority: Minor
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> {code:java}
> if (!first) sb.append(", ");
>  sb.append("i16_list:");
>  if (this.i16_list == null) {
>  sb.append("null");
>  } else {
>  sb.append(this.i16_list);
>  }
> {code}
> {quote}The overall effect is exactly as if the argument were converted to a string by the method String.valueOf(Object), and the characters of that string were then appended to this character sequence.
> {quote}
> {quote}if the argument is null, then a string equal to "null"; otherwise, the value of obj.toString() is returned.
> {quote}
> So, Thrift doesn't need to manually append 'null' here, can reduce the code here.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)