News about Guava and Java 8

4,877 views
Skip to first unread message

Kevin Bourrillion

unread,
Dec 14, 2015, 6:20:07 PM12/14/15
to guava-discuss

Hello guava-discuss,

Here's an update about our Java 8-related plans for Guava.

Already using Java 8?

(Lucky you!) For you, we've started the process of adding documentation to some of our classes to help you understand their relationship to their new Java 8 counterparts. We're still working on this, but for now you can see Optional, Predicate and FluentIterable for examples. (We're focusing first on the cases where the new JDK offerings are essentially superior to ours, but we'll try to get to all the rest like BaseEncoding soon too. :-))

Also, for you Guava collections now have new methods on them which aren't coming from us -- they're "default methods" that were added directly to base interfaces in java.util. In most cases (a notable exception being Cache.asMap()) these should work correctly, but in many cases they may be suboptimal and we can't generally recommend their use. And there's nothing we can do about it before Guava 21.0 (read below), so please tread with care.

Not yet using Java 8?

Guava 20 (to be released in early 2016) will be the final Guava release to support Java 6, or even Java 7. Guava 21 (ideally mid-2016) will require Java 8. So, if you're unable to upgrade to 8, you may be using 20 for a while. We don't expect to issue patch releases except for relatively serious issues.

But Android!

Ah, have no fear. With version 21 we will also kick off a new fork, presumably called guava-android. It will maintain Java 6 compatibility, allowing it to be used for Android apps supporting a minimum version of Gingerbread.

For the first time we will have an Android-specific Guava codebase, and we welcome your suggestions (please file issues) for Android-specific optimizations you feel it needs.

So what new stuff will we get in Guava 21?

Collector implementations for the immutable collections (and a few others). Streams and default methods will both become more efficient for Guava collection types. Our Function/etc. classes will subclass the JDK versions, thus interoperating a little more easily. Optional will have conversion methods for java.util.Optional. And at last, Path-based versions of common.io features.

Brace ourselves, the deprecations are coming?

You can relax. Mostly. Guava 21 and beyond will not race to quickly @Deprecate all APIs that have become redundant with Java 8 libraries. We are simply re-documenting them with light discouragement (as you see in the examples above).

Yes, we'd like everyone to feel motivated to migrate to the new standard. But we realize this will take time, and we also want to prevent an enormous gap from forming between guava and guava-android.

So what good is Guava anymore?

We sometimes come across Internet comments to the effect that Guava is dead and busted now that Java 8 is out. This is obviously pleasing to us since we worked closely with the JSR-335 expert group to try to make that happen! But, while it's true that you may import com.google.common less often than you used to, when you need an immutable collection, multimap, Throwable helper, CharMatcher, primitive utility, base encoding, hash function, I/O source or sink, rate limiter -- or any of the new features we're currently rolling out! -- hopefully you'll still know where to come.

Any questions?

-- the Guava team


--
Kevin Bourrillion | Java Librarian | Google, Inc. | kev...@google.com

pablogri...@gmail.com

unread,
Dec 14, 2015, 8:31:26 PM12/14/15
to guava-discuss
Are you planing to keep com.google.common.base.Optional around, and use it?... mmm... looks confusing. I respectfully disagree, but again, you probably have good reasons, I'm probably wrong. I'd love to here the reasons, however.

Michael Hixson

unread,
Dec 15, 2015, 3:32:28 AM12/15/15
to Kevin Bourrillion, guava-discuss
That's great news!

Should the community consider this open season for submitting feature
requests that require Java 8, or would you prefer that we wait?

-Michael
> --
> guava-...@googlegroups.com
> Project site: https://github.com/google/guava
> This group: http://groups.google.com/group/guava-discuss
>
> This list is for general discussion.
> To report an issue: https://github.com/google/guava/issues/new
> To get help: http://stackoverflow.com/questions/ask?tags=guava
> ---
> You received this message because you are subscribed to the Google Groups
> "guava-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to guava-discus...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/guava-discuss/CAGKkBkt1v6Yr8FikHyxMKyRkN9FevdgL-eJkP5zCuvc5_J%3D2WQ%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

Kevin Bourrillion

unread,
Dec 15, 2015, 4:00:20 AM12/15/15
to Michael Hixson, guava-discuss
By all means, feature requests are always fine!

Christian Gruber

unread,
Dec 22, 2015, 1:21:53 PM12/22/15
to pablogri...@gmail.com, guava-discuss
Trust me, we thought as hard as we could about how to disentangle Guava from our optional... but to remove it would result in breaking changes on APIs we have not deprecated.  Because Oracle's optional is final (so we cannot subclass it in order to make our APIs compatible as is), and because Oracle's optional is not serializable (which some of our users need), and a few other differences, just dropping it isn't (currently) feasible.  We are, however, planning to support Oracle's Optional in many of our APIs (which may mean more overloads than we would prefer)... and obviously the conversion methods.

