-
Notifications
You must be signed in to change notification settings - Fork 139
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
Logging inside lambda fails with error #1181
Logging inside lambda fails with error #1181
Conversation
@stephan-herrmann : Adding one more to your review queue. I am trying to rack my brain on the one hand and on the other do software archeology to reconstruct the background behind this method: The core issue seems to be:
Per https://bugs.eclipse.org/bugs/show_bug.cgi?id=422489#c2 at some point,
and
The method I am wondering if that short circuting is really necessary since
So the present fix is to get rid of the machinery that short circuits the lambda exception analysis. The fact that the offending test case passes with this and no other ill effect is observed suggests, (a) silent error handling and (b) catching and dropping exceptions is enough of a safety net and there is no occasion/call to bypass exception analysis altogether in the presence of resolution errors (which is deleterious in the offending program's case) Let me know what you think. (A plausible approach would have been to bite the bullet and run analysis even in the presence of resolve errors and fix defuse all minefield - I don't think we had the luxury of doing that in Java 8 time frame. Alternately, as was done with |
@stephan-herrmann If you have time this is marked for your review for M1. Thanks. |
(@srikanth-sankaran I have seen your nice reasoning, why your change should be good. For now I'm intentionally ignoring that reasoning, as to try to provide an orthogonal view, please bear with me) How do we prove, that a particular piece of code is unnecessary, in particular, how can I assert this after not having been involved in its creation in the first place? :) To see if I have a chance to step through relevant code paths (before the removal), I gathered this little statistic from LambdaExpressionsTest plus LambdaRegressionTest: Which tests skip
Which test cases trigger
So, the set of test cases where analysis is skipped despite being used downstream is the empty set. Can we construct a test case that combines both properties? Yes, by adding Without the mandatory error, we then produce the "interesting" constraint By contrast, in presence of the mandatory error we infer So, yay, there is a difference with/without the mandatory error - internally. The test outcome still doesn't change, because inferring I dare say that inference of thrown exceptions isn't sufficiently tested in our suite for using this as the guide for bug fixes :( Assuming that corresponding test cases were mainly added as bug reports were coming in (and thus the result is fairly random), can we improve on this by systematically creating tests challenging this particular area? I must admit, I don't have a good intuition, where and how exception inference is needed, and what are its distinguishing parameters. |
Just a sign of background activity: I'm still trying to create a better understanding of situations where inference of thrown exceptions is relevant, and how this could be disturbed by shape analysis with half-cooked information. |
a0f54a3
to
af908f9
Compare
in compilation failure Fixes https://bugs.eclipse.org/bugs/show_bug.cgi?id=547231 * Fixes eclipse-jdt#2065
af908f9
to
55051f9
Compare
To reduce the problem at hand I outsourced my attempts to come to terms with exception inference in general into #2198. |
Trying to trace this change:
I came across the following from JSR 335 0.6.2 (15.27.3):
@srikanth-sankaran is this what the implementation was originally based upon? With this reference I can confirm that this rule has been dropped without any replacement. Compile errors in a lambda body are of no significance for type inference! Hooray! 🍾 |
After meandering around the issue, one final discussion about what could go wrong:
|
The copy on which we run Last attempt to break it: what are the side effects caused by flow analysis:
Can it happen that along the lines of (3) |
My preference is to deal with this if/when it arises - so we have a concrete case to dissect/inspect etc. The present change inasmuch as simply pulls out the vestiges of a withdrawn clause of spec appears to move the needle in the right direction. |
I captured this topic in #2208 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried hard to find reason against this change and found none :)
Please go ahead.
Thanks, I will assign this to myself although I will likely take it up for work only when a problem surfaces that may be likely be linked to it. |
…s in compilation failure (eclipse-jdt#1181) * Fixes https://bugs.eclipse.org/bugs/show_bug.cgi?id=547231 * Fixes eclipse-jdt#2065
…s in compilation failure (eclipse-jdt#1181) * Fixes https://bugs.eclipse.org/bugs/show_bug.cgi?id=547231 * Fixes eclipse-jdt#2065
What it does
Overly defensive short circuiting of lambda exception analysis results in compilation failure
Fixes https://bugs.eclipse.org/bugs/show_bug.cgi?id=547231
Author checklist