Skip to content

Commit

Permalink
Add Jacoco 0.8.6 to third-party and upgrade asm to 9.1
Browse files Browse the repository at this point in the history
Related to bazelbuild#11674
  • Loading branch information
comius committed Apr 12, 2021
1 parent 29cc00b commit 4f7db2b
Show file tree
Hide file tree
Showing 35 changed files with 530 additions and 277 deletions.
20 changes: 10 additions & 10 deletions third_party/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -180,35 +180,35 @@ distrib_java_import(
distrib_java_import(
name = "asm",
enable_distributions = ["debian"],
jars = ["asm/asm-8.0.jar"],
srcjar = "asm/asm-8.0-sources.jar",
jars = ["asm/asm-9.1.jar"],
srcjar = "asm/asm-9.1-sources.jar",
)

java_import(
name = "asm-analysis",
jars = ["asm/asm-analysis-8.0.jar"],
srcjar = "asm/asm-analysis-8.0-sources.jar",
jars = ["asm/asm-analysis-9.1.jar"],
srcjar = "asm/asm-analysis-9.1-sources.jar",
runtime_deps = [":asm-tree"],
)

java_import(
name = "asm-commons",
jars = ["asm/asm-commons-8.0.jar"],
srcjar = "asm/asm-commons-8.0-sources.jar",
jars = ["asm/asm-commons-9.1.jar"],
srcjar = "asm/asm-commons-9.1-sources.jar",
runtime_deps = [":asm-tree"],
)

java_import(
name = "asm-tree",
jars = ["asm/asm-tree-8.0.jar"],
srcjar = "asm/asm-tree-8.0-sources.jar",
jars = ["asm/asm-tree-9.1.jar"],
srcjar = "asm/asm-tree-9.1-sources.jar",
runtime_deps = [":asm"],
)

java_import(
name = "asm-util",
jars = ["asm/asm-util-8.0.jar"],
srcjar = "asm/asm-util-8.0-sources.jar",
jars = ["asm/asm-util-9.1.jar"],
srcjar = "asm/asm-util-9.1-sources.jar",
runtime_deps = [":asm-tree"],
)

Expand Down
57 changes: 27 additions & 30 deletions third_party/asm/LICENSE
Original file line number Diff line number Diff line change
@@ -1,31 +1,28 @@
*******************************************************************************
* ASM: a very small and fast Java bytecode manipulation framework
* Copyright (c) 2000-2011 INRIA, France Telecom
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************

This directory contains the documentation of the product.
ASM: a very small and fast Java bytecode manipulation framework
Copyright (c) 2000-2011 INRIA, France Telecom
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holders nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.
Binary file removed third_party/asm/asm-8.0-sources.jar
Binary file not shown.
Binary file removed third_party/asm/asm-8.0.jar
Binary file not shown.
Binary file added third_party/asm/asm-9.1-sources.jar
Binary file not shown.
Binary file added third_party/asm/asm-9.1.jar
Binary file not shown.
Binary file removed third_party/asm/asm-analysis-8.0-sources.jar
Binary file not shown.
Binary file removed third_party/asm/asm-analysis-8.0.jar
Binary file not shown.
Binary file added third_party/asm/asm-analysis-9.1-sources.jar
Binary file not shown.
Binary file added third_party/asm/asm-analysis-9.1.jar
Binary file not shown.
Binary file removed third_party/asm/asm-commons-8.0-sources.jar
Binary file not shown.
Binary file removed third_party/asm/asm-commons-8.0.jar
Binary file not shown.
Binary file added third_party/asm/asm-commons-9.1-sources.jar
Binary file not shown.
Binary file added third_party/asm/asm-commons-9.1.jar
Binary file not shown.
Binary file removed third_party/asm/asm-tree-8.0.jar
Binary file not shown.
Binary file not shown.
Binary file added third_party/asm/asm-tree-9.1.jar
Binary file not shown.
Binary file removed third_party/asm/asm-util-8.0-sources.jar
Binary file not shown.
Binary file removed third_party/asm/asm-util-8.0.jar
Binary file not shown.
Binary file added third_party/asm/asm-util-9.1-sources.jar
Binary file not shown.
Binary file added third_party/asm/asm-util-9.1.jar
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
From 3fc8dcb960e78d06a5db8b3d49b87eac2940280b Mon Sep 17 00:00:00 2001
From: Liam Miller-Cushon <cushon@google.com>
Date: Thu, 28 Jan 2021 21:25:28 -0800
Subject: [PATCH 1/2] Disable use of 'constant dynamic' bytecode

Ssee b/177688213 and https://github.com/jacoco/jacoco/issues/1151
---
.../instr/ProbeArrayStrategyFactory.java | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)

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 9df681b3..14bd7d4f 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
@@ -51,10 +51,10 @@ public final class ProbeArrayStrategyFactory {
if (counter.getCount() == 0) {
return new NoneProbeArrayStrategy();
}
- if (version >= Opcodes.V11 && counter.hasMethods()) {
- return new CondyProbeArrayStrategy(className, true, classId,
- accessorGenerator);
- }
+ // if (version >= Opcodes.V11 && counter.hasMethods()) {
+ // return new CondyProbeArrayStrategy(className, true, classId,
+ // accessorGenerator);
+ // }
if (version >= Opcodes.V1_8 && counter.hasMethods()) {
return new InterfaceFieldProbeArrayStrategy(className, classId,
counter.getCount(), accessorGenerator);
@@ -63,10 +63,10 @@ public final class ProbeArrayStrategyFactory {
counter.getCount(), accessorGenerator);
}
} else {
- if (version >= Opcodes.V11) {
- return new CondyProbeArrayStrategy(className, false, classId,
- accessorGenerator);
- }
+ // if (version >= Opcodes.V11) {
+ // return new CondyProbeArrayStrategy(className, false, classId,
+ // accessorGenerator);
+ // }
return new ClassFieldProbeArrayStrategy(className, classId,
InstrSupport.needsFrames(version), accessorGenerator);
}
--
2.30.0.365.g02bc693789-goog

Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
From ba1b0877135b31147abfdab44890e95403248c3b Mon Sep 17 00:00:00 2001
From: Liam Miller-Cushon <cushon@google.com>
Date: Thu, 28 Jan 2021 22:18:36 -0800
Subject: [PATCH 2/2] Partially revert 40c8fd89b0bc0c36e30e6a12f5b42d9da13aca86

