7903733: Fixed an issue with incorrect coverage line statistics
The hited lines will be removed if isHit is false the next time the coverage is calculated, which will cause the actual number to be inconsistent with the green lines displayed in the coverage HTML report.
<meth name="<init>" vmsig="(IIJ)V" flags=' public' access="131073" cons="true" length="49">
<bl s="0" e="48">
<methenter s="0" e="48" id="636775" count="0"/>
<exit s="48" e="48" opcode="return"/>
</bl>
<lt>0=138;4=94;15=111;22=139;28=140;42=141;48=142;</lt>
</meth>
<meth name="<init>" vmsig="(IJ)V" flags=' public' access="1" cons="true" length="35">
<bl s="0" e="34">
<methenter s="0" e="34" id="636776" count="107"/>
<exit s="34" e="34" opcode="return"/>
</bl>
<lt>0=148;4=94;15=111;22=149;28=150;34=151;</lt>
</meth>
<meth name="<init>" vmsig="(J)V" flags=' public' access="1" cons="true" length="29">
<bl s="0" e="28">
<methenter s="0" e="28" id="636777" count="0"/>
<exit s="28" e="28" opcode="return"/>
</bl>
<lt>0=156;4=94;15=111;22=157;28=158;</lt>
</meth>
The above xml is taken from the test result xml file generated by jcov. It can be seen that in the three init, line 94 is run once, but the code will reduce the covered value by 1.
The problem is shown in the figure below. The line coverage is 55/101, but there are actually 59 green lines in the HTML report.
Progress
- [x] Change must not contain extraneous whitespace
Error
⚠️ OCA signatory status must be verified
Integration blocker
⚠️ Title mismatch between PR and JBS for issue CODETOOLS-7903733
Issue
- CODETOOLS-7903733: [jcov]The number of covered lines displayed by jcov statistics is incorrect (Bug - P4) ⚠️ Title mismatch between PR and JBS.
Reviewing
Using git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jcov.git pull/49/head:pull/49
$ git checkout pull/49
Update a local copy of the PR:
$ git checkout pull/49
$ git pull https://git.openjdk.org/jcov.git pull/49/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 49
View PR using the GUI difftool:
$ git pr show -t 49
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jcov/pull/49.diff
Hi @Accelerator1996, welcome to this OpenJDK project and thanks for contributing!
We do not recognize you as Contributor and need to ensure you have signed the Oracle Contributor Agreement (OCA). If you have not signed the OCA, please follow the instructions. Please fill in your GitHub username in the "Username" field of the application. Once you have signed the OCA, please let us know by writing /signed in a comment in this pull request.
If you already are an OpenJDK Author, Committer or Reviewer, please click here to open a new issue so that we can record that fact. Please use "Add GitHub user Accelerator1996" as summary for the issue.
If you are contributing this work on behalf of your employer and your employer has signed the OCA, please let us know by writing /covered in a comment in this pull request.
❗ This change is not yet ready to be integrated. See the Progress checklist in the description for automated requirements.
:warning: @Accelerator1996 a branch with the same name as the source branch for this pull request (master) is present in the target repository. If you eventually integrate this pull request then the branch master in your personal fork will diverge once you sync your personal fork with the upstream repository.
To avoid this situation, create a new branch for your changes and reset the master branch. You can do this by running the following commands in a local repository for your personal fork. Note: you do not have to name the new branch NEW-BRANCH-NAME.
$ git checkout -b NEW-BRANCH-NAME
$ git branch -f master bbbd62b1f15016518a1972a5588059b40b7e4098
$ git push -f origin master
Then proceed to create a new pull request with NEW-BRANCH-NAME as the source branch and close this one.
/reviewer credit @shurymury, @lkuskov
@lkuskov Only the author (@Accelerator1996) is allowed to issue the reviewer command.
Please "create a new branch for your changes and reset the master branch". and add the following reviewers: /reviewer credit @shurymury, @lkuskov
@lkuskov Only the author (@Accelerator1996) is allowed to issue the reviewer command.
Can you please add a test similar to one added by https://bugs.openjdk.org/browse/CODETOOLS-7903867?
newly added RecordContainerTest covers this case, actually, so, LGTM
@Accelerator1996 , would you be willing to sign the OCA, as explained by the comment?
@shurymury @lkuskov Sorry, I am applying for OCA. After I complete the application, I will add use cases and reviewers according to your opinions.