Skip to content
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

End try-catch blocks before inserted probes. #627

Merged
merged 7 commits into from
Dec 20, 2017
Merged

Conversation

allenhair
Copy link
Contributor

Fixes #626

@@ -28,7 +28,7 @@

static {
// Runtime initialize to ensure javac does not inline the value.
FORMAT_VERSION = 0x1007;
FORMAT_VERSION = 0x1008;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering whether version increment is really required, if the only change - is an end of try-catch blocks and not number and placement of probes? Otherwise I'm afraid of consequences of this incompatible change for downstream projects as already mentioned in #626 (comment) - when we did increment last time several years ago, it was quite disruptive.

Also in backlog we have some other changes that require increment, but were considered minor to justify it. So if underlying issue here justifies increment, then we'd better do them all together.

Copy link
Contributor Author

@allenhair allenhair Dec 4, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be honest, I'm not quite sure whether the increment is necessary. I remember @marchof said it was needed for #265 but you are correct that the number of probes and their placement shouldn't change.

Copy link
Member

@Godin Godin Dec 4, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually not obvious that number and placement do not change - I was not and is not sure about this and that was a reason to ask.

Also I have feeling that our unit tests unfortunately are not exhaustive in regards to number and placement of probes and especially in case of complex CFGs involving try-catch blocks, and unfortunately we don't have assertions about number of probes in validation tests and they are probably not exhaustive too.

And since you're also unsure, we'll need to study this more carefully - for example by counting number of probes on a big set of class files before and after this change as an addition to a more careful code review.

Copy link
Member

@Godin Godin Dec 5, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@allenhair in fact after merge of #266 @marchof reverted increment of version in 82f40d7 prior to release 😉

And here I come to following conclusions: move of start and end labels of try-catch blocks between end and beginning of probe doesn't affect original labels and so doesn't affect MethodInstrumenter, i.e. placement and number of probes, as well as MethodAnalyzer, i.e. result of analysis, and affects only final class after instrumentation. I guess this is exactly what is described as "leads to semantically identical probes" in 82f40d7.

@marchof Am I right? WDYT?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Godin @allenhair If the change in #266 did not change the number of probes this new handling for the end labels will also not change the number of probes. So no need to change exec version.
Also if we would do so we should combine this with other changes in our backlog (see @Godin 's comment).

Copy link
Member

@marchof marchof left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leave exec file version untouched.

@Godin Godin self-assigned this Dec 16, 2017
@Godin Godin added this to the 0.8.0 milestone Dec 16, 2017
"java/lang/Exception");
expectedVisitor.visitTryCatchBlock(start, end, handler2,
expectedVisitor.visitTryCatchBlock(probe, end, handler2,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test verifies that in case of probe at the beginning two invocations of visitTryCatchBlock will use the same first label, i.e. second invocation uses label created during first invocation. But there is no test to verify second label in case of probe at the end.

@Godin Godin force-pushed the master branch 2 times, most recently from 03c269a to 917989c Compare December 20, 2017 02:49
@Godin
Copy link
Member

Godin commented Dec 20, 2017

@marchof I restored version of exec-file, polished tests and comments and added changelog entry. Could you please re-review? If all fine, I'll squash and merge.

Copy link
Member

@marchof marchof left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me now, thanks!

@Godin Godin added the type: bug 🐛 Something isn't working label Dec 20, 2017
@Godin Godin merged commit e050f19 into jacoco:master Dec 20, 2017
@Godin
Copy link
Member

Godin commented Dec 20, 2017

@allenhair hope you don't mind that we took over finalization of this, thanks again for your valuable contribution! ❤️

@allenhair
Copy link
Contributor Author

No problem @Godin, thanks for pushing this through.

@jacoco jacoco locked as resolved and limited conversation to collaborators Jan 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
component: core type: bug 🐛 Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants