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 18559200D21 for ; Mon, 16 Oct 2017 09:30:10 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 16EDE1609EF; Mon, 16 Oct 2017 07:30:10 +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 5E3C81609EC for ; Mon, 16 Oct 2017 09:30:09 +0200 (CEST) Received: (qmail 46248 invoked by uid 500); 16 Oct 2017 07:30:08 -0000 Mailing-List: contact dev-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Developers List" Delivered-To: mailing list dev@commons.apache.org Received: (qmail 46237 invoked by uid 99); 16 Oct 2017 07:30:08 -0000 Received: from mail-relay.apache.org (HELO mail-relay.apache.org) (140.211.11.15) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Oct 2017 07:30:08 +0000 Received: from benedikts-mbp.local (dslb-088-069-247-009.088.069.pools.vodafone-ip.de [88.69.247.9]) by mail-relay.apache.org (ASF Mail Server at mail-relay.apache.org) with ESMTPSA id 0F9AE1A0015 for ; Mon, 16 Oct 2017 07:30:06 +0000 (UTC) From: Benedikt Ritter Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 11.0 \(3445.1.7\)) Subject: Re: [text] always use static imports for assertion methods Date: Mon, 16 Oct 2017 09:30:01 +0200 References: <70b9432a0fff4583b46a5b76daa03466@git.apache.org> <4cfe09c72d19ca488dd909070fdc92a2@scarlet.be> <5793e73f0cf5b43019bfddd2597f0359@scarlet.be> To: Commons Developers List In-Reply-To: Message-Id: X-Mailer: Apple Mail (2.3445.1.7) archived-at: Mon, 16 Oct 2017 07:30:10 -0000 > Am 16.10.2017 um 00:34 schrieb Gilles : >=20 > On Sun, 15 Oct 2017 14:45:09 -0500, Matt Sicker wrote: >> Assertion classes are just containers for static methods. Using = "import >> static" is the only way in Java to import the individual methods as = if the >> class itself were a package. Also, doing this is pretty common when = using >> the Assert class as all its methods are prefixed with "assert" = anyways. >=20 > It's not because something is widespread that it should be emulated. > Is there any good reason to use "import static"? [Saving the typing > of 7 characters cannot be one of them.] >=20 > It can (and does) happen that "assert..." methods are defined > on a per project basis, and nothing is gained when the reader > has to check the top of the file to be sure of what class is > actually used. >=20 > My point was just that rather than cleaning up, the commit was > obfuscating (even if so little) the source code. > I prefer the other way around. :-) I think there are pros and cons for both styles. I prefer static = imports. I don=E2=80=99t see any value in knowing, that assertEquals = comes from a class called Assert.=20 Cheers, Benedikt >=20 > YMMV, > Gilles >=20 >=20 >> On 15 October 2017 at 13:44, Gilles = wrote: >>=20 >>> On Sun, 15 Oct 2017 12:22:13 +0200, Pascal Schumacher wrote: >>>=20 >>>> Just for consistency. >>>>=20 >>>=20 >>> Consistency is fine. ;-) >>>=20 >>> All almost all tests already used static >>>> imports, so I adjusted the few that did not. >>>>=20 >>>=20 >>> It's the use of "import static" which I was questioning. >>>=20 >>> Gilles >>>=20 >>>=20 >>>=20 >>>> -Pascal >>>>=20 >>>> Am 15.10.2017 um 11:44 schrieb Gilles: >>>>=20 >>>>> On Sun, 15 Oct 2017 09:34:04 +0000 (UTC), = pascalschumacher@apache.org >>>>> wrote: >>>>>=20 >>>>>> Repository: commons-text >>>>>> Updated Branches: >>>>>> refs/heads/master 51645b4f0 -> 8f7d0494d >>>>>>=20 >>>>>>=20 >>>>>> always use static imports for assertion methods >>>>>>=20 >>>>>>=20 >>>>> Why? >>>>>=20 >>>>> Gilles >>>>>=20 >>>>>=20 >>>>>> [...] >>>>>>=20 >>>>>=20 >=20 >=20 > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org > For additional commands, e-mail: dev-help@commons.apache.org >=20 --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org For additional commands, e-mail: dev-help@commons.apache.org