Return-Path: Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: (qmail 75922 invoked from network); 7 Feb 2010 07:32:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 7 Feb 2010 07:32:51 -0000 Received: (qmail 80197 invoked by uid 500); 7 Feb 2010 07:32:51 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 80094 invoked by uid 500); 7 Feb 2010 07:32:51 -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 80084 invoked by uid 99); 7 Feb 2010 07:32:51 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 07 Feb 2010 07:32:51 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 07 Feb 2010 07:32:49 +0000 Received: from brutus.apache.org (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id D1977234C052 for ; Sat, 6 Feb 2010 23:32:27 -0800 (PST) Message-ID: <2122337270.106061265527947846.JavaMail.jira@brutus.apache.org> Date: Sun, 7 Feb 2010 07:32:27 +0000 (UTC) From: "Henri Yandell (JIRA)" To: issues@commons.apache.org Subject: [jira] Issue Comment Edited: (LANG-510) Convert StringUtils API to take CharSequence In-Reply-To: <804222351.1246343627139.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/LANG-510?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12830677#action_12830677 ] Henri Yandell edited comment on LANG-510 at 2/7/10 7:31 AM: ------------------------------------------------------------ Played with changing left/right/mid. Issue here, same substring will have, is that it changes the method from String left(String) to CharSequence left(CharSequence) due to the reliance on subSequence. That means using code is going to have to start casting. Ugh. That will be a general issue for any String manipulation as opposed to query API. For these methods we are going to need to do overloads: {code:java} String doFoo(String) CharSequence doFoo(CharSequence) {code} Smells likely to be copy and paste code. Ugh again. UPDATE: Must be late... this is generics territory :) UPDATE2: Too late for brain today apparently. Generics get hurt by EMPTY being a String and subSequence returning a CharSequence. On the plus side - I did identify that copy and paste is not needed in the overloads. was (Author: bayard): Played with changing left/right/mid. Issue here, same substring will have, is that it changes the method from String left(String) to CharSequence left(CharSequence) due to the reliance on subSequence. That means using code is going to have to start casting. Ugh. That will be a general issue for any String manipulation as opposed to query API. For these methods we are going to need to do overloads: {code:java} String doFoo(String) CharSequence doFoo(CharSequence) {code} Smells likely to be copy and paste code. Ugh again. UPDATE: Must be late... this is generics territory :) > Convert StringUtils API to take CharSequence > -------------------------------------------- > > Key: LANG-510 > URL: https://issues.apache.org/jira/browse/LANG-510 > Project: Commons Lang > Issue Type: Improvement > Components: lang.* > Reporter: Henri Yandell > Fix For: 3.0 > > Attachments: LANG-510-indexOf.patch > > > Wherever possible, use CharSequence and not String in the StringUtils API. > substring can go to subSequence inside code. The general substring method can be replaced with a subSequence method and substring deprecated(?). One question is whether to implement a CharSequence.indexOf type method. Given that it's merely a walking method(?!?), this might be quite handy and would allow a bunch of StringUtils methods to move over. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.