[ 
https://issues.apache.org/jira/browse/AVRO-605?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12895867#action_12895867
 ] 

Scott Carey commented on AVRO-605:
----------------------------------

Sounds like a useful change to me.  A few things will slow down due to the 
extra instanceof checks, but its a much more flexible API. 

I suspect that some will not properly reset the string via setLength(), there 
is some risk around mixing the mutable Utf8 type with the immutable String.

Minor nit:
{code}
   /** Return length in bytes. */
   public int getLength() { return length; }
{code}

Lets clearly disambiguate getLength() from length().   Make it clear that 
getLength() is Utf8 byte count, and perhaps provide a doc link to the 
CharSequence.length() for those looking for the number of Java chars in the 
sequence. 


> Java: make Utf8 implement CharSequence
> --------------------------------------
>
>                 Key: AVRO-605
>                 URL: https://issues.apache.org/jira/browse/AVRO-605
>             Project: Avro
>          Issue Type: Improvement
>          Components: java
>            Reporter: Doug Cutting
>            Assignee: Doug Cutting
>             Fix For: 1.4.0
>
>         Attachments: AVRO-605.patch, AVRO-605.patch
>
>
> If Utf8 implemented CharSequence then interfaces could change to specify 
> CharSequence and accept Utf8 or String interchangeably.
> This would be mostly back-compatible, except the method signatures of 
> generated protocols would be different, so implementations would need to be 
> updated.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to