I will probably rip out Guava from everywhere I've used it. It just isn't worth the hassle of dealing with Google libraries. I'm sick of having inexperienced engineers tell me how to write code.
On Friday, July 29, 2016 at 7:04:52 AM UTC-4, theco...@googlemail.com wrote:I've noticed that Throwables.propagate is being deprecated, along with propageteIfInstanceOf and propagateIfPossible. I think these are useful methods, and there doesn't seem to be a direct replacement. What's the thinking behind deprecating these methods?
SimonC
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/guava-discuss/7ab8af88-20dc-4119-85eb-bbf49f70740b%40googlegroups.com.
Guava is used everywhere by everybody. Anything that is deprecated has a huge impact on a very large number of engineers. It may as well be part of the JDK.Throwables.propagate is used very effectively to replace silly catch blocks that add absolutely no value to anybody. Without using propagate I have to add a few lines of extra exception handling for including some conditionals. My company has a 80% unit test code coverage rule that includes catch blocks. That means that I need to provide additional unit tests for every instance of Throwables.propagate that I replace, to make sure I don't cause any outages.It isn't just a matter of replacing 1 line of code, it's replacing 1000's of lines and copy-pasting thousands of unit tests. I literally have to change thousands of them. Yes - deprecating Throwables.propagate pissed me off. Sorry, I am in a bad mood - don't even get me started on Guava collections and nulls.There's nothing wrong with Throwables.propagate. If there was something wrong with it, then I would agree that it must be deprecated and replaced. If there's no pressing reason to get rid of it, and it's been in production systems for many years, you should absolutely keep it.
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/guava-discuss/f72a1f4e-1283-45f1-bd5e-02a62d8d5fe2%40googlegroups.com.
Just to back up the approach Guava is taking over how the JDK works - look at java.util.Date. I wish they'd *at least* mark it @Deprecated if only to let newcomers know that this is not the droid... sorry, class... they're looking for.
A.D.
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/f72a1f4e-1283-45f1-bd5e-02a62d8d5fe2%40googlegroups.com.
--David Beaumont :: Îñţérñåţîöñåļîžåţîờñ Libraries :: Google
Google Switzerland GmbH., Brandschenkestrasse 110, CH-8002, Zürich - Switzerland
--
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/CAKxGnns0O_p77MHCHskT7gMZLTQtXvvG4WLXpfbxAF2OR%2BAzWw%40mail.gmail.com.
Guava has a *very clear* deprecation lifecycle, basically saying that if you use Guava you should update your lib/app at least every 18 months or so to not get caught by API removals.
The problem is NOT Guava, it's people not keeping their deps up-to-date, not living by the standards they opted in to when choosing Guava in the first place, ones we could call *ahem* "inexperienced developers".
--
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/4aa5a7d2-3079-4560-b44a-654f522556f9%40googlegroups.com.
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/4aa5a7d2-3079-4560-b44a-654f522556f9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
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 view this discussion on the web visit https://groups.google.com/d/msgid/guava-discuss/CAODfdDeXJu%2BkymaLK4PntOdhDH0tc47hOy_qNy8asJ5TT0aSQg%40mail.gmail.com.To unsubscribe from this group and stop receiving emails from it, send an email to guava-discuss+unsubscribe@googlegroups.com.
I want to apologize for my Trump-like comment, and I am happy that my second try was more useful. thanks for putting up with my frustration. I do not have permission to share our usage metrics around Guava and more specifically, our use of Throwables.propagate, but suffice it to say, I did not exaggerate the impact it will have. If you would like, I can try to get permission to share this data with you.Thanks--Emanuel.
You received this message because you are subscribed to a topic in the Google Groups "guava-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/guava-discuss/QvModYS4uIM/unsubscribe.
To unsubscribe from this group and all its topics, 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/CAGKkBksKCoBwQqgcfMujuPoTNg81dZ290dyLPA%2BXFnJVVfAu-A%40mail.gmail.com.
Emanuel's comment about unit tests particularly caught my eye. I've actually been playing with 100% coverage on my current (smallish) project. For boilerplate catch blocks, the approach I've landed on is the extract the try-catch block itself into a method with its own unit test so that it doesn't have to be tested everywhere it occurs, like this:
interface IOExceptions<T> {
T get() throws IOException;
static <T> T areImpossibleIn(IOExceptions<T> supplier) {
try {
return supplier.get();
} catch (IOException e) {
throw new AssertionError(e);
}
}
}
Which can then be used like this:
IOExceptions.areImpossibleIn(() -> somethingThatTakesReader(new StringReader("foo")));
Cheers,
Justin
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/4aa5a7d2-3079-4560-b44a-654f522556f9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
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/CAODfdDeXJu%2BkymaLK4PntOdhDH0tc47hOy_qNy8asJ5TT0aSQg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
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 a topic in the Google Groups "guava-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/guava-discuss/QvModYS4uIM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to guava-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/guava-discuss/CAGKkBksKCoBwQqgcfMujuPoTNg81dZ290dyLPA%2BXFnJVVfAu-A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
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/CAGKkBkv%2BSxwYjJTC5VoVC6UVy5QN0PDGmPqsrEcdKTdsDNjO6A%40mail.gmail.com.
Removal of Throwables.propagate is going to be a huge pain, requiring refactoring throughout huge swaths of our code.
Cases where we use Throwables.propagate:
* Implementations of interfaces/classes used by unit tests, where the appropriate handling of any exception is to fail the test.
* Checked exceptions that are extremely unlikely to ever be thrown, such as an IOException from reading an InputStream backed by a static buffer, WrappingExecutorService.wrapTask(Runnable), or doing reflection on classes with known content.
* Situations where the appropriate handling is "cause the server to fail to start".
* Unwrapping ExecutionException causes.
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/guava-discuss/9620ff9b-54ca-4d98-9450-50b04fba912f%40googlegroups.com.
We definitely need better docs explaining this though.
On Thu, Jan 19, 2017 at 5:06 PM, <jgm...@gmail.com> wrote:Removal of Throwables.propagate is going to be a huge pain, requiring refactoring throughout huge swaths of our code.
Cases where we use Throwables.propagate:
* Implementations of interfaces/classes used by unit tests, where the appropriate handling of any exception is to fail the test.I'm not sure why you'd need this in tests. Your test methods should just declare "throws Exception", which alleviates the need for a try/catch/propagate.
* Checked exceptions that are extremely unlikely to ever be thrown, such as an IOException from reading an InputStream backed by a static buffer, WrappingExecutorService.wrapTask(Runnable), or doing reflection on classes with known content.You should never be passing a known checked exception to Throwables.propagate (we saw this pattern inside of google as well). If you want to propagate a known checked exception, just "throw new RuntimeException(checkedException)".
I can actually add more problems to the list. Throwables.propagate (and friends) don't properly reassert thread interrupt status if the wrapped exception is InterruptedException, and they make it easy to accidentally wrap things we don't want to. We fixed such a bug in Monitor several years ago:
https://github.com/google/guava/commit/287bc67cac97052b13cbbc0358aed8054b14bd4a
The deprecation is painful, and I would encourage the Guava maintainers to take their time in actually removing these methods. But I do think it's the right thing long-term. I'm actually surprised that they're only deprecating propagate() and not the other methods of Throwables, because I think they're all problematic and I haven't used any of them since encountering that bug in Monitor.
Guava folks, please do take a look at my IOExceptions.areImpossibleIn() example earlier in this thread. A handful of such methods might alleviate many of the use cases people are concerned about and do so both safely and conveniently.
Cheers,
Justin
From:
"guava-...@googlegroups.com" <guava-...@googlegroups.com> on behalf of Emanuel Bulic <emanue...@gmail.com>
Date: Friday, January 20, 2017 at 1:36 PM
To: Chris Povirk <cpo...@google.com>
Cc: "jgm...@gmail.com" <jgm...@gmail.com>, "guava-...@googlegroups.com" <guava-...@googlegroups.com>, "theco...@googlemail.com" <theco...@googlemail.com>
Subject: Re: [guava] Re: Throwables.propagate being deprecated?
Those are all excellent points, however
1. All these arguments should have influenced Guava long ago. It's too late now
2. Removing it will prevent engineers from adopting the new versions of the library with a simple version change.
3. It doesn't matter that people abuse it. People abuse lots of things. They probably abuse Guava collections too. What about Mutable vs Immutable objects. Let's get rid of all mutable objects because they're not thread-safe.
4. It's throwing the baby out with the bath water.
And most importantly I don't think it follows this very important Google principle:
Since the beginning, we’ve focused on providing the best user experience possible. Whether we’re designing a new Internet browser or a new tweak to the look of the homepage, we take great care to ensure that they will ultimately serve you, rather than our own internal goal or bottom line. Our homepage interface is clear and simple, and pages load instantly. Placement in search results is never sold to anyone, and advertising is not only clearly marked as such, it offers relevant content and is not distracting. And when we build new tools and applications, we believe they should work so well you don’t have to consider how they might have been designed differently.
Guava should follow the deprecation model of the JDK, which keeps everything around for a very long time.
On Fri, Jan 20, 2017 at 3:10 PM, Chris Povirk <cpo...@google.com> wrote:
I cleaned up our internal docs about the deprecation and published them here:
--
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/CAHQwt7qGMdf4BQQ308%2BWc4zL7wM%2BzG0gt%2BOPGH_tYSK6q%3DKhbQ%40mail.gmail.com.
Would it reasonable to ask that it be kept for all versions that support JDK8, and remove it in the first Gauva version built for JDK9? JDK upgrades take a lot of work anyway - that would a better time to get rid of it. If that was the plan to begin with, that this is no big deal.
--
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/CAHQwt7qGMdf4BQQ308%2BWc4zL7wM%2BzG0gt%2BOPGH_tYSK6q%3DKhbQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
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 view this discussion on the web visit https://groups.google.com/d/msgid/guava-discuss/CAHQwt7pZ1QtOgOJV2Ra%2BDKbB%3DxVXXbepwt-mNoc1SnvHDXWNEQ%40mail.gmail.com.To unsubscribe from this group and stop receiving emails from it, send an email to guava-discuss+unsubscribe@googlegroups.com.
Why would we, collectively, make a change that move the propagate method from Guava and into many little classes like this: com.<companyname>.guava...MoreThrowables?Let's consider the final outcome of doing this. Guava no longer has this one method, but, instead, we will have MoreThrowables classes all over the place with all sorts of hacks in them. That will make things worse.On another note, can you share any statistics regarding the misuse of this method? I understand that misuse is relative, but if you have some objective evidence that would be great.
On Fri, Jan 20, 2017 at 5:19 PM, Chris Povirk <cpo...@google.com> wrote:Guava compatibility has come up in a couple different conversations at Google lately -- specifically, tools and policies to make deprecations easier on users. It's too early to say how it will all shake out, but it's possible that we'd consider, say, batching breaking changes together to make them less frequent.For this particular case, your best bet is probably to introduce your own MoreThrowables class with an equivalent propagate() method. Or maybe your company policy requires that you still add tests when you replace "Throwables.propagate" with "MoreThrowables.propagate?"
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/guava-discuss/CAHQwt7ptEdkhbAxZwZH7Xi4eqOX8gt_nJMBJJ9m-9OtOn85o%3DA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/guava-discuss/CANTNG2Ao%3DWrHV5j0QmhM040hA-jOMYHjuwbFaqJbW%2BSCCLo2sQ%40mail.gmail.com.
try {
return readingFile();
} catch(Exception e) {
throw Throwables.propagate(e);
}
try {
return readingFile();
} catch(IOException e) {
throw new RuntimeException(e);
}
Emanuel,Here is the thing about putting users first:It still requires someone to apply their best subjective judgment to try to make a good decision about what the user's best interest is, and there will always be some users who don't agree with that judgment. That's just reality. Your providing information helps us make it a better informed judgment, which is appreciated. But you're going further than that, to assert that our judgment must be wrong because it's not the way you see it. That part isn't helpful.Also, going back to the part where you said, "All these arguments should have influenced Guava long ago. It's too late now." This is really just a misunderstanding of what Guava is and the way it operates (and has always operated). We do not withhold adding things to Guava until we are willing to commit to them permanently. If we did, Guava would be much smaller and less useful than it is. It would be hard to add anything to it.Being able to adapt Guava based on what we learn over time is fundamentally a good thing, and knowing that we can do that makes it a lot easier for us to move forward with ideas in the first place.
On Fri, Jan 20, 2017 at 2:59 PM, 'Catherine Berry' via guava-discuss <guava-...@googlegroups.com> wrote:
I think the idea is that, as Chris pointed out at length, we see the net value of Throwables.propagate (or any local version of it) as being negative. The various inline alternatives are almost always better, and in the small residue of cases, writing out the handling logic isn't that onerous. So rather than a thousand MoreThrowables classes scattered through the world, the hope is for a hundred thousand small improvements in Java practice.
On Fri, Jan 20, 2017 at 2:46 PM, Emanuel Bulic <emanue...@gmail.com> wrote:
Why would we, collectively, make a change that move the propagate method from Guava and into many little classes like this: com.<companyname>.guava...MoreThrowables?Let's consider the final outcome of doing this. Guava no longer has this one method, but, instead, we will have MoreThrowables classes all over the place with all sorts of hacks in them. That will make things worse.On another note, can you share any statistics regarding the misuse of this method? I understand that misuse is relative, but if you have some objective evidence that would be great.
--On Fri, Jan 20, 2017 at 5:19 PM, Chris Povirk <cpo...@google.com> wrote:Guava compatibility has come up in a couple different conversations at Google lately -- specifically, tools and policies to make deprecations easier on users. It's too early to say how it will all shake out, but it's possible that we'd consider, say, batching breaking changes together to make them less frequent.For this particular case, your best bet is probably to introduce your own MoreThrowables class with an equivalent propagate() method. Or maybe your company policy requires that you still add tests when you replace "Throwables.propagate" with "MoreThrowables.propagate?"
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/CAHQwt7ptEdkhbAxZwZH7Xi4eqOX8gt_nJMBJJ9m-9OtOn85o%3DA%40mail.gmail.com.
--"Easy things should be easy, and hard things should be possible." - Larry Wall
Catherine Berry (go/cberry-name)
Software Engineer
Google Los Angeles
--
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/CANTNG2Ao%3DWrHV5j0QmhM040hA-jOMYHjuwbFaqJbW%2BSCCLo2sQ%40mail.gmail.com.
On another note, can you share any statistics regarding the misuse of this method? I understand that misuse is relative, but if you have some objective evidence that would be great.
On Mon, Jan 23, 2017 at 2:38 PM, Chris Povirk <cpo...@google.com> wrote:Internally, the amortized cost for removing one call was probably a couple seconds, so if we can save a few people a few hours each, we're pretty happy with the result.
Obviously, I'm not very concerned with what it costs Google to make the migration.