From dev-return-54525-archive-asf-public=cust-asf.ponee.io@thrift.apache.org Thu Jan 3 14:43:04 2019 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 9A2EA180608 for ; Thu, 3 Jan 2019 14:43:03 +0100 (CET) Received: (qmail 12227 invoked by uid 500); 3 Jan 2019 13:43:02 -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 12216 invoked by uid 99); 3 Jan 2019 13:43:02 -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, 03 Jan 2019 13:43:02 +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 2BC5DC2511 for ; Thu, 3 Jan 2019 13:43:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -110.301 X-Spam-Level: X-Spam-Status: No, score=-110.301 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, 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 Z_RNTi-2QIo0 for ; Thu, 3 Jan 2019 13:43:01 +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 E1B0061130 for ; Thu, 3 Jan 2019 13:43:00 +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 62C5BE25B2 for ; Thu, 3 Jan 2019 13:43:00 +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 19BC3253D4 for ; Thu, 3 Jan 2019 13:43:00 +0000 (UTC) Date: Thu, 3 Jan 2019 13:43:00 +0000 (UTC) From: "James E. King III (JIRA)" To: dev@thrift.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (THRIFT-1827) Inconsistent behavior in isSet mechanism MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/THRIFT-1827?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] James E. King III updated THRIFT-1827: -------------------------------------- Fix Version/s: (was: 1.0) > Inconsistent behavior in isSet mechanism > ---------------------------------------- > > Key: THRIFT-1827 > URL: https://issues.apache.org/jira/browse/THRIFT-1827 > Project: Thrift > Issue Type: Bug > Components: Java - Compiler > Affects Versions: 0.9 > Reporter: Jason Clawson > Priority: Major > > This issue was mentioned previously in THRIFT-1394. The reporter suggested a fix at that time which would have resolved it. Instead, the fix that was actually applied did not fix the real issue. > The issue is that code relies on 2 different mechanisms to determine "isSet" state. On the one hand, bit fields are kept for primitivies, on the other "isSet" is determined if the value is null or not. The latter part is incorrect considering one may wish to set a value to null. > Consider the use case where a Thrift payload is used to send delta's of changed information. A client can determine which fields were "set" by using the "isSet" mechanism. This will not work for String / Struct types due to the inconsistent behavior. Client code will be unable to determine if a String type was: a) just not provided b) or was explicitly set to null. > Also, it makes methods like set__IsSet and get__IsSet inconsistent. For example: > user.setName(null); > user.setNameIsSet(true); > boolean isNameSet = user.getNameIsSet() //false! > My proposal to fix is the same as the original proposal in THRIFT-1394: > We already use a BitSet to track primitive types in Java. The compiler should extend the bit vector to also guard nullable types, to be consistent with C++. -- This message was sent by Atlassian JIRA (v7.6.3#76005)