We should probably write up the whole optional problem and our decisions about it, as I'm not sure I can do it justice in this comment.  But the short version is - we couldn't find a way to make our Optional go away in the near-term, so we're mitigating that reality as much as we can.

Christian.

pablogri...@gmail.com

unread,
Dec 22, 2015, 2:04:24 PM12/22/15
to guava-discuss, pablogri...@gmail.com
I understand you won't even deprecate GuavaOptional, so both will coexists... but what Optional will be recommended for the average user?

Also, are you going to use type annotations? I'd love to write

       List<@NotNull String> myLists = ImmutableList.of("a", "b");

without any compiler warning, and make my code more null safe

Christian Gruber

unread,
Dec 22, 2015, 3:41:52 PM12/22/15
to pablogri...@gmail.com, guava-discuss
I don't think we've (yet) worked out our recommendations about which types to use, but I know our general feeling on the team tends to be - use java.* if it's workable.  That's not an official recommendation, just a gauge of our general attitude. 

I'll leave specific announcements about what we'll be doing to those more actively working on it, but I cannot imagine we won't be using type annotations where appropriate.  Once we've made the cut to be at minimum java8, there's no reason to NOT use the features.  Just have to make sure we don't break folks with older client code within the scope of our compatibility policies. 

c.

--
guava-...@googlegroups.com
Project site: https://github.com/google/guava
This group: http://groups.google.com/group/guava-discuss
 
This list is for general discussion.
To report an issue: https://github.com/google/guava/issues/new
To get help: http://stackoverflow.com/questions/ask?tags=guava
---
You received this message because you are subscribed to the Google Groups "guava-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to guava-discus...@googlegroups.com.

Luke Usherwood

unread,
Dec 28, 2015, 11:33:10 PM12/28/15
to guava-discuss
Great news!


On Tuesday, 15 December 2015 12:20:07 UTC+13, Kevin Bourrillion wrote:

Collector implementations for the immutable collections (and a few others).

I was just looking to do bits of this and thought to search first, which is how I discovered this announcement :-)

I don't suppose there would be a chance to get early sneak previews while we wait-out the v21 release?

 

Any questions?

Are there plans for interoperability with, or migrating Guava to, java.util.Predicate?


Louis Wasserman

unread,
Dec 28, 2015, 11:41:35 PM12/28/15
to Luke Usherwood, guava-discuss
Our Function/etc. classes will subclass the JDK versions, thus interoperating a little more easily.

Predicate is included in that, I believe.

In any event, if you use lambdas or method references, the correct functional interface will be automatically chosen for you. This makes migration lots easier.

--
guava-...@googlegroups.com
Project site: https://github.com/google/guava
This group: http://groups.google.com/group/guava-discuss
 
This list is for general discussion.
To report an issue: https://github.com/google/guava/issues/new
To get help: http://stackoverflow.com/questions/ask?tags=guava
---
You received this message because you are subscribed to the Google Groups "guava-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to guava-discus...@googlegroups.com.

Kevin Bourrillion

unread,
Dec 29, 2015, 2:26:54 AM12/29/15
to guava-discuss
On Mon, Dec 14, 2015 at 3:19 PM, Kevin Bourrillion <kev...@google.com> wrote:

Already using Java 8?

(Lucky you!) For you, we've started the process of adding documentation to some of our classes to help you understand their relationship to their new Java 8 counterparts. We're still working on this, but for now you can see Optional, Predicate and ...

FYI, two recent questions in this thread will be answered by just clicking on these links. :-)  I'd say more but I'm on vacation!

CemoKoc

unread,
Jun 7, 2016, 3:26:42 AM6/7/16
to guava-discuss
Hi all,

Is there any news on this? 

Thanks

xaerxess

unread,
Jul 22, 2016, 3:25:34 AM7/22/16
to guava-discuss
Hi Kevin,

I know it's probably due to summer vacation we don't hear any news about new Guava releases, but what's current (updated) roadmap for Guava 20 and 21? (Of course with current adoption rate of Java 8, Guava 21 is the hot stuff we're waiting for impatiently.)

--
Grzegorz

Kurt Alfred Kluever

unread,
Jul 22, 2016, 8:45:25 AM7/22/16
to xaerxess, guava-discuss
Our release dates have slipped, but we anticipate having Guava 20 out the door sometime this summer.

I suspect Guava 21 (for Java 8) will follow shortly after that.

--
guava-...@googlegroups.com
Project site: https://github.com/google/guava
This group: http://groups.google.com/group/guava-discuss
 
This list is for general discussion.
To report an issue: https://github.com/google/guava/issues/new
To get help: http://stackoverflow.com/questions/ask?tags=guava
---
You received this message because you are subscribed to the Google Groups "guava-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to guava-discus...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
kak

tj.ro...@gmail.com

unread,
Aug 24, 2016, 5:04:45 PM8/24/16
to guava-discuss, xaer...@gmail.com
Any specifics on updated roadmap?

Perhaps post something here?

Colin Decker

