X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E8A6252F5E for ; Wed, 27 Jul 2005 20:00:59 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 01562-05 for ; Wed, 27 Jul 2005 23:00:53 +0000 (GMT) Received: from mx1.redhat.com (mx1.redhat.com [66.187.233.31]) by svr1.postgresql.org (Postfix) with ESMTP id 04EF952C48 for ; Wed, 27 Jul 2005 20:00:50 -0300 (ADT) Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11/8.12.11) with ESMTP id j6RN0qQl007990 for ; Wed, 27 Jul 2005 19:00:52 -0400 Received: from mail.boston.redhat.com (mail.boston.redhat.com [172.16.76.12]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id j6RN0qV31381 for ; Wed, 27 Jul 2005 19:00:52 -0400 Received: from vpn83-150.boston.redhat.com (vpn83-150.boston.redhat.com [172.16.83.150]) by mail.boston.redhat.com (8.12.8/8.12.8) with ESMTP id j6RN0pMT017958 for ; Wed, 27 Jul 2005 19:00:51 -0400 From: Vadim Nasardinov Organization: Red Hat (Westford) To: pgsql-jdbc@postgresql.org Subject: Re: jdbc xa patches Date: Wed, 27 Jul 2005 19:00:39 -0400 User-Agent: KMail/1.8 References: <20050726193540.M74424@yvyyl> <200507271104.19933.vadimn@redhat.com> <42E80CBB.1030006@opencloud.com> In-Reply-To: <42E80CBB.1030006@opencloud.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200507271900.39224.vadimn@redhat.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.011 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200507/382 X-Sequence-Number: 13530 On Wednesday 27 July 2005 18:37, Oliver Jowett wrote: > > http://www.google.com/search?q=Java+typesafe+enum > > Shrug, the main reason for an enum-like pattern is to get type > safety, but in this case there's only one field that ever uses the > enum (and it's never passed around as a parameter), so there's not > much scope for getting it wrong. Sure, you can get it right without the added benefit of type safety, given that the offending piece of code is completely isolated within a single file. (Both TransactionState and ResourceAssociationState are private inner classes of PGXAResource.) It's a matter of taste and I have no vested interest in the outcome of this particular mini-discussion. That said, from my cursory reading of org/postgresql/xa/PGXAResource.java, it seems to me that both TransactionState and ResourceAssociationState instances are used as values in a Map. If we replace these two classes with "bare ints" without changing the rest of the code drastically, we will have to box those ints into Integers or suchlike before putting them into their respective maps. It's not then a huge leap to turn those Integers into proper typesafe enums, as is currently done. Seems very reasonable to me, when viewed on its own merits. If, however, this goes against some established pgjdbc prejudice against typesafe enums, then sure, nuke it. Better be globally consistent, than locally correct.