See b/177687001#comment5.
---
.../org/jacoco/agent/rt/internal/Agent.java | 9 +++----
.../org/jacoco/agent/rt/internal/Offline.java | 24 +++++++------------
2 files changed, 11 insertions(+), 22 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 c32294e4..b6b2af20 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
@@ -44,11 +44,8 @@ public class Agent implements IAgent {
* @param options
* options to configure the instance
* @return global instance
- * @throws Exception
- * in case something cannot be initialized
*/
- public static synchronized Agent getInstance(final AgentOptions options)
- throws Exception {
+ public static synchronized Agent getInstance(final AgentOptions options) {
if (singleton == null) {
final Agent agent = new Agent(options, IExceptionLogger.SYSTEM_ERR);
agent.startup();
@@ -117,8 +114,9 @@ public class Agent implements IAgent {
*
* @throws Exception
* in case something cannot be initialized
+ *
*/
- public void startup() throws Exception {
+ public void startup() {
try {
String sessionId = options.getSessionId();
if (sessionId == null) {
@@ -132,7 +130,6 @@ public class Agent implements IAgent {
}
} catch (final Exception e) {
logger.logExeption(e);
- throw e;
}
}

diff --git a/org.jacoco.agent.rt/src/org/jacoco/agent/rt/internal/Offline.java b/org.jacoco.agent.rt/src/org/jacoco/agent/rt/internal/Offline.java
index 10a742bd..af83c769 100644
--- a/org.jacoco.agent.rt/src/org/jacoco/agent/rt/internal/Offline.java
+++ b/org.jacoco.agent.rt/src/org/jacoco/agent/rt/internal/Offline.java
@@ -23,25 +23,17 @@ import org.jacoco.core.runtime.RuntimeData;
*/
public final class Offline {

+ private static final RuntimeData DATA;
private static final String CONFIG_RESOURCE = "/jacoco-agent.properties";

- private Offline() {
- // no instances
+ static {
+ final Properties config = ConfigLoader.load(CONFIG_RESOURCE,
+ System.getProperties());
+ DATA = Agent.getInstance(new AgentOptions(config)).getData();
}

- private static RuntimeData data;
-
- private static synchronized RuntimeData getRuntimeData() {
- if (data == null) {
- final Properties config = ConfigLoader.load(CONFIG_RESOURCE,
- System.getProperties());
- try {
- data = Agent.getInstance(new AgentOptions(config)).getData();
- } catch (final Exception e) {
- throw new RuntimeException("Failed to initialize JaCoCo.", e);
- }
- }
- return data;
+ private Offline() {
+ // no instances
}

/**
@@ -57,7 +49,7 @@ public final class Offline {
*/
public static boolean[] getProbes(final long classid,
final String classname, final int probecount) {
- return getRuntimeData()
+ return DATA
.getExecutionData(Long.valueOf(classid), classname, probecount)
.getProbes();
}
--
2.30.0.365.g02bc693789-goog

Loading

0 comments on commit 4f7db2b

Please sign in to comment.