aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-02-17 02:48:49 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-02-17 02:48:49 +0000
commit1ab29a2d9fedf29552a48912e4113e67b3d76d3d (patch)
tree6ccb427df3fbc4a579f685327e633b4b142d54a1
parent39faefe8ca1f76fa7b58f089dc7fe953b1e6a447 (diff)
parentcf92214db05a512b30c7c8f842855208ae450580 (diff)
downloadjacoco-1ab29a2d9fedf29552a48912e4113e67b3d76d3d.tar.gz
Snap for 8192738 from cf92214db05a512b30c7c8f842855208ae450580 to tm-frc-extservices-release
Change-Id: Ibe9984b4c8fa3081ee2d903dc473f6dfd8c25bd8
-rw-r--r--README.android3
-rw-r--r--org.jacoco.agent.rt/src/org/jacoco/agent/rt/internal/Agent.java34
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/instr/ProbeArrayStrategyFactory.java22
3 files changed, 30 insertions, 29 deletions
diff --git a/README.android b/README.android
index 8fa2b902..aa285834 100644
--- a/README.android
+++ b/README.android
@@ -21,3 +21,6 @@ is the list of the changes:
more lightweight. The Agent is only created when it's actually
needed. This makes it possible to instrument a lot of more core
libraries without creating a circular dependency at runtime.
+4) Disable use of 'constant dynamic' bytecode in
+ org.jacoco.core.internal.instr.ProbeArrayStrategyFactory, because R8/D8 doesn't support it.
+ (https://issuetracker.google.com/178172809)
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..c4bf874a 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
@@ -34,8 +34,6 @@ import org.jacoco.core.runtime.RuntimeData;
*/
public class Agent implements IAgent {
- private static Agent singleton;
-
/**
* Returns a global instance which is already started. If the method is
* called the first time the instance is created with the given options.
@@ -63,18 +61,15 @@ public class Agent implements IAgent {
* @return global instance
*/
public static synchronized Agent getInstance(final AgentOptions options, RuntimeData data) {
- if (singleton == null) {
- final Agent agent = new Agent(options, IExceptionLogger.SYSTEM_ERR, data);
- agent.startup();
- Runtime.getRuntime().addShutdownHook(new Thread() {
- @Override
- public void run() {
- agent.shutdown();
- }
- });
- singleton = agent;
- }
- return singleton;
+ final Agent agent = new Agent(options, IExceptionLogger.SYSTEM_ERR, data);
+ agent.startup();
+ Runtime.getRuntime().addShutdownHook(new Thread() {
+ @Override
+ public void run() {
+ agent.shutdown();
+ }
+ });
+ return agent;
}
// END android-change
@@ -91,13 +86,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
- }
- return singleton;
+ // BEGIN android-change
+ // throw new IllegalStateException("JaCoCo agent not started.");
+ return Offline.createAgent();
+ // END android-change
}
private final AgentOptions options;
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/instr/ProbeArrayStrategyFactory.java b/org.jacoco.core/src/org/jacoco/core/internal/instr/ProbeArrayStrategyFactory.java
index d5756b7f..bc957b91 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/instr/ProbeArrayStrategyFactory.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/instr/ProbeArrayStrategyFactory.java
@@ -50,10 +50,13 @@ public final class ProbeArrayStrategyFactory {
if (counter.getCount() == 0) {
return new NoneProbeArrayStrategy();
}
- if (version >= Opcodes.V11 && counter.hasMethods()) {
- return new CondyProbeArrayStrategy(className, true, classId,
- accessorGenerator);
- }
+// BEGIN android-change
+ // See https://github.com/jacoco/jacoco/issues/1151
+ // if (version >= Opcodes.V11 && counter.hasMethods()) {
+ // return new CondyProbeArrayStrategy(className, true, classId,
+ // accessorGenerator);
+ // }
+// END android-change
if (version >= Opcodes.V1_8 && counter.hasMethods()) {
return new InterfaceFieldProbeArrayStrategy(className, classId,
counter.getCount(), accessorGenerator);
@@ -62,10 +65,13 @@ public final class ProbeArrayStrategyFactory {
counter.getCount(), accessorGenerator);
}
} else {
- if (version >= Opcodes.V11) {
- return new CondyProbeArrayStrategy(className, false, classId,
- accessorGenerator);
- }
+// BEGIN android-change
+ // See https://github.com/jacoco/jacoco/issues/1151
+ // if (version >= Opcodes.V11) {
+ // return new CondyProbeArrayStrategy(className, false, classId,
+ // accessorGenerator);
+ // }
+// END android-change
return new ClassFieldProbeArrayStrategy(className, classId,
InstrSupport.needsFrames(version), accessorGenerator);
}