-
-
Notifications
You must be signed in to change notification settings - Fork 357
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: Source position of CtCatch and CtCatchVariable #2128
Conversation
Yes, I agreed. to get the catch position you should look at the jdt parent element. |
d091e57
to
d6b01a3
Compare
It seems good to me. Thanks @pvojtechovsky |
I am done here. |
c6ae571
to
f900186
Compare
} | ||
int bracketStart = findNextNonWhitespace(contents, endOfTry, catchStart + CATCH.length()); | ||
if (bracketStart < 0) { | ||
throw new SpoonException("Unexpected end of file instead of \'(\' after catch statement on offset: " + catchStart); |
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'm afraid of this exception because there is a chance that we forget to handle one specific case and it will break the construction of the model.
I agree it is good to fix the problem but do you need to force this behavior to the users.
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.
What do you suggest? To silently ignore our mistake ("we forget to handle one specific case") and to produce invalid source position?
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 don't know what is the best solution.
I just thought you can use the environment enableCheck, this way the user can disable it and you still have a chance to have a feedback.
WDYT?
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 meant skipSelfChecks
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.
ok, I will do so
PositionBuilder now writes into log and returns SourcePosition.NOPOSITION when there is a position detection problem and model checks are disabled. If they are enabled then it throws exception on each such problem. |
thanks Pavel |
@tdurieux do you agree that the test added by this PR should pass?
note: actually CtCatch source position contains only from parameters. E.g.:
IOException e
, which is not correct.WDYT?
I will try to fix it in next days if you agree.