aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Nguyen <olivernguyen@google.com>2021-12-15 11:04:52 -0800
committerOliver Nguyen <olivernguyen@google.com>2021-12-15 11:07:59 -0800
commitf95a4e340e7a75b587c57b02bae0e50f423f0e41 (patch)
treecc9d9755fa750dc85d00049fb6f174607688fa0b
parent94db7dbc179fe45c01cc3eaf4460aae011e2e71a (diff)
downloadjacoco-f95a4e340e7a75b587c57b02bae0e50f423f0e41.tar.gz
Recreate Agent whenever requested.
Coverage data after the first call is never included in the RuntimeData. This changes the Agent to always return the latest coverage data, at the cost of recreating the Agent each time it is needed. Test: forrest Bug: 203236809 Change-Id: I24b3c906d5c25032231ce135be5b59550e6b0b7b
-rw-r--r--org.jacoco.agent.rt/src/org/jacoco/agent/rt/internal/Agent.java10
1 files changed, 4 insertions, 6 deletions
diff --git a/org.jacoco.agent.rt/src/org/jacoco/agent/rt/internal/Agent.java b/org.jacoco.agent.rt/src/org/jacoco/agent/rt/internal/Agent.java
index b6debe1f..45b7ccdd 100644
--- a/org.jacoco.agent.rt/src/org/jacoco/agent/rt/internal/Agent.java
+++ b/org.jacoco.agent.rt/src/org/jacoco/agent/rt/internal/Agent.java
@@ -91,12 +91,10 @@ public class Agent implements IAgent {
*/
// END android-change
public static synchronized Agent getInstance() throws IllegalStateException {
- if (singleton == null) {
- // BEGIN android-change
- // throw new IllegalStateException("JaCoCo agent not started.");
- singleton = Offline.createAgent();
- // END android-change
- }
+ // BEGIN android-change
+ // throw new IllegalStateException("JaCoCo agent not started.");
+ singleton = Offline.createAgent();
+ // END android-change
return singleton;
}