From dev-return-54237-archive-asf-public=cust-asf.ponee.io@thrift.apache.org Thu Dec 27 16:33:46 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id B30A2180677 for ; Thu, 27 Dec 2018 16:33:45 +0100 (CET) Received: (qmail 53642 invoked by uid 500); 27 Dec 2018 15:33:44 -0000 Mailing-List: contact dev-help@thrift.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@thrift.apache.org Delivered-To: mailing list dev@thrift.apache.org Received: (qmail 53631 invoked by uid 99); 27 Dec 2018 15:33:44 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 27 Dec 2018 15:33:44 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 42663C249B for ; Thu, 27 Dec 2018 15:33:44 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -109.501 X-Spam-Level: X-Spam-Status: No, score=-109.501 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id LAQxXuu3l3yf for ; Thu, 27 Dec 2018 15:33:43 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 668C161322 for ; Thu, 27 Dec 2018 15:25:20 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 342ACE13DA for ; Thu, 27 Dec 2018 15:25:20 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 1B5C82536B for ; Thu, 27 Dec 2018 15:25:20 +0000 (UTC) Date: Thu, 27 Dec 2018 15:25:20 +0000 (UTC) From: "James E. King III (JIRA)" To: dev@thrift.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Closed] (THRIFT-4530) proposal: add nullability annotations to generated Java code MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/THRIFT-4530?page=3Dcom.atlassi= an.jira.plugin.system.issuetabpanels:all-tabpanel ] James E. King III closed THRIFT-4530. ------------------------------------- > proposal: add nullability annotations to generated Java code > ------------------------------------------------------------ > > Key: THRIFT-4530 > URL: https://issues.apache.org/jira/browse/THRIFT-4530 > Project: Thrift > Issue Type: New Feature > Components: Java - Compiler > Reporter: Manu Sridharan > Priority: Major > Fix For: 0.12.0 > > > I'd like to propose (optionally) including {{@Nullable}} annotations in T= hrift-generated Java code.=C2=A0 I'm the main author of NullAway ([https://= github.com/uber/NullAway)]=C2=A0and we'd like to better support users who a= re using Thrift.=C2=A0 The change would involve changing the Java code gene= rator to include {{@Nullable}} annotations on every field, method return va= lue, and method parameter in the public API of generated code that may be n= ull.=C2=A0 With these annotations, NullAway users will get warnings when th= eir client code is missing appropriate null checks.=C2=A0 Also, IDEs like I= ntelliJ will give better warnings about missing null checks.=C2=A0 As part = of this change, I would also add support to NullAway for understanding {{is= SetX()}} methods to avoid excessive false positives. > Regarding which {{@Nullable}} annotation to use, Thrift seems to try to m= inimize third-party dependencies, but we could simply include a new Thrift = {{@Nullable}} annotation, and it will work fine with NullAway and most othe= r tools. > I have a WIP patch to generate these annotations, but I wanted to get fee= dback from the maintainers before opening a PR.=C2=A0 We could of course ma= ke the annotation generation optional and default it to being off, if desir= ed.=C2=A0 Anyway, thoughts / feedback welcome.=C2=A0 Thanks! -- This message was sent by Atlassian JIRA (v7.6.3#76005)