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 D1E8A200C7C for ; Mon, 5 Jun 2017 19:46:09 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id D0B5B160BE1; Mon, 5 Jun 2017 17:46:09 +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 24A90160BD4 for ; Mon, 5 Jun 2017 19:46:08 +0200 (CEST) Received: (qmail 64678 invoked by uid 500); 5 Jun 2017 17:46:07 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 64658 invoked by uid 99); 5 Jun 2017 17:46:07 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Jun 2017 17:46:07 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 1D7E21AFC2C for ; Mon, 5 Jun 2017 17:46:07 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -100.002 X-Spam-Level: X-Spam-Status: No, score=-100.002 tagged_above=-999 required=6.31 tests=[RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id pEYn4oh3y8xB for ; Mon, 5 Jun 2017 17:46:06 +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 78EB65FCC7 for ; Mon, 5 Jun 2017 17:46:05 +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 ABBC3E0B4A for ; Mon, 5 Jun 2017 17:46:04 +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 5AEDD21B58 for ; Mon, 5 Jun 2017 17:46:04 +0000 (UTC) Date: Mon, 5 Jun 2017 17:46:04 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (TEXT-80) StrLookup API confusing MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Mon, 05 Jun 2017 17:46:10 -0000 [ https://issues.apache.org/jira/browse/TEXT-80?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16037270#comment-16037270 ] ASF GitHub Bot commented on TEXT-80: ------------------------------------ Github user ameyjadiye commented on the issue: https://github.com/apache/commons-text/pull/44 Hi @garydgregory , Its already discussed here [LANG-564](https://issues.apache.org/jira/browse/LANG-564) and [TEXT-80](https://issues.apache.org/jira/browse/TEXT-80) and all seems agree on changing the code, according to discussion code proposed in this PR will improve the API. As this is moved from commons lang, version of ```StrLookup``` will soon be deprecated. so no cross module impact I see for now and yes whoever using text 1.0, 1.1 will need to change code very minimal. > StrLookup API confusing > ----------------------- > > Key: TEXT-80 > URL: https://issues.apache.org/jira/browse/TEXT-80 > Project: Commons Text > Issue Type: Bug > Reporter: Etienne Neveu > Fix For: 1.x > > > [bayard: copying this from LANG-564] > I don't see the point of having a generic type parameter on the StrLookup class, if it's not used anywhere. No method / field in StrLookup references this type parameter. IntelliJ IDEA itself reports a warning: "Type parameter 'V' is never used". Moreover, Java generics are not reified, so there is no reliable way to access the type parameter at runtime (and I don't see the point of doing that anyway...). > While the Javadoc tries to clarify the purpose of a StrLookup, the unused type parameter is still confusing, and the client code has to un-necessarily specify type parameters. For example, I have to write: > StrLookup lookup = StrLookup.noneLookup(); > StrLookup lookup2 = StrLookup.systemPropertiesLookup(); > StrLookup lookup3 = StrLookup.mapLookup(integerMap); > instead of > StrLookup lookup = StrLookup.noneLookup(); > StrLookup lookup2 = StrLookup.systemPropertiesLookup(); > StrLookup lookup3 = StrLookup.mapLookup(integerMap); > My best guess is that this type parameter was added when commons-lang was generified, because StringLookup.mapLookup() takes a generified Map. Doing this is not really needed, though: we could remove the type parameter everywhere, and replace the StrLookup.mapLookup()'s Map with a Map (which is the same as Map, but shorter). > I guess it's too late to change this now, due to backward compatibility... But I thought I'd comment just in case it's still possible. -- This message was sent by Atlassian JIRA (v6.3.15#6346)