Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import immutable ByteString from protobuf #1281

Open
gissuebot opened this issue Oct 31, 2014 · 6 comments
Open

Import immutable ByteString from protobuf #1281

gissuebot opened this issue Oct 31, 2014 · 6 comments

Comments

@gissuebot
Copy link

Original issue created by mmastrac on 2013-02-04 at 04:57 PM


I'd love it if protobuf's immutable ByteString could make it into Guava. This is a useful class, even for users who aren't using protobuf and it seems like a shame to pull in the rest when I'm already importing Guava.

@gissuebot
Copy link
Author

Original comment posted by kak@google.com on 2013-02-04 at 05:07 PM


Agreed...this has been on our radar for quite some time.


Status: Accepted
Labels: Type-Addition, Package-Base

@gissuebot
Copy link
Author

gissuebot commented Nov 1, 2014

Original comment posted by jus...@fathomdb.com on 2014-01-11 at 02:44 PM


+1 from me, but my motivation is to use both Guava and Protobuf, and have them work better together. e.g. Have ByteString implement ByteSource; return ByteString instead of defensive byte array copies in Guava, etc.

It seems to me that the biggest problem is organizational - i.e. in which project does ByteString live? If in Guava, protobuf would have to depend on it. If in a new "Guava core", Guava would have to maintain that separation. Merging Protobuf-java and Guava would be great, but is probably unacceptable. Having Guava depend on Protobuf (or Protobuf core, containing ByteString) would be 80% good, but wouldn't allow e.g. ByteString to extend ByteSource. etc etc

Any thoughts on the preferred option?

@gissuebot
Copy link
Author

Original comment posted by kak@google.com on 2014-01-12 at 02:41 AM


(No comment entered for this change.)


Owner: cgdecker@google.com

@gissuebot
Copy link
Author

Original comment posted by andreas.schildbach on 2014-06-01 at 09:25 AM


I think ultimately ByteString should go into the JDK itself.

@swankjesse
Copy link
Contributor

swankjesse commented Jun 19, 2015

Here's okio's bytestring class: https://square.github.io/okio/1.x/okio/okio/ByteString.html

@henryptung
Copy link

Re: Justin's concern, with the existence of protobuf-java-util depending on both Guava and Protobuf, I don't think the two versions would be a big concern. (There can be a util for conversion between ByteString types, and Guava's ByteString can be an abstract class like Protobuf's, allowing wrapper implementations in either direction.)

Re: andreas' comment, agreed too that the JDK should have a concept of an immutable byte view, but I think third-party prototyping and resulting widespread adoption can be a good way to motivate and guide JDK development (see Joda date types, Guava Optionals and functional utils, etc., FluentIterable patterns now incorporated in Stream, etc.).

Out of curiosity, what's the process (if any) for this kind of work?

@raghsriniv raghsriniv added the P3 label Jun 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants