thrift-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jens Geyer (Jira)" <j...@apache.org>
Subject [jira] [Updated] (THRIFT-5292) No Need to Explicitly Print Null
Date Thu, 08 Oct 2020 13:22:00 GMT

     [ 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)

Mime
View raw message