Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 16A29200B42 for ; Sun, 10 Jul 2016 08:51:11 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 08E33160A69; Sun, 10 Jul 2016 06:51:11 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 4F39F160A5E for ; Sun, 10 Jul 2016 08:51:10 +0200 (CEST) Received: (qmail 5773 invoked by uid 500); 10 Jul 2016 06:51:09 -0000 Mailing-List: contact dev-help@poi.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "POI Developers List" Delivered-To: mailing list dev@poi.apache.org Received: (qmail 5761 invoked by uid 99); 10 Jul 2016 06:51:09 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 10 Jul 2016 06:51:09 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 87045C32E1 for ; Sun, 10 Jul 2016 06:51:08 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.287 X-Spam-Level: X-Spam-Status: No, score=-0.287 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-1.287] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id qQR4As_U681U for ; Sun, 10 Jul 2016 06:51:08 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 567E25F24C for ; Sun, 10 Jul 2016 06:51:07 +0000 (UTC) Received: from asf-bz1-us-mid.priv.apache.org (unknown [162.242.174.13]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTPS id 6540AE023A for ; Sun, 10 Jul 2016 06:51:06 +0000 (UTC) Received: by asf-bz1-us-mid.priv.apache.org (ASF Mail Server at asf-bz1-us-mid.priv.apache.org, from userid 33) id 8EBAC60D20; Sun, 10 Jul 2016 06:50:53 +0000 (UTC) From: bugzilla@apache.org To: dev@poi.apache.org Subject: [Bug 59836] New: Replace primitives with enums Date: Sun, 10 Jul 2016 06:51:05 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: POI X-Bugzilla-Component: SS Common X-Bugzilla-Version: 3.15-dev X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: onealj@apache.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: dev@poi.apache.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: https://bz.apache.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 archived-at: Sun, 10 Jul 2016 06:51:11 -0000 https://bz.apache.org/bugzilla/show_bug.cgi?id=59836 Bug ID: 59836 Summary: Replace primitives with enums Product: POI Version: 3.15-dev Hardware: PC OS: Linux Status: NEW Severity: enhancement Priority: P2 Component: SS Common Assignee: dev@poi.apache.org Reporter: onealj@apache.org This is a aggregate bug for recent changes in classes from using short or int to using enums with codes. Benefits: * self-explanatory usage rather than needing to list the valid constants in the javadocs * easier to distinguish arguments in function signatures (not just a 5 ints) * clearer error messages, no functions needed to convert code to string * free range checking (less boiler plate code that does the same) * type safety Drawbacks: * some permgen overhead * type checking execution overhead Overall, this seems like a good thing. In effort to maintain backwards compatibility, the following is suggested: If there is currently int getSomething(); void setSomething(int); Then we should add enum getSomethingEnum(); void setSomething(Enum); And deprecate void setSomething(int); int getSomething(); It's a bit tricky handling getSomething/getSomethingEnum while maintaining backwards compatibility because at some point the signature will abruptly change. Both getters should be offered for a while with a note encouraging users to use the constants or enums rather than using literal values. This is good coding practice anyway to not hard-code literal values, but is especially important with regard to backwards compatibility here. At least 2 releases later, but not later than POI 4.0: Delete void setSomething(int); Delete int getSomething(); Rename enum getSomethingEnum(); to enum getSomething(); In the end, we will have enum getSomething(); void setSomething(enum); as the only two methods. -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org For additional commands, e-mail: dev-help@poi.apache.org