Return-Path: Delivered-To: apmail-jackrabbit-dev-archive@www.apache.org Received: (qmail 87837 invoked from network); 4 May 2009 14:12:35 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 4 May 2009 14:12:35 -0000 Received: (qmail 98716 invoked by uid 500); 4 May 2009 14:12:34 -0000 Delivered-To: apmail-jackrabbit-dev-archive@jackrabbit.apache.org Received: (qmail 98668 invoked by uid 500); 4 May 2009 14:12:34 -0000 Mailing-List: contact dev-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list dev@jackrabbit.apache.org Received: (qmail 98660 invoked by uid 99); 4 May 2009 14:12:34 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 May 2009 14:12:34 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of fmeschbe@gmail.com designates 72.14.220.157 as permitted sender) Received: from [72.14.220.157] (HELO fg-out-1718.google.com) (72.14.220.157) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 May 2009 14:12:25 +0000 Received: by fg-out-1718.google.com with SMTP id e12so538497fga.20 for ; Mon, 04 May 2009 07:12:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=BK4H9dyDLT9Xlfxj7n2BQaQjzNOGHPUSmlofABnekFQ=; b=C1dP9+2El0VLBNyrgy+O6gqk3A8zkmYESw009gS7tJ2E2uh9OoX38RHVdJnbih3Pe8 7FuWP6qGd0qxK8LRVCm7ouNg7Ov/9+GLqDpB79z/rcqTUH1NIZ4ONkw5HaXx5Th/KUw+ zwu353imQYJMJLkC4vxOcVEZ9XavTonFAhD6M= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; b=mI3Cyf5NBAee1IqwRO1axzt145paHNRQBMmXeAUx6QlrkT+DDEPowyiF/tEMRqw1pO 8U9EpnK4fjHXYLyyHcJU4+kRSVzmWJGTrwvm5zI0fCsD9ElwxYt4k1azauJOLRg1kBvq x1Pva8KFWcqsHQnCUV0JiLxQAlXKwU3CoXZ/k= Received: by 10.86.36.11 with SMTP id j11mr5911337fgj.22.1241446324842; Mon, 04 May 2009 07:12:04 -0700 (PDT) Received: from bslm-046.corp.day.com (bsl-rtr.day.com [62.192.10.254]) by mx.google.com with ESMTPS id 4sm6251693fge.18.2009.05.04.07.12.04 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 04 May 2009 07:12:04 -0700 (PDT) Message-ID: <49FEF7B4.2090306@gmail.com> Date: Mon, 04 May 2009 16:12:04 +0200 From: Felix Meschberger User-Agent: Thunderbird 2.0.0.21 (X11/20090320) MIME-Version: 1.0 To: dev@jackrabbit.apache.org Subject: Re: Generics generator class References: <91f3b2650905040617w57e838c8y106809810c6aaa82@mail.gmail.com> In-Reply-To: <91f3b2650905040617w57e838c8y106809810c6aaa82@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org Hi, Thomas M=FCller schrieb: > Hi, >=20 > I would like to use Java 1.5 features now in Jackrabbit. I hope this > will improve reliability, simplify maintenance, and reduce source code > size. Unfortunately using generics is sometimes quite verbose. I don't consider this a big issue. > Example: >=20 > HashMap wspInfos =3D new HashMap(); > becomes > HashMap wspInfos =3D new HashMap(); >=20 > Part of that could be avoided using a helper class: >=20 > HashMap wspInfos =3D New.hashMap(); >=20 > I propose to add a new 'generics generator class' called 'New' to > jackrabbit-jcr-commons. It would contain constructor methods for the > most commonly used collection objects. >=20 > public class New { > public static HashMap hashMap() { > return new HashMap(); > } > public static ArrayList arrayList() { > return new ArrayList(); > } > public static WeakReference weakReference(T t) { > return new WeakReference(t); > } > ... > } >=20 > What do you think? Are there better solutions? -1 Starting to have such helper classes amounts to a spiral with no end. There is IMHO also no use. In fact, while the "new HashMap()" construct has almost no influence on the generated class file, the helper class creates a new class object and increases memory footprint. I think the price is beyond what might be acceptable. Regards Felix >=20 > Regards, > Thomas >=20