unread,
Aug 25, 2016, 4:42:13 PM8/25/16
to tj.ro...@gmail.com, guava-discuss, xaer...@gmail.com
Long story short, the release schedule has slipped further for a number of reasons. That said, I'm hoping to be able to put out a release candidate for Guava 20 in the next few weeks, with common.graph and GWT 2.8.0 support among other things.

Guava 21 (with Java 8 support) will likely not be coming until October or later, because we're still in the process of switching to Java 8 internally (though that should be done Soon). Once that's done, one of the first things we'll be doing is updating Guava with its new Java 8 support and setting up the Java 7/Android version.

--
guava-...@googlegroups.com
Project site: https://github.com/google/guava
This group: http://groups.google.com/group/guava-discuss
 
This list is for general discussion.
To report an issue: https://github.com/google/guava/issues/new
To get help: http://stackoverflow.com/questions/ask?tags=guava
---
You received this message because you are subscribed to the Google Groups "guava-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to guava-discus...@googlegroups.com.

xaerxess

unread,
Nov 3, 2016, 8:33:58 AM11/3/16
to guava-discuss, tj.ro...@gmail.com, xaer...@gmail.com
Since Guava 20 came out, what are the plans for Java8-compatible version?

Kevin Bourrillion

unread,
Nov 3, 2016, 10:00:42 AM11/3/16
to xaerxess, guava-discuss, tj.ro...@gmail.com
Update coming very soon!

To unsubscribe from this group and stop receiving emails from it, send an email to guava-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/guava-discuss/129df65d-39a7-4803-80fc-b8512046a88c%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Daniel Rothmaler

unread,
Nov 4, 2016, 3:49:42 PM11/4/16
to guava-discuss
Thanks a lot for the update about Guava 21 in the Announce mailing list...
Great to hear, that we will finally get Java 8 support :-)

I greatly appreciate all your effort to stay backward compatible with new guava releases. 

But the step to drop Java 6&7 support already is a big breaking change. 
So wouldn't it be best to go one step further this time?

I would prefer if the Java 8 line would move to a new artefact name ('com.google.guava:guava8:21.0') and package like "com.google.common8.*" where all redundant stuff would be dropped. 
The Backport releases could then just be released in the old way and projects that are moving to Java 8 could just use the new one, without having to worry about breaking anything in their dependency tree, by moving to Guava21 or later. 
 

Tim Peierls

unread,
Nov 4, 2016, 4:00:06 PM11/4/16
to Daniel Rothmaler, guava-discuss
Um, a package name change would be pretty hard on those of us who are already using Guava and Java 8!

--tim

--
guava-...@googlegroups.com
Project site: https://github.com/google/guava
This group: http://groups.google.com/group/guava-discuss
 
This list is for general discussion.
To report an issue: https://github.com/google/guava/issues/new
To get help: http://stackoverflow.com/questions/ask?tags=guava
---
You received this message because you are subscribed to the Google Groups "guava-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to guava-discuss+unsubscribe@googlegroups.com.

Daniel Rothmaler

unread,
Nov 4, 2016, 4:16:16 PM11/4/16
to guava-discuss, ne...@drothmaler.de, t...@peierls.net
Well, commons-lang did it for Version 3 (when switching to Java 6). 
And when you where ready to upgrade your project, you could simply search and replace your imports. 
I don't think this would be such a big deal. 

The actual work there is the replacement, of the (potentially) dropped features. Like replacing FluentIterable by Java 8 Streams. 
But I still would prefer this one time effort; if I get a cleaner/smaller dependency in return.   
Just rip off the band-aid quickly ;-)

Kevin Bourrillion

unread,
Nov 4, 2016, 4:29:12 PM11/4/16
to Daniel Rothmaler, guava-discuss
On Fri, Nov 4, 2016 at 12:49 PM, Daniel Rothmaler <ne...@drothmaler.de> wrote:

I greatly appreciate all your effort to stay backward compatible with new guava releases. 

Thanks. I might be wrong but I think that might be the first time anyone has ever said that to us. :-)

 
But the step to drop Java 6&7 support already is a big breaking change. 

Can you explain what this part means?

 
So wouldn't it be best to go one step further this time?

I would prefer if the Java 8 line would move to a new artefact name ('com.google.guava:guava8:21.0') and package like "com.google.common8.*" where all redundant stuff would be dropped. 

I have never been able to imagine how a package move like that could work without being catastrophic. Also note that there's really no hurry to remove any heavily-used things just because they're redundant.

 
The Backport releases could then just be released in the old way and projects that are moving to Java 8 could just use the new one, without having to worry about breaking anything in their dependency tree, by moving to Guava21 or later. 
 

--
guava-...@googlegroups.com
Project site: https://github.com/google/guava
This group: http://groups.google.com/group/guava-discuss
 
This list is for general discussion.
To report an issue: https://github.com/google/guava/issues/new
To get help: http://stackoverflow.com/questions/ask?tags=guava
---
You received this message because you are subscribed to the Google Groups "guava-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to guava-discuss+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages