-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Upgrade JaCoCo from 0.8.7 to 0.8.9-SNAPSHOT #16412
Comments
cc @cushon |
Is the jacoco in Bazel using a vendored ASM, or is the immediate problem actually that we need a newer ASM? Either way, upgrading to the latest versions SGTM. Anyone want to send a PR? |
Hi @cushon Apologies for the delayed response. I noticed that the latest release version of jacoco is 0.8.8 which should also be fine, it does not require an upgrade to ASM. I started making the first commit (see somethingvague@fa2b2cd) and then I noticed the two patches under I think the process is
Please confirm. Thanks. |
I don't know exactly how this was done for Bazel in 21e2794, but that sounds about right to me. I think it might be OK to drop The patches could be applied with something like:
It doesn't look like there are merge conflicts, but if there were I would apply them against v0.8.7 instead and then use git to do the rebase onto v0.8.8. And then I would use |
Related to bazelbuild#16412
Thanks for the tips. I think an ASM upgrade might be needed after all, however I am struggling to verify the changes I am making to my fork. The process I'm following is:
I can see that I tried configuring the toolchain with Is there a way to have Bazel use the JavaBuilder that is being built in my source? |
Yes, there's one more step that's need to use a newer build of JavaBuilder: bazelbuild/java_tools#43 (comment) |
Apologies for the edits, my branch was incorrect. If I upgrade both JaCoCo and ASM I can at least get to a test failure rather than a build failure, please see the error below. Interestingly if I upgrade ASM only the test passes and I get a A script to reproduce the error described in this repo's README. It clones this fork of bazelbuild containing asm@9.3 and jacoco@0.8.8 with build_tools updated I believe the null pointer passed down the stack is from reading the class name in
|
Any thoughts on this issue please? |
I see the first PR #17514 was approved even though I have not been able to verify that these versions work with Bazel (see #16412 (comment)). I also notice the PR has unsuccessful checks. Do you have any feedback on those? |
Sorry, the mechanics of the upgrade look good, I didn't realize it wasn't passing tests yet. I am not sure if this is relevant or not, but internally we're using a newer jaococ version than the last tagged release (specifically |
somethingvague@2e3f566 on the forked bazel repro branch upgrades jacoco to jacoco/jacoco@4d09ece and ASM 9.4. Unfortunately I get the same error in #16412 (comment) when running on the test project. Unsure if it's anything to do with the java toolchain or bazel configuration on the test project. Would you mind taking a look please? |
I was able to reproduce and have a possible workaround, can you verify this resolves the NPE for you? diff --git a/src/java_tools/junitrunner/java/com/google/testing/coverage/ClassProbesMapper.java b/src/java_tools/junitrunner/java/com/google/testing/coverage/ClassProbesMapper.java
index 0633e1acf2..25c5d105e4 100644
--- a/src/java_tools/junitrunner/java/com/google/testing/coverage/ClassProbesMapper.java
+++ b/src/java_tools/junitrunner/java/com/google/testing/coverage/ClassProbesMapper.java
@@ -52,7 +52,7 @@ public class ClassProbesMapper extends ClassProbesVisitor implements IFilterCont
public ClassProbesMapper(String className) {
classLineToBranchExp = new TreeMap<Integer, BranchExp>();
stringPool = new StringPool();
- className = stringPool.get(className);
+ this.className = stringPool.get(className);
}
@Override |
+ ClassProbesMapper fix to initialize the className correctly Related to bazelbuild#16412
Thanks for this, it resolves the NPE. I have updated PR #17514 to include JaCoCo v0.8.8, ASM 9.4, + the fix in #16412 (comment). I have confirmed it works with the subsequent |
instead of re-assigning the parameter. See #16412 PiperOrigin-RevId: 516538078 Change-Id: I176935b838b73e932c57b2506e4994633e5061ff
+ ClassProbesMapper fix to initialize the className correctly Related to bazelbuild#16412
Thanks for merging, PR 2 of 3 raised #17785 |
jdk20 GA release is tomorrow. Given that the latest JaCoCo snapshot build supports jdk20/21 and that snapshot builds are considered safe, should we instead take the latest snapshot now or would you prefer to do another cycle after this issue is closed out?
We intend to follow the JDK release cycle, do you think it's reasonable for us to do that and have coverage? Also, do you think the mechanics of the 3 stage change to upgrade JaCoCo could be optimized in future? |
Personally I would be fine with trying JaCoCo snapshot builds.
@comius do you have any thoughts on options for streamlining the update process? (The 3-stage process referred to is the one documented in https://github.com/bazelbuild/bazel/blob/28001f6109ede0bd28ec00eb8d1a59d30cdb3bde/third_party/java/jacoco/README.md) |
Related to #16412 PR 2 of 3 as described in [README](https://github.com/bazelbuild/bazel/blob/master/third_party/java/jacoco/README.md) Closes #17785. PiperOrigin-RevId: 518165972 Change-Id: Ia93b86a541c30e9a169a07b0be415218e3785e34
There is an ongoing effort (by @meteorcloudy ) to empty Line 650 in 2a3ab5c
However, for now this is only being done for dependencies that only require class jars . Doing this for dependencies that also need source jars, while possible, is yet to be figured out. Once that happens though, upgrading versions can happen in a single PR with other changes. |
That sounds great, although there may still be some added complexity here since we're carrying patches for modifications to JaCoCo. |
@hvadehra makes sense, thanks for explaining. @cushon I was able to verify that Bazel HEAD + JaCoCo 0.8.8 produces coverage data for Java 20 features built with a JDK 20 toolchain, though I'm not confident the coverage data is meaningful. Should we push ahead with upgrading JaCoCo to 0.8.9-SNAPSHOT on #17836? (I've also confirmed this version works) |
@cushon Can you elaborate a bit more on how those patches are applied to the jar files? Do we still need those patches after upgrading to a new JaCoco version? Can we upstream those changes? Here are the current jar files left in third_party, understanding how they are used will be helpful for me to move them to rules_jvm_external:
|
I would do something like #16412 (comment). I think @comius did the first Bazel update that used those patches in a0dec28 and may have additional context.
I tried: jacoco/jacoco#1151
JaCoCo hasn't changed. At this point support for condy should be more ubiquitous, so I think it's worth trying to drop that patch. |
I've confirmed 0.8.9-SNAPSHOT with updated Also, I noticed Bazel pre-release 7.0.0-pre.20230316.2 does not include c22f29b updating |
I see that the latest pre-release includes the change. I notice that Bazel 7 is targeted for late 2023 https://bazel.build/about/roadmap#bazel_70_release , is there a chance of this being released in a 6.x version? |
instead of re-assigning the parameter. See bazelbuild#16412 PiperOrigin-RevId: 516538078 Change-Id: I176935b838b73e932c57b2506e4994633e5061ff
+ ClassProbesMapper fix to initialize the className correctly Related to bazelbuild#16412 Partial commit for third_party/*, see bazelbuild#17514. Signed-off-by: kshyanashree <kshyanashreem@example.com>
Related to bazelbuild#16412 PR 2 of 3 as described in [README](https://github.com/bazelbuild/bazel/blob/master/third_party/java/jacoco/README.md) Closes bazelbuild#17785. PiperOrigin-RevId: 518165972 Change-Id: Ia93b86a541c30e9a169a07b0be415218e3785e34
Related to bazelbuild#16412 Partial commit for third_party/*, see bazelbuild#17836. Signed-off-by: Sunil Gowroji <sgowroji@google.com>
Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 1+ years. It will be closed in the next 90 days unless any other activity occurs. If you think this issue is still relevant and should stay open, please post any comment here and the issue will no longer be marked as stale. |
Description of the feature request:
Please upgrade to the latest JaCoCo distribution which adds official support for Java 17/18 and experimental support for Java 19 classes.
Happy to try workarounds if there are any suggestions.
What underlying problem are you trying to solve with this feature?
Instrumentation for Java 19 targets
Which operating system are you running Bazel on?
Debian GNU/Linux
What is the output of
bazel info release
?release 5.3.1
If
bazel info release
returnsdevelopment version
or(@non-git)
, tell us how you built Bazel.No response
What's the output of
git remote get-url origin; git rev-parse master; git rev-parse HEAD
?Have you found anything relevant by searching the web?
https://www.jacoco.org/jacoco/trunk/doc/changes.html
Any other information, logs, or outputs that you want to share?
The text was updated successfully, but these errors were encountered: