-
-
Notifications
You must be signed in to change notification settings - Fork 352
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
review: Fix NPE with union catch inside lambda in noclasspath #1416
Conversation
@Test | ||
public void testUnionCatchExceptionInsideLambdaInNoClasspath() { | ||
// contract: the model should be built when defining a union catch inside a lambda which is not known (noclasspath) | ||
// and the catch variable should be the same than outside a lambda |
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 added this contract which seems reasonable, but I have problem to achieve this second part of the contract (and so, the last equals is a wrong assertion): JDT does not provide any information about the exception type inside the lambda, even not the fully qualified name of the exception. As a result, I have only the simple name of the class, which does not allow me easily to infer any information like on any other case.
So, do you have any idea how to improve that, or could we remove this part of the contract and consider that in this specific case the model have less information?
* refactor: remove commented code * refactor: remove comment - it is fixed in #1416 * refactor: remove commented code * fix typo * restore deleted assertion
* refactor: remove commented code * refactor: remove comment - it is fixed in INRIA/spoon#1416 * refactor: remove commented code * fix typo * restore deleted assertion
* refactor: remove commented code * refactor: remove comment - it is fixed in INRIA/spoon#1416 * refactor: remove commented code * fix typo * restore deleted assertion
This PR fix a NPE we had when spooning a catch with multi exception inside a lambda in no classpath mode, as explained in #1415.
However the bug is not completely solved in that PR, in that sense that the model is not exactly the same as if the try catch was outside the lambda. I decided to concentrate on getting information from multi types (which was causing the NPE). But to complete it, we should also compute the type of CtCatchVariable from the multitypes (it's normally done by JDT). I opened an issue for that and I propose to solve it in a separate PR (see #1420)