aboutsummaryrefslogtreecommitdiff
path: root/org.jacoco.core/src/org/jacoco/core
diff options
context:
space:
mode:
authorAllen Hair <allenhair@google.com>2022-03-22 17:50:58 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-03-22 17:50:58 +0000
commit18a980206d62b715d1bb9a0b411413b2d0d5ee6f (patch)
treee68ce50b1fc964c12a1eb020ca8b2483ff2955d4 /org.jacoco.core/src/org/jacoco/core
parentcf92214db05a512b30c7c8f842855208ae450580 (diff)
parent2f01fe494ff8b031970daf329253df53ef60dde3 (diff)
downloadjacoco-18a980206d62b715d1bb9a0b411413b2d0d5ee6f.tar.gz
Merge "Update jacoco to 0.8.7." am: 46c6f6b353 am: 7398ddd230 am: 2f01fe494ft_frc_odp_330442040t_frc_odp_330442000t_frc_ase_330444010android-13.0.0_r83android-13.0.0_r82android-13.0.0_r81android-13.0.0_r80android-13.0.0_r79android-13.0.0_r78android-13.0.0_r77android-13.0.0_r76android-13.0.0_r75android-13.0.0_r74android-13.0.0_r73android-13.0.0_r72android-13.0.0_r71android-13.0.0_r70android-13.0.0_r69android-13.0.0_r68android-13.0.0_r67android-13.0.0_r66android-13.0.0_r65android-13.0.0_r64android-13.0.0_r63android-13.0.0_r62android-13.0.0_r61android-13.0.0_r60android-13.0.0_r59android-13.0.0_r58android-13.0.0_r57android-13.0.0_r56android-13.0.0_r54android-13.0.0_r53android-13.0.0_r52android-13.0.0_r51android-13.0.0_r50android-13.0.0_r49android-13.0.0_r48android-13.0.0_r47android-13.0.0_r46android-13.0.0_r45android-13.0.0_r44android-13.0.0_r43android-13.0.0_r42android-13.0.0_r41android-13.0.0_r40android-13.0.0_r39android-13.0.0_r38android-13.0.0_r37android-13.0.0_r36android-13.0.0_r35android-13.0.0_r34android-13.0.0_r33android-13.0.0_r32aml_go_odp_330912000aml_go_ads_330915100aml_go_ads_330915000aml_go_ads_330913000android13-qpr3-s9-releaseandroid13-qpr3-s8-releaseandroid13-qpr3-s7-releaseandroid13-qpr3-s6-releaseandroid13-qpr3-s5-releaseandroid13-qpr3-s4-releaseandroid13-qpr3-s3-releaseandroid13-qpr3-s2-releaseandroid13-qpr3-s14-releaseandroid13-qpr3-s13-releaseandroid13-qpr3-s12-releaseandroid13-qpr3-s11-releaseandroid13-qpr3-s10-releaseandroid13-qpr3-s1-releaseandroid13-qpr3-releaseandroid13-qpr3-c-s8-releaseandroid13-qpr3-c-s7-releaseandroid13-qpr3-c-s6-releaseandroid13-qpr3-c-s5-releaseandroid13-qpr3-c-s4-releaseandroid13-qpr3-c-s3-releaseandroid13-qpr3-c-s2-releaseandroid13-qpr3-c-s12-releaseandroid13-qpr3-c-s11-releaseandroid13-qpr3-c-s10-releaseandroid13-qpr3-c-s1-releaseandroid13-qpr2-s9-releaseandroid13-qpr2-s8-releaseandroid13-qpr2-s7-releaseandroid13-qpr2-s6-releaseandroid13-qpr2-s5-releaseandroid13-qpr2-s3-releaseandroid13-qpr2-s2-releaseandroid13-qpr2-s12-releaseandroid13-qpr2-s11-releaseandroid13-qpr2-s10-releaseandroid13-qpr2-s1-releaseandroid13-qpr2-releaseandroid13-qpr2-b-s1-releaseandroid13-mainline-go-adservices-releaseandroid13-frc-odp-releaseandroid13-devandroid13-d4-s2-releaseandroid13-d4-s1-releaseandroid13-d4-releaseandroid13-d3-s1-release
Original change: https://android-review.googlesource.com/c/platform/external/jacoco/+/2015697 Change-Id: Ie848d2ff33b291aa64d065bf2e3ede1dbd861b97
Diffstat (limited to 'org.jacoco.core/src/org/jacoco/core')
-rw-r--r--org.jacoco.core/src/org/jacoco/core/JaCoCo.java13
-rw-r--r--org.jacoco.core/src/org/jacoco/core/analysis/Analyzer.java27
-rw-r--r--org.jacoco.core/src/org/jacoco/core/analysis/CounterComparator.java17
-rw-r--r--org.jacoco.core/src/org/jacoco/core/analysis/CoverageBuilder.java25
-rw-r--r--org.jacoco.core/src/org/jacoco/core/analysis/CoverageNodeImpl.java27
-rw-r--r--org.jacoco.core/src/org/jacoco/core/analysis/IBundleCoverage.java17
-rw-r--r--org.jacoco.core/src/org/jacoco/core/analysis/IClassCoverage.java31
-rw-r--r--org.jacoco.core/src/org/jacoco/core/analysis/ICounter.java29
-rw-r--r--org.jacoco.core/src/org/jacoco/core/analysis/ICoverageNode.java36
-rw-r--r--org.jacoco.core/src/org/jacoco/core/analysis/ICoverageVisitor.java15
-rw-r--r--org.jacoco.core/src/org/jacoco/core/analysis/ILine.java21
-rw-r--r--org.jacoco.core/src/org/jacoco/core/analysis/IMethodCoverage.java17
-rw-r--r--org.jacoco.core/src/org/jacoco/core/analysis/IPackageCoverage.java19
-rw-r--r--org.jacoco.core/src/org/jacoco/core/analysis/ISourceFileCoverage.java15
-rw-r--r--org.jacoco.core/src/org/jacoco/core/analysis/ISourceNode.java19
-rw-r--r--org.jacoco.core/src/org/jacoco/core/analysis/NodeComparator.java24
-rw-r--r--org.jacoco.core/src/org/jacoco/core/analysis/package-info.java18
-rw-r--r--org.jacoco.core/src/org/jacoco/core/data/ExecutionData.java63
-rw-r--r--org.jacoco.core/src/org/jacoco/core/data/ExecutionDataReader.java35
-rw-r--r--org.jacoco.core/src/org/jacoco/core/data/ExecutionDataStore.java27
-rw-r--r--org.jacoco.core/src/org/jacoco/core/data/ExecutionDataWriter.java29
-rw-r--r--org.jacoco.core/src/org/jacoco/core/data/IExecutionDataVisitor.java15
-rw-r--r--org.jacoco.core/src/org/jacoco/core/data/ISessionInfoVisitor.java15
-rw-r--r--org.jacoco.core/src/org/jacoco/core/data/IncompatibleExecDataVersionException.java19
-rw-r--r--org.jacoco.core/src/org/jacoco/core/data/SessionInfo.java15
-rw-r--r--org.jacoco.core/src/org/jacoco/core/data/SessionInfoStore.java23
-rw-r--r--org.jacoco.core/src/org/jacoco/core/data/package-info.java13
-rw-r--r--org.jacoco.core/src/org/jacoco/core/instr/Instrumenter.java65
-rw-r--r--org.jacoco.core/src/org/jacoco/core/instr/package-info.java17
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/ContentTypeDetector.java47
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/InputStreams.java11
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/Pack200Streams.java194
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/analysis/BundleCoverageImpl.java21
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/analysis/ClassAnalyzer.java27
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/analysis/ClassCoverageImpl.java28
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/analysis/CounterImpl.java26
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/analysis/Instruction.java51
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/analysis/InstructionsBuilder.java23
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/analysis/LineImpl.java25
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/analysis/MethodAnalyzer.java20
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/analysis/MethodCoverageCalculator.java24
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/analysis/MethodCoverageImpl.java22
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/analysis/PackageCoverageImpl.java19
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/analysis/SourceFileCoverageImpl.java19
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/analysis/SourceNodeImpl.java29
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/analysis/StringPool.java19
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/AbstractMatcher.java13
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/AnnotationGeneratedFilter.java11
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/BridgeFilter.java32
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/EnumEmptyConstructorFilter.java11
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/EnumFilter.java11
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/Filters.java22
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/FinallyFilter.java15
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/IFilter.java11
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/IFilterContext.java102
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/IFilterOutput.java13
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinCoroutineFilter.java53
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinDefaultArgumentsFilter.java95
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinDefaultMethodsFilter.java46
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinGeneratedFilter.java14
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinInlineFilter.java20
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinLateinitFilter.java24
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinNotNullOperatorFilter.java14
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinUnsafeCastOperatorFilter.java37
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinWhenFilter.java19
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinWhenStringFilter.java44
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/PrivateEmptyNoArgConstructorFilter.java11
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/RecordsFilter.java89
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/StringSwitchFilter.java (renamed from org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/StringSwitchEcjFilter.java)26
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/StringSwitchJavacFilter.java15
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/SynchronizedFilter.java11
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/SyntheticFilter.java32
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/TryWithResourcesEcjFilter.java11
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/TryWithResourcesJavac11Filter.java13
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/TryWithResourcesJavacFilter.java13
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/data/CRC64.java15
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/data/CompactDataInput.java21
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/data/CompactDataOutput.java21
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/flow/ClassProbesAdapter.java22
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/flow/ClassProbesVisitor.java17
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/flow/FrameSnapshot.java18
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/flow/IFrame.java15
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/flow/IProbeIdGenerator.java15
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/flow/LabelFlowAnalyzer.java15
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/flow/LabelInfo.java47
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/flow/MethodProbesAdapter.java25
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/flow/MethodProbesVisitor.java25
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/flow/MethodSanitizer.java19
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/instr/ClassFieldProbeArrayStrategy.java20
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/instr/ClassInstrumenter.java18
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/instr/CondyProbeArrayStrategy.java13
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/instr/DuplicateFrameEliminator.java13
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/instr/IProbeArrayStrategy.java17
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/instr/IProbeInserter.java15
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/instr/InstrSupport.java25
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/instr/InterfaceFieldProbeArrayStrategy.java14
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/instr/LocalProbeArrayStrategy.java13
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/instr/MethodInstrumenter.java18
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/instr/NoneProbeArrayStrategy.java13
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/instr/ProbeArrayStrategyFactory.java13
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/instr/ProbeCounter.java16
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/instr/ProbeInserter.java33
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/instr/SignatureRemover.java22
-rw-r--r--org.jacoco.core/src/org/jacoco/core/jacoco.properties3
-rw-r--r--org.jacoco.core/src/org/jacoco/core/package-info.java13
-rw-r--r--org.jacoco.core/src/org/jacoco/core/runtime/AbstractRuntime.java15
-rw-r--r--org.jacoco.core/src/org/jacoco/core/runtime/AgentOptions.java95
-rw-r--r--org.jacoco.core/src/org/jacoco/core/runtime/CommandLineSupport.java19
-rw-r--r--org.jacoco.core/src/org/jacoco/core/runtime/IExecutionDataAccessorGenerator.java17
-rw-r--r--org.jacoco.core/src/org/jacoco/core/runtime/IRemoteCommandVisitor.java15
-rw-r--r--org.jacoco.core/src/org/jacoco/core/runtime/IRuntime.java15
-rw-r--r--org.jacoco.core/src/org/jacoco/core/runtime/InjectedClassRuntime.java11
-rw-r--r--org.jacoco.core/src/org/jacoco/core/runtime/LoggerRuntime.java19
-rw-r--r--org.jacoco.core/src/org/jacoco/core/runtime/ModifiedSystemClassRuntime.java47
-rw-r--r--org.jacoco.core/src/org/jacoco/core/runtime/OfflineInstrumentationAccessGenerator.java19
-rw-r--r--org.jacoco.core/src/org/jacoco/core/runtime/RemoteControlReader.java17
-rw-r--r--org.jacoco.core/src/org/jacoco/core/runtime/RemoteControlWriter.java21
-rw-r--r--org.jacoco.core/src/org/jacoco/core/runtime/RuntimeData.java45
-rw-r--r--org.jacoco.core/src/org/jacoco/core/runtime/SystemPropertiesRuntime.java19
-rw-r--r--org.jacoco.core/src/org/jacoco/core/runtime/URLStreamHandlerRuntime.java149
-rw-r--r--org.jacoco.core/src/org/jacoco/core/runtime/WildcardMatcher.java17
-rw-r--r--org.jacoco.core/src/org/jacoco/core/runtime/package-info.java13
-rw-r--r--org.jacoco.core/src/org/jacoco/core/tools/ExecDumpClient.java29
-rw-r--r--org.jacoco.core/src/org/jacoco/core/tools/ExecFileLoader.java28
-rw-r--r--org.jacoco.core/src/org/jacoco/core/tools/package-info.java13
125 files changed, 1840 insertions, 1476 deletions
diff --git a/org.jacoco.core/src/org/jacoco/core/JaCoCo.java b/org.jacoco.core/src/org/jacoco/core/JaCoCo.java
index ce9ec053..32ab8085 100644
--- a/org.jacoco.core/src/org/jacoco/core/JaCoCo.java
+++ b/org.jacoco.core/src/org/jacoco/core/JaCoCo.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core;
diff --git a/org.jacoco.core/src/org/jacoco/core/analysis/Analyzer.java b/org.jacoco.core/src/org/jacoco/core/analysis/Analyzer.java
index 7759b89d..b3a34d25 100644
--- a/org.jacoco.core/src/org/jacoco/core/analysis/Analyzer.java
+++ b/org.jacoco.core/src/org/jacoco/core/analysis/Analyzer.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.analysis;
@@ -53,7 +54,7 @@ public class Analyzer {
/**
* Creates a new analyzer reporting to the given output.
- *
+ *
* @param executionData
* execution data
* @param coverageVisitor
@@ -69,7 +70,7 @@ public class Analyzer {
/**
* Creates an ASM class visitor for analysis.
- *
+ *
* @param classid
* id of the class calculated with {@link CRC64}
* @param className
@@ -119,7 +120,7 @@ public class Analyzer {
/**
* Analyzes the class definition from a given in-memory buffer.
- *
+ *
* @param buffer
* class definitions
* @param location
@@ -139,7 +140,7 @@ public class Analyzer {
/**
* Analyzes the class definition from a given input stream. The provided
* {@link InputStream} is not closed by this method.
- *
+ *
* @param input
* stream to read class definition from
* @param location
@@ -172,7 +173,7 @@ public class Analyzer {
* archive or a gzip stream that is searched recursively for class files.
* All other content types are ignored. The provided {@link InputStream} is
* not closed by this method.
- *
+ *
* @param input
* input data
* @param location
@@ -208,7 +209,7 @@ public class Analyzer {
* Analyzes all class files contained in the given file or folder. Class
* files as well as ZIP files are considered. Folders are searched
* recursively.
- *
+ *
* @param file
* file or folder to look for class files
* @return number of class files found
@@ -235,7 +236,7 @@ public class Analyzer {
/**
* Analyzes all classes from the given class path. Directories containing
* class files as well as archive files are considered.
- *
+ *
* @param path
* path definition
* @param basedir
diff --git a/org.jacoco.core/src/org/jacoco/core/analysis/CounterComparator.java b/org.jacoco.core/src/org/jacoco/core/analysis/CounterComparator.java
index 8a67b970..6fe69c6c 100644
--- a/org.jacoco.core/src/org/jacoco/core/analysis/CounterComparator.java
+++ b/org.jacoco.core/src/org/jacoco/core/analysis/CounterComparator.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.analysis;
@@ -74,7 +75,7 @@ public class CounterComparator implements Comparator<ICounter>, Serializable {
/**
* Creates a new version of this comparator that sorts in reverse order.
- *
+ *
* @return reverse comparator
*/
public CounterComparator reverse() {
@@ -84,7 +85,7 @@ public class CounterComparator implements Comparator<ICounter>, Serializable {
/**
* Creates a new comparator for {@link ICoverageNode} counters of the given
* entity based on this counter sorting criteria.
- *
+ *
* @param entity
* counter entity to sort on
* @return comparator for {@link ICoverageNode} elements
diff --git a/org.jacoco.core/src/org/jacoco/core/analysis/CoverageBuilder.java b/org.jacoco.core/src/org/jacoco/core/analysis/CoverageBuilder.java
index 784fbd82..2f99f0b1 100644
--- a/org.jacoco.core/src/org/jacoco/core/analysis/CoverageBuilder.java
+++ b/org.jacoco.core/src/org/jacoco/core/analysis/CoverageBuilder.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.analysis;
@@ -26,7 +27,7 @@ import org.jacoco.core.internal.analysis.SourceFileCoverageImpl;
* {@link ICoverageVisitor} interface. Afterwards the aggregated data can be
* obtained with {@link #getClasses()}, {@link #getSourceFiles()} or
* {@link #getBundle(String)} in the following hierarchy:
- *
+ *
* <pre>
* {@link IBundleCoverage}
* +-- {@link IPackageCoverage}*
@@ -42,7 +43,7 @@ public class CoverageBuilder implements ICoverageVisitor {
/**
* Create a new builder.
- *
+ *
*/
public CoverageBuilder() {
this.classes = new HashMap<String, IClassCoverage>();
@@ -51,7 +52,7 @@ public class CoverageBuilder implements ICoverageVisitor {
/**
* Returns all class nodes currently contained in this builder.
- *
+ *
* @return all class nodes
*/
public Collection<IClassCoverage> getClasses() {
@@ -60,7 +61,7 @@ public class CoverageBuilder implements ICoverageVisitor {
/**
* Returns all source file nodes currently contained in this builder.
- *
+ *
* @return all source file nodes
*/
public Collection<ISourceFileCoverage> getSourceFiles() {
@@ -69,7 +70,7 @@ public class CoverageBuilder implements ICoverageVisitor {
/**
* Creates a bundle from all nodes currently contained in this bundle.
- *
+ *
* @param name
* Name of the bundle
* @return bundle containing all classes and source files
@@ -81,7 +82,7 @@ public class CoverageBuilder implements ICoverageVisitor {
/**
* Returns all classes for which execution data does not match.
- *
+ *
* @see IClassCoverage#isNoMatch()
* @return collection of classes with non-matching execution data
*/
diff --git a/org.jacoco.core/src/org/jacoco/core/analysis/CoverageNodeImpl.java b/org.jacoco.core/src/org/jacoco/core/analysis/CoverageNodeImpl.java
index 6be3bb6f..db8045be 100644
--- a/org.jacoco.core/src/org/jacoco/core/analysis/CoverageNodeImpl.java
+++ b/org.jacoco.core/src/org/jacoco/core/analysis/CoverageNodeImpl.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.analysis;
@@ -44,7 +45,7 @@ public class CoverageNodeImpl implements ICoverageNode {
/**
* Creates a new coverage data node.
- *
+ *
* @param elementType
* type of the element represented by this instance
* @param name
@@ -63,17 +64,17 @@ public class CoverageNodeImpl implements ICoverageNode {
/**
* Increments the counters by the values given by another element.
- *
+ *
* @param child
* counters to add
*/
public void increment(final ICoverageNode child) {
- instructionCounter = instructionCounter.increment(child
- .getInstructionCounter());
+ instructionCounter = instructionCounter
+ .increment(child.getInstructionCounter());
branchCounter = branchCounter.increment(child.getBranchCounter());
lineCounter = lineCounter.increment(child.getLineCounter());
- complexityCounter = complexityCounter.increment(child
- .getComplexityCounter());
+ complexityCounter = complexityCounter
+ .increment(child.getComplexityCounter());
methodCounter = methodCounter.increment(child.getMethodCounter());
classCounter = classCounter.increment(child.getClassCounter());
}
@@ -81,7 +82,7 @@ public class CoverageNodeImpl implements ICoverageNode {
/**
* Increments the counters by the values given by the collection of
* elements.
- *
+ *
* @param children
* list of nodes, which counters will be added to this node
*/
diff --git a/org.jacoco.core/src/org/jacoco/core/analysis/IBundleCoverage.java b/org.jacoco.core/src/org/jacoco/core/analysis/IBundleCoverage.java
index d488f475..aa23a95c 100644
--- a/org.jacoco.core/src/org/jacoco/core/analysis/IBundleCoverage.java
+++ b/org.jacoco.core/src/org/jacoco/core/analysis/IBundleCoverage.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.analysis;
@@ -15,14 +16,14 @@ import java.util.Collection;
/**
* Coverage data of a bundle. A bundle groups a collection of packages.
- *
+ *
* @see IPackageCoverage
*/
public interface IBundleCoverage extends ICoverageNode {
/**
* Returns all packages contained in this bundle.
- *
+ *
* @return all packages
*/
Collection<IPackageCoverage> getPackages();
diff --git a/org.jacoco.core/src/org/jacoco/core/analysis/IClassCoverage.java b/org.jacoco.core/src/org/jacoco/core/analysis/IClassCoverage.java
index 81cc6fe7..071c7c07 100644
--- a/org.jacoco.core/src/org/jacoco/core/analysis/IClassCoverage.java
+++ b/org.jacoco.core/src/org/jacoco/core/analysis/IClassCoverage.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.analysis;
@@ -16,7 +17,7 @@ import java.util.Collection;
/**
* Coverage data of a single class containing methods. The name of this node is
* the fully qualified class name in VM notation (slash separated).
- *
+ *
* @see IMethodCoverage
*/
public interface IClassCoverage extends ISourceNode {
@@ -24,7 +25,7 @@ public interface IClassCoverage extends ISourceNode {
/**
* Returns the identifier for this class which is the CRC64 signature of the
* class definition.
- *
+ *
* @return class identifier
*/
long getId();
@@ -33,7 +34,7 @@ public interface IClassCoverage extends ISourceNode {
* Returns if the the analyzed class does match the execution data provided.
* More precisely if execution data is available for a class with the same
* qualified name but with a different class id.
- *
+ *
* @return <code>true</code> if this class does not match to the provided
* execution data.
*/
@@ -41,14 +42,14 @@ public interface IClassCoverage extends ISourceNode {
/**
* Returns the VM signature of the class.
- *
+ *
* @return VM signature of the class (may be <code>null</code>)
*/
String getSignature();
/**
* Returns the VM name of the superclass.
- *
+ *
* @return VM name of the super class (may be <code>null</code>, i.e.
* <code>java/lang/Object</code>)
*/
@@ -56,28 +57,28 @@ public interface IClassCoverage extends ISourceNode {
/**
* Returns the VM names of implemented/extended interfaces.
- *
+ *
* @return VM names of implemented/extended interfaces
*/
String[] getInterfaceNames();
/**
* Returns the VM name of the package this class belongs to.
- *
+ *
* @return VM name of the package
*/
String getPackageName();
/**
* Returns the optional name of the corresponding source file.
- *
+ *
* @return name of the corresponding source file
*/
String getSourceFileName();
/**
* Returns the methods included in this class.
- *
+ *
* @return methods of this class
*/
Collection<IMethodCoverage> getMethods();
diff --git a/org.jacoco.core/src/org/jacoco/core/analysis/ICounter.java b/org.jacoco.core/src/org/jacoco/core/analysis/ICounter.java
index 60c8dcc5..f7e6adb0 100644
--- a/org.jacoco.core/src/org/jacoco/core/analysis/ICounter.java
+++ b/org.jacoco.core/src/org/jacoco/core/analysis/ICounter.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.analysis;
@@ -60,7 +61,7 @@ public interface ICounter {
/**
* Returns the counter value of the given type.
- *
+ *
* @param value
* value type to return
* @return counter value
@@ -69,21 +70,21 @@ public interface ICounter {
/**
* Returns the total count of items.
- *
+ *
* @return total count of items
*/
int getTotalCount();
/**
* Returns the count of covered items.
- *
+ *
* @return count of covered items
*/
int getCoveredCount();
/**
* Returns the count of missed items.
- *
+ *
* @return count of missed items
*/
int getMissedCount();
@@ -91,7 +92,7 @@ public interface ICounter {
/**
* Calculates the ratio of covered to total count items. If total count
* items is 0 this method returns NaN.
- *
+ *
* @return ratio of covered to total count items
*/
double getCoveredRatio();
@@ -99,19 +100,19 @@ public interface ICounter {
/**
* Calculates the ratio of missed to total count items. If total count items
* is 0 this method returns NaN.
- *
+ *
* @return ratio of missed to total count items
*/
double getMissedRatio();
/**
* Returns the coverage status of this counter.
- *
+ *
* @see ICounter#EMPTY
* @see ICounter#NOT_COVERED
* @see ICounter#PARTLY_COVERED
* @see ICounter#FULLY_COVERED
- *
+ *
* @return status of this line
*/
int getStatus();
diff --git a/org.jacoco.core/src/org/jacoco/core/analysis/ICoverageNode.java b/org.jacoco.core/src/org/jacoco/core/analysis/ICoverageNode.java
index 20b107d4..ddb765a3 100644
--- a/org.jacoco.core/src/org/jacoco/core/analysis/ICoverageNode.java
+++ b/org.jacoco.core/src/org/jacoco/core/analysis/ICoverageNode.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.analysis;
@@ -68,63 +69,63 @@ public interface ICoverageNode {
/**
* Returns the type of element represented by this node.
- *
+ *
* @return type of this node
*/
ElementType getElementType();
/**
* Returns the name of this node.
- *
+ *
* @return name of this node
*/
String getName();
/**
* Returns the counter for byte code instructions.
- *
+ *
* @return counter for instructions
*/
ICounter getInstructionCounter();
/**
* Returns the counter for branches.
- *
+ *
* @return counter for branches
*/
ICounter getBranchCounter();
/**
* Returns the counter for lines.
- *
+ *
* @return counter for lines
*/
ICounter getLineCounter();
/**
* Returns the counter for cyclomatic complexity.
- *
+ *
* @return counter for complexity
*/
ICounter getComplexityCounter();
/**
* Returns the counter for methods.
- *
+ *
* @return counter for methods
*/
ICounter getMethodCounter();
/**
* Returns the counter for classes.
- *
+ *
* @return counter for classes
*/
ICounter getClassCounter();
/**
* Generic access to the the counters.
- *
+ *
* @param entity
* entity we're we want to have the counter for
* @return counter for the given entity
@@ -134,7 +135,8 @@ public interface ICoverageNode {
/**
* Checks whether this node contains code relevant for code coverage.
*
- * @return <code>true</code> if this node contains code relevant for code coverage
+ * @return <code>true</code> if this node contains code relevant for code
+ * coverage
*/
boolean containsCode();
@@ -143,7 +145,7 @@ public interface ICoverageNode {
* implementations may contain heavy data structures, the copy returned by
* this method is reduced to the counters only. This helps to save memory
* while processing huge structures.
- *
+ *
* @return copy with counters only
*/
ICoverageNode getPlainCopy();
diff --git a/org.jacoco.core/src/org/jacoco/core/analysis/ICoverageVisitor.java b/org.jacoco.core/src/org/jacoco/core/analysis/ICoverageVisitor.java
index 3f702906..06fe9b7e 100644
--- a/org.jacoco.core/src/org/jacoco/core/analysis/ICoverageVisitor.java
+++ b/org.jacoco.core/src/org/jacoco/core/analysis/ICoverageVisitor.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.analysis;
@@ -19,7 +20,7 @@ public interface ICoverageVisitor {
/**
* For analyzed class coverage data is emitted to this method.
- *
+ *
* @param coverage
* coverage data for a class
*/
diff --git a/org.jacoco.core/src/org/jacoco/core/analysis/ILine.java b/org.jacoco.core/src/org/jacoco/core/analysis/ILine.java
index ef65dc0d..37a07240 100644
--- a/org.jacoco.core/src/org/jacoco/core/analysis/ILine.java
+++ b/org.jacoco.core/src/org/jacoco/core/analysis/ILine.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.analysis;
@@ -19,14 +20,14 @@ public interface ILine {
/**
* Returns the instruction counter for this line.
- *
+ *
* @return instruction counter
*/
ICounter getInstructionCounter();
/**
* Returns the branches counter for this line.
- *
+ *
* @return branches counter
*/
ICounter getBranchCounter();
@@ -34,12 +35,12 @@ public interface ILine {
/**
* Returns the coverage status of this line, calculated from the
* instructions counter and branch counter.
- *
+ *
* @see ICounter#EMPTY
* @see ICounter#NOT_COVERED
* @see ICounter#PARTLY_COVERED
* @see ICounter#FULLY_COVERED
- *
+ *
* @return status of this line
*/
int getStatus();
diff --git a/org.jacoco.core/src/org/jacoco/core/analysis/IMethodCoverage.java b/org.jacoco.core/src/org/jacoco/core/analysis/IMethodCoverage.java
index b6755170..1e278878 100644
--- a/org.jacoco.core/src/org/jacoco/core/analysis/IMethodCoverage.java
+++ b/org.jacoco.core/src/org/jacoco/core/analysis/IMethodCoverage.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.analysis;
@@ -19,14 +20,14 @@ public interface IMethodCoverage extends ISourceNode {
/**
* Returns the descriptor of the method.
- *
+ *
* @return descriptor
*/
String getDesc();
/**
* Returns the generic signature of the method if defined.
- *
+ *
* @return generic signature or <code>null</code>
*/
String getSignature();
diff --git a/org.jacoco.core/src/org/jacoco/core/analysis/IPackageCoverage.java b/org.jacoco.core/src/org/jacoco/core/analysis/IPackageCoverage.java
index 32121620..b4c56a4a 100644
--- a/org.jacoco.core/src/org/jacoco/core/analysis/IPackageCoverage.java
+++ b/org.jacoco.core/src/org/jacoco/core/analysis/IPackageCoverage.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.analysis;
@@ -17,7 +18,7 @@ import java.util.Collection;
* Coverage data of a Java package containing classes and source files. The name
* of this node is the package name in VM notation (slash separated). The name
* of the default package is the empty string.
- *
+ *
* @see IClassCoverage
* @see ISourceFileCoverage
*/
@@ -25,14 +26,14 @@ public interface IPackageCoverage extends ICoverageNode {
/**
* Returns all classes contained in this package.
- *
+ *
* @return all classes
*/
Collection<IClassCoverage> getClasses();
/**
* Returns all source files in this package.
- *
+ *
* @return all source files
*/
Collection<ISourceFileCoverage> getSourceFiles();
diff --git a/org.jacoco.core/src/org/jacoco/core/analysis/ISourceFileCoverage.java b/org.jacoco.core/src/org/jacoco/core/analysis/ISourceFileCoverage.java
index 5f01160a..67dfa0d8 100644
--- a/org.jacoco.core/src/org/jacoco/core/analysis/ISourceFileCoverage.java
+++ b/org.jacoco.core/src/org/jacoco/core/analysis/ISourceFileCoverage.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.analysis;
@@ -19,7 +20,7 @@ public interface ISourceFileCoverage extends ISourceNode {
/**
* Returns the VM name of the package the source file belongs to.
- *
+ *
* @return package name
*/
String getPackageName();
diff --git a/org.jacoco.core/src/org/jacoco/core/analysis/ISourceNode.java b/org.jacoco.core/src/org/jacoco/core/analysis/ISourceNode.java
index d64b2cc1..8fd26fe1 100644
--- a/org.jacoco.core/src/org/jacoco/core/analysis/ISourceNode.java
+++ b/org.jacoco.core/src/org/jacoco/core/analysis/ISourceNode.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.analysis;
@@ -23,7 +24,7 @@ public interface ISourceNode extends ICoverageNode {
/**
* The number of the first line coverage information is available for. If no
* line is contained, the method returns -1.
- *
+ *
* @return number of the first line or {@link #UNKNOWN_LINE}
*/
int getFirstLine();
@@ -31,14 +32,14 @@ public interface ISourceNode extends ICoverageNode {
/**
* The number of the last line coverage information is available for. If no
* line is contained, the method returns -1.
- *
+ *
* @return number of the last line or {@link #UNKNOWN_LINE}
*/
int getLastLine();
/**
* Returns the line information for given line.
- *
+ *
* @param nr
* line number of interest
* @return line information
diff --git a/org.jacoco.core/src/org/jacoco/core/analysis/NodeComparator.java b/org.jacoco.core/src/org/jacoco/core/analysis/NodeComparator.java
index 3fea25fb..85058f93 100644
--- a/org.jacoco.core/src/org/jacoco/core/analysis/NodeComparator.java
+++ b/org.jacoco.core/src/org/jacoco/core/analysis/NodeComparator.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.analysis;
@@ -23,7 +24,7 @@ import org.jacoco.core.analysis.ICoverageNode.CounterEntity;
/**
* Comparator to compare {@link ICoverageNode} objects by different counter
* criteria.
- *
+ *
* @see CounterComparator#on(ICoverageNode.CounterEntity)
*/
public class NodeComparator implements Comparator<ICoverageNode>, Serializable {
@@ -42,10 +43,10 @@ public class NodeComparator implements Comparator<ICoverageNode>, Serializable {
/**
* Creates a new composite comparator with a second search criterion.
- *
+ *
* @param second
* second criterion comparator
- *
+ *
* @return composite comparator
*/
public NodeComparator second(final Comparator<ICoverageNode> second) {
@@ -65,14 +66,15 @@ public class NodeComparator implements Comparator<ICoverageNode>, Serializable {
/**
* Returns a sorted copy of the given collection of {@link ICoverageNode}
* elements.
- *
+ *
* @param <T>
* actual type of the elements
* @param summaries
* collection to create a copy of
* @return sorted copy
*/
- public <T extends ICoverageNode> List<T> sort(final Collection<T> summaries) {
+ public <T extends ICoverageNode> List<T> sort(
+ final Collection<T> summaries) {
final List<T> result = new ArrayList<T>(summaries);
Collections.sort(result, this);
return result;
diff --git a/org.jacoco.core/src/org/jacoco/core/analysis/package-info.java b/org.jacoco.core/src/org/jacoco/core/analysis/package-info.java
index d1a5e73b..4f83a0c4 100644
--- a/org.jacoco.core/src/org/jacoco/core/analysis/package-info.java
+++ b/org.jacoco.core/src/org/jacoco/core/analysis/package-info.java
@@ -1,22 +1,22 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
/**
* <p>
* Coverage calculation and analysis. The coverage information is calculated
* with an {@link org.jacoco.core.analysis.Analyzer} instance from class files
- * (target) and
- * {@linkplain org.jacoco.core.data.IExecutionDataVisitor execution data}
- * (actual).
+ * (target) and {@linkplain org.jacoco.core.data.IExecutionDataVisitor execution
+ * data} (actual).
* </p>
*
* <p>
diff --git a/org.jacoco.core/src/org/jacoco/core/data/ExecutionData.java b/org.jacoco.core/src/org/jacoco/core/data/ExecutionData.java
index a728e033..a22c0235 100644
--- a/org.jacoco.core/src/org/jacoco/core/data/ExecutionData.java
+++ b/org.jacoco.core/src/org/jacoco/core/data/ExecutionData.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.data;
@@ -32,7 +33,7 @@ public final class ExecutionData implements IExecutionData {
/**
* Creates a new {@link ExecutionData} object with the given probe data.
- *
+ *
* @param id
* class identifier
* @param name
@@ -50,7 +51,7 @@ public final class ExecutionData implements IExecutionData {
/**
* Creates a new {@link ExecutionData} object with the given probe data
* length. All probes are set to <code>false</code>.
- *
+ *
* @param id
* class identifier
* @param name
@@ -58,7 +59,8 @@ public final class ExecutionData implements IExecutionData {
* @param probeCount
* probe count
*/
- public ExecutionData(final long id, final String name, final int probeCount) {
+ public ExecutionData(final long id, final String name,
+ final int probeCount) {
this.id = id;
this.name = name;
this.probes = new boolean[probeCount];
@@ -67,7 +69,7 @@ public final class ExecutionData implements IExecutionData {
/**
* Return the unique identifier for this class. The identifier is the CRC64
* checksum of the raw class file definition.
- *
+ *
* @return class identifier
*/
public long getId() {
@@ -76,7 +78,7 @@ public final class ExecutionData implements IExecutionData {
/**
* The VM name of the class.
- *
+ *
* @return VM name
*/
public String getName() {
@@ -103,10 +105,9 @@ public final class ExecutionData implements IExecutionData {
}
/**
- * Returns the execution data probe for a given index. A value of
- * <code>true</code> indicates that the corresponding probe was
- * executed.
- *
+ * Returns the execution data probes. A value of <code>true</code> indicates
+ * that the corresponding probe was executed.
+ *
* @return probe data
*/
public boolean getProbe(final int index) {
@@ -130,7 +131,7 @@ public final class ExecutionData implements IExecutionData {
/**
* Checks whether any probe has been hit.
- *
+ *
* @return <code>true</code>, if at least one probe has been hit
*/
public boolean hasHits() {
@@ -147,13 +148,13 @@ public final class ExecutionData implements IExecutionData {
* a probe entry in this object is marked as executed (<code>true</code>) if
* this probe or the corresponding other probe was executed. So the result
* is
- *
+ *
* <pre>
* A or B
* </pre>
- *
+ *
* The probe array of the other object is not modified.
- *
+ *
* @param other
* execution data to merge
*/
@@ -168,19 +169,19 @@ public final class ExecutionData implements IExecutionData {
* probe in this object is set to the value of <code>flag</code> if the
* corresponding other probe was executed. For <code>flag==true</code> this
* corresponds to
- *
+ *
* <pre>
* A or B
* </pre>
- *
+ *
* For <code>flag==false</code> this can be considered as a subtraction
- *
+ *
* <pre>
* A and not B
* </pre>
- *
+ *
* The probe array of the other object is not modified.
- *
+ *
* @param other
* execution data to merge
* @param flag
@@ -203,7 +204,7 @@ public final class ExecutionData implements IExecutionData {
* Asserts that this execution data object is compatible with the given
* parameters. The purpose of this check is to detect a very unlikely class
* id collision.
- *
+ *
* @param id
* other class id, must be the same
* @param name
@@ -216,14 +217,14 @@ public final class ExecutionData implements IExecutionData {
public void assertCompatibility(final long id, final String name,
final int probecount) throws IllegalStateException {
if (this.id != id) {
- throw new IllegalStateException(format(
- "Different ids (%016x and %016x).", Long.valueOf(this.id),
- Long.valueOf(id)));
+ throw new IllegalStateException(
+ format("Different ids (%016x and %016x).",
+ Long.valueOf(this.id), Long.valueOf(id)));
}
if (!this.name.equals(name)) {
- throw new IllegalStateException(format(
- "Different class names %s and %s for id %016x.", this.name,
- name, Long.valueOf(id)));
+ throw new IllegalStateException(
+ format("Different class names %s and %s for id %016x.",
+ this.name, name, Long.valueOf(id)));
}
if (this.probes.length != probecount) {
throw new IllegalStateException(format(
diff --git a/org.jacoco.core/src/org/jacoco/core/data/ExecutionDataReader.java b/org.jacoco.core/src/org/jacoco/core/data/ExecutionDataReader.java
index dd8519b5..e7b7d816 100644
--- a/org.jacoco.core/src/org/jacoco/core/data/ExecutionDataReader.java
+++ b/org.jacoco.core/src/org/jacoco/core/data/ExecutionDataReader.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.data;
@@ -36,7 +37,7 @@ public class ExecutionDataReader {
* Creates a new reader based on the given input stream input. Depending on
* the nature of the underlying stream input should be buffered as most data
* is read in single bytes.
- *
+ *
* @param input
* input stream to read execution data from
*/
@@ -46,7 +47,7 @@ public class ExecutionDataReader {
/**
* Sets an listener for session information.
- *
+ *
* @param visitor
* visitor to retrieve session info events
*/
@@ -56,7 +57,7 @@ public class ExecutionDataReader {
/**
* Sets an listener for execution data.
- *
+ *
* @param visitor
* visitor to retrieve execution data events
*/
@@ -67,7 +68,7 @@ public class ExecutionDataReader {
/**
* Reads all data and reports it to the corresponding visitors. The stream
* is read until its end or a command confirmation has been sent.
- *
+ *
* @return <code>true</code> if additional data can be expected after a
* command has been executed. <code>false</code> if the end of the
* stream has been reached.
@@ -76,8 +77,8 @@ public class ExecutionDataReader {
* @throws IncompatibleExecDataVersionException
* incompatible data version from different JaCoCo release
*/
- public boolean read() throws IOException,
- IncompatibleExecDataVersionException {
+ public boolean read()
+ throws IOException, IncompatibleExecDataVersionException {
byte type;
do {
int i = in.read();
@@ -96,7 +97,7 @@ public class ExecutionDataReader {
/**
* Reads a block of data identified by the given id. Subclasses may
* overwrite this method to support additional block types.
- *
+ *
* @param blocktype
* block type
* @return <code>true</code> if there are more blocks to read
@@ -115,8 +116,8 @@ public class ExecutionDataReader {
readExecutionData();
return true;
default:
- throw new IOException(format("Unknown block type %x.",
- Byte.valueOf(blocktype)));
+ throw new IOException(
+ format("Unknown block type %x.", Byte.valueOf(blocktype)));
}
}
@@ -147,8 +148,8 @@ public class ExecutionDataReader {
final long id = in.readLong();
final String name = in.readUTF();
final boolean[] probes = in.readBooleanArray();
- executionDataVisitor.visitClassExecution(new ExecutionData(id, name,
- probes));
+ executionDataVisitor
+ .visitClassExecution(new ExecutionData(id, name, probes));
}
}
diff --git a/org.jacoco.core/src/org/jacoco/core/data/ExecutionDataStore.java b/org.jacoco.core/src/org/jacoco/core/data/ExecutionDataStore.java
index ce0bec47..2291fd58 100644
--- a/org.jacoco.core/src/org/jacoco/core/data/ExecutionDataStore.java
+++ b/org.jacoco.core/src/org/jacoco/core/data/ExecutionDataStore.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.data;
@@ -38,7 +39,7 @@ public final class ExecutionDataStore implements IExecutionDataVisitor {
* Adds the given {@link ExecutionData} object into the store. If there is
* already execution data with this same class id, this structure is merged
* with the given one.
- *
+ *
* @param data
* execution data to add or merge
* @throws IllegalStateException
@@ -64,7 +65,7 @@ public final class ExecutionDataStore implements IExecutionDataVisitor {
* store. I.e. for all set probes in the given data object the corresponding
* probes in this store will be unset. If there is no execution data with id
* of the given data object this operation will have no effect.
- *
+ *
* @param data
* execution data to subtract
* @throws IllegalStateException
@@ -84,7 +85,7 @@ public final class ExecutionDataStore implements IExecutionDataVisitor {
/**
* Subtracts all probes in the given execution data store from this store.
- *
+ *
* @param store
* execution data store to subtract
* @see #subtract(ExecutionData)
@@ -100,7 +101,7 @@ public final class ExecutionDataStore implements IExecutionDataVisitor {
/**
* Returns the {@link ExecutionData} entry with the given id if it exists in
* this store.
- *
+ *
* @param id
* class id
* @return execution data or <code>null</code>
@@ -114,7 +115,7 @@ public final class ExecutionDataStore implements IExecutionDataVisitor {
/**
* Checks whether execution data for classes with the given name are
* contained in the store.
- *
+ *
* @param name
* VM name
* @return <code>true</code> if at least one class with the name is
@@ -127,7 +128,7 @@ public final class ExecutionDataStore implements IExecutionDataVisitor {
/**
* Returns the coverage data for the class with the given identifier. If
* there is no data available under the given id a new entry is created.
- *
+ *
* @param id
* class identifier
* @param name
@@ -176,7 +177,7 @@ public final class ExecutionDataStore implements IExecutionDataVisitor {
/**
* Writes the content of the store to the given visitor interface.
- *
+ *
* @param visitor
* interface to write content to
*/
diff --git a/org.jacoco.core/src/org/jacoco/core/data/ExecutionDataWriter.java b/org.jacoco.core/src/org/jacoco/core/data/ExecutionDataWriter.java
index bdf3445d..c92073c1 100644
--- a/org.jacoco.core/src/org/jacoco/core/data/ExecutionDataWriter.java
+++ b/org.jacoco.core/src/org/jacoco/core/data/ExecutionDataWriter.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.data;
@@ -20,10 +21,12 @@ import org.jacoco.core.internal.data.CompactDataOutput;
/**
* Serialization of execution data into binary streams.
*/
-public class ExecutionDataWriter implements ISessionInfoVisitor,
- IExecutionDataVisitor {
+public class ExecutionDataWriter
+ implements ISessionInfoVisitor, IExecutionDataVisitor {
- /** File format version, will be incremented for each incompatible change. */
+ /**
+ * File format version, will be incremented for each incompatible change.
+ */
public static final char FORMAT_VERSION;
static {
@@ -50,7 +53,7 @@ public class ExecutionDataWriter implements ISessionInfoVisitor,
* Creates a new writer based on the given output stream. Depending on the
* nature of the underlying stream output should be buffered as most data is
* written in single bytes.
- *
+ *
* @param output
* binary stream to write execution data to
* @throws IOException
@@ -63,7 +66,7 @@ public class ExecutionDataWriter implements ISessionInfoVisitor,
/**
* Writes an file header to identify the stream and its protocol version.
- *
+ *
* @throws IOException
* if the header can't be written
*/
@@ -75,7 +78,7 @@ public class ExecutionDataWriter implements ISessionInfoVisitor,
/**
* Flushes the underlying stream.
- *
+ *
* @throws IOException
* if the underlying stream can't be flushed
*/
@@ -115,7 +118,7 @@ public class ExecutionDataWriter implements ISessionInfoVisitor,
* Returns the first bytes of a file that represents a valid execution data
* file. In any case every execution data file starts with the three bytes
* <code>0x01 0xC0 0xC0</code>.
- *
+ *
* @return first bytes of a execution data file
*/
public static final byte[] getFileHeader() {
diff --git a/org.jacoco.core/src/org/jacoco/core/data/IExecutionDataVisitor.java b/org.jacoco.core/src/org/jacoco/core/data/IExecutionDataVisitor.java
index 14eabbe7..b65ed2a7 100644
--- a/org.jacoco.core/src/org/jacoco/core/data/IExecutionDataVisitor.java
+++ b/org.jacoco.core/src/org/jacoco/core/data/IExecutionDataVisitor.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.data;
@@ -20,7 +21,7 @@ public interface IExecutionDataVisitor {
/**
* Provides execution data for a class.
- *
+ *
* @param data
* execution data for a class
*/
diff --git a/org.jacoco.core/src/org/jacoco/core/data/ISessionInfoVisitor.java b/org.jacoco.core/src/org/jacoco/core/data/ISessionInfoVisitor.java
index b80797a9..5f6a9375 100644
--- a/org.jacoco.core/src/org/jacoco/core/data/ISessionInfoVisitor.java
+++ b/org.jacoco.core/src/org/jacoco/core/data/ISessionInfoVisitor.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.data;
@@ -21,7 +22,7 @@ public interface ISessionInfoVisitor {
/**
* Provides session information for the subsequent execution data calls. In
* case of merged sessions this method might be called multiple times.
- *
+ *
* @param info
* session information
*/
diff --git a/org.jacoco.core/src/org/jacoco/core/data/IncompatibleExecDataVersionException.java b/org.jacoco.core/src/org/jacoco/core/data/IncompatibleExecDataVersionException.java
index cc508e73..30e61e2d 100644
--- a/org.jacoco.core/src/org/jacoco/core/data/IncompatibleExecDataVersionException.java
+++ b/org.jacoco.core/src/org/jacoco/core/data/IncompatibleExecDataVersionException.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann, somechris - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.data;
@@ -24,7 +25,7 @@ public class IncompatibleExecDataVersionException extends IOException {
/**
* Creates a new exception to flag version mismatches in execution data.
- *
+ *
* @param actualVersion
* version found in the exec data
*/
@@ -39,7 +40,7 @@ public class IncompatibleExecDataVersionException extends IOException {
/**
* Gets the version expected in the execution data which can be read by this
* version of JaCoCo.
- *
+ *
* @return expected version in execution data
*/
public int getExpectedVersion() {
@@ -48,7 +49,7 @@ public class IncompatibleExecDataVersionException extends IOException {
/**
* Gets the actual version found in the execution data.
- *
+ *
* @return actual version in execution data
*/
public int getActualVersion() {
diff --git a/org.jacoco.core/src/org/jacoco/core/data/SessionInfo.java b/org.jacoco.core/src/org/jacoco/core/data/SessionInfo.java
index 31f7b5e3..f6e77597 100644
--- a/org.jacoco.core/src/org/jacoco/core/data/SessionInfo.java
+++ b/org.jacoco.core/src/org/jacoco/core/data/SessionInfo.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.data;
@@ -26,7 +27,7 @@ public class SessionInfo implements Comparable<SessionInfo> {
/**
* Create a immutable session info with the given data.
- *
+ *
* @param id
* arbitrary session identifier, must not be <code>null</code>
* @param start
diff --git a/org.jacoco.core/src/org/jacoco/core/data/SessionInfoStore.java b/org.jacoco.core/src/org/jacoco/core/data/SessionInfoStore.java
index 568dcc96..20fb872b 100644
--- a/org.jacoco.core/src/org/jacoco/core/data/SessionInfoStore.java
+++ b/org.jacoco.core/src/org/jacoco/core/data/SessionInfoStore.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.data;
@@ -28,7 +29,7 @@ public class SessionInfoStore implements ISessionInfoVisitor {
/**
* Tests whether the store is empty.
- *
+ *
* @return <code>true</code> if the store is empty
*/
public boolean isEmpty() {
@@ -39,7 +40,7 @@ public class SessionInfoStore implements ISessionInfoVisitor {
* Returns all {@link SessionInfo} objects currently contained in the store.
* The info objects are ordered by its natural ordering (i.e. by the dump
* time stamp).
- *
+ *
* @return list of stored {@link SessionInfo} objects
*/
public List<SessionInfo> getInfos() {
@@ -54,11 +55,11 @@ public class SessionInfoStore implements ISessionInfoVisitor {
* all contained sessions, the dump timestamp the maximum of all contained
* sessions. If no session is currently contained both timestamps are set to
* <code>0</code>.
- *
+ *
* @param id
* identifier for the merged session info
* @return new {@link SessionInfo} object
- *
+ *
*/
public SessionInfo getMerged(final String id) {
if (infos.isEmpty()) {
@@ -76,7 +77,7 @@ public class SessionInfoStore implements ISessionInfoVisitor {
/**
* Writes all contained {@link SessionInfo} objects into the given visitor.
* The info objects are emitted in chronological order by dump timestamp.
- *
+ *
* @param visitor
* visitor to emit {@link SessionInfo} objects to
*/
diff --git a/org.jacoco.core/src/org/jacoco/core/data/package-info.java b/org.jacoco.core/src/org/jacoco/core/data/package-info.java
index 6e2f37bf..b7f33fe0 100644
--- a/org.jacoco.core/src/org/jacoco/core/data/package-info.java
+++ b/org.jacoco.core/src/org/jacoco/core/data/package-info.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
/**
diff --git a/org.jacoco.core/src/org/jacoco/core/instr/Instrumenter.java b/org.jacoco.core/src/org/jacoco/core/instr/Instrumenter.java
index 561b09cb..5225d2e4 100644
--- a/org.jacoco.core/src/org/jacoco/core/instr/Instrumenter.java
+++ b/org.jacoco.core/src/org/jacoco/core/instr/Instrumenter.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.instr;
@@ -15,6 +16,7 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.util.zip.CRC32;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
import java.util.zip.ZipEntry;
@@ -47,7 +49,7 @@ public class Instrumenter {
/**
* Creates a new instance based on the given runtime.
- *
+ *
* @param runtime
* runtime used by the instrumented classes
*/
@@ -61,7 +63,7 @@ public class Instrumenter {
* typically necessary as instrumentation modifies the class files and
* therefore invalidates existing JAR signatures. Default is
* <code>true</code>.
- *
+ *
* @param flag
* <code>true</code> if signatures should be removed
*/
@@ -91,7 +93,7 @@ public class Instrumenter {
/**
* Creates a instrumented version of the given class if possible.
- *
+ *
* @param buffer
* definition of the class
* @param name
@@ -112,7 +114,7 @@ public class Instrumenter {
/**
* Creates a instrumented version of the given class if possible. The
* provided {@link InputStream} is not closed by this method.
- *
+ *
* @param input
* stream to read class definition from
* @param name
@@ -137,7 +139,7 @@ public class Instrumenter {
* Creates a instrumented version of the given class file. The provided
* {@link InputStream} and {@link OutputStream} instances are not closed by
* this method.
- *
+ *
* @param input
* stream to read class definition from
* @param output
@@ -167,7 +169,7 @@ public class Instrumenter {
* other files are copied without modification. The provided
* {@link InputStream} and {@link OutputStream} instances are not closed by
* this method.
- *
+ *
* @param input
* stream to contents from
* @param output
@@ -215,9 +217,27 @@ public class Instrumenter {
continue;
}
- zipout.putNextEntry(new ZipEntry(entryName));
- if (!signatureRemover.filterEntry(entryName, zipin, zipout)) {
- count += instrumentAll(zipin, zipout, name + "@" + entryName);
+ final ZipEntry newEntry = new ZipEntry(entryName);
+ newEntry.setMethod(entry.getMethod());
+ switch (entry.getMethod()) {
+ case ZipEntry.DEFLATED:
+ zipout.putNextEntry(newEntry);
+ count += filterOrInstrument(zipin, zipout, name, entryName);
+ break;
+ case ZipEntry.STORED:
+ // Uncompressed entries must be processed in-memory to calculate
+ // mandatory entry size and CRC
+ final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+ count += filterOrInstrument(zipin, buffer, name, entryName);
+ final byte[] bytes = buffer.toByteArray();
+ newEntry.setSize(bytes.length);
+ newEntry.setCompressedSize(bytes.length);
+ newEntry.setCrc(crc(bytes));
+ zipout.putNextEntry(newEntry);
+ zipout.write(bytes);
+ break;
+ default:
+ throw new AssertionError(entry.getMethod());
}
zipout.closeEntry();
}
@@ -225,6 +245,21 @@ public class Instrumenter {
return count;
}
+ private int filterOrInstrument(final InputStream in, final OutputStream out,
+ final String name, final String entryName) throws IOException {
+ if (signatureRemover.filterEntry(entryName, in, out)) {
+ return 0;
+ } else {
+ return instrumentAll(in, out, name + "@" + entryName);
+ }
+ }
+
+ private static long crc(final byte[] data) {
+ final CRC32 crc = new CRC32();
+ crc.update(data);
+ return crc.getValue();
+ }
+
private ZipEntry nextEntry(final ZipInputStream input,
final String location) throws IOException {
try {
diff --git a/org.jacoco.core/src/org/jacoco/core/instr/package-info.java b/org.jacoco.core/src/org/jacoco/core/instr/package-info.java
index 1da3ef19..3293f149 100644
--- a/org.jacoco.core/src/org/jacoco/core/instr/package-info.java
+++ b/org.jacoco.core/src/org/jacoco/core/instr/package-info.java
@@ -1,19 +1,20 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
/**
* <p>
- * Instrumentation of Java class files for code coverage. The main entry point
- * is the class {@link org.jacoco.core.instr.Instrumenter}.
+ * Instrumentation of Java class files for code coverage. The main entry point
+ * is the class {@link org.jacoco.core.instr.Instrumenter}.
* </p>
*/
package org.jacoco.core.instr;
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/ContentTypeDetector.java b/org.jacoco.core/src/org/jacoco/core/internal/ContentTypeDetector.java
index 74574ecc..f07528ad 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/ContentTypeDetector.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/ContentTypeDetector.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.internal;
@@ -15,8 +16,6 @@ import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
-import org.objectweb.asm.Opcodes;
-
/**
* Detector for content types of binary streams based on a magic headers.
*/
@@ -47,7 +46,7 @@ public class ContentTypeDetector {
* Creates a new detector based on the given input. To process the complete
* original input afterwards use the stream returned by
* {@link #getInputStream()}.
- *
+ *
* @param in
* input to read the header from
* @throws IOException
@@ -72,24 +71,14 @@ public class ContentTypeDetector {
case PACK200FILE:
return PACK200FILE;
case CLASSFILE:
- // also verify version to distinguish from Mach Object files:
- switch (readInt(in)) {
- case Opcodes.V1_1:
- case Opcodes.V1_2:
- case Opcodes.V1_3:
- case Opcodes.V1_4:
- case Opcodes.V1_5:
- case Opcodes.V1_6:
- case Opcodes.V1_7:
- case Opcodes.V1_8:
- case Opcodes.V9:
- case Opcodes.V10:
- case Opcodes.V11:
- case Opcodes.V11 | Opcodes.V_PREVIEW:
- case Opcodes.V12:
- case Opcodes.V12 | Opcodes.V_PREVIEW:
- case (Opcodes.V12 + 1):
- case (Opcodes.V12 + 1) | Opcodes.V_PREVIEW:
+ // Mach-O fat/universal binaries have the same magic header as Java
+ // class files, number of architectures is stored in unsigned 4
+ // bytes in the same place and in the same big-endian order as major
+ // and minor version of class file. Hopefully on practice number of
+ // architectures in single executable is less than 45, which is
+ // major version of Java 1.1 class files:
+ final int majorVersion = readInt(in) & 0xFFFF;
+ if (majorVersion >= 45) {
return CLASSFILE;
}
}
@@ -106,7 +95,7 @@ public class ContentTypeDetector {
/**
* Returns an input stream instance to read the complete content (including
* the header) of the underlying stream.
- *
+ *
* @return input stream containing the complete content
*/
public InputStream getInputStream() {
@@ -115,7 +104,7 @@ public class ContentTypeDetector {
/**
* Returns the detected file type.
- *
+ *
* @return file type
*/
public int getType() {
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/InputStreams.java b/org.jacoco.core/src/org/jacoco/core/internal/InputStreams.java
index 93f86f67..7cd104b7 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/InputStreams.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/InputStreams.java
@@ -1,9 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/Pack200Streams.java b/org.jacoco.core/src/org/jacoco/core/internal/Pack200Streams.java
index eae4fdfa..b9539ef3 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/Pack200Streams.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/Pack200Streams.java
@@ -1,78 +1,116 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Marc R. Hoffmann - initial API and implementation
- *
- *******************************************************************************/
-package org.jacoco.core.internal;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.FilterInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.jar.JarInputStream;
-import java.util.jar.JarOutputStream;
-import java.util.jar.Pack200;
-
-/**
- * Internal wrapper for the weird Pack200 Java API to allow usage with streams.
- */
-public final class Pack200Streams {
-
- /**
- * Unpack a stream in Pack200 format into a stream in JAR/ZIP format.
- *
- * @param input
- * stream in Pack200 format
- * @return stream in JAR/ZIP format
- * @throws IOException
- * in case of errors with the streams
- */
- public static InputStream unpack(final InputStream input)
- throws IOException {
- final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
- final JarOutputStream jar = new JarOutputStream(buffer);
- Pack200.newUnpacker().unpack(new NoCloseInput(input), jar);
- jar.finish();
- return new ByteArrayInputStream(buffer.toByteArray());
- }
-
- /**
- * Packs a buffer in JAR/ZIP format into a stream in Pack200 format.
- *
- * @param source
- * source in JAR/ZIP format
- * @param output
- * stream in Pack200 format
- * @throws IOException
- * in case of errors with the streams
- */
- public static void pack(final byte[] source, final OutputStream output)
- throws IOException {
- final JarInputStream jar = new JarInputStream(new ByteArrayInputStream(
- source));
- Pack200.newPacker().pack(jar, output);
- }
-
- private static class NoCloseInput extends FilterInputStream {
- protected NoCloseInput(final InputStream in) {
- super(in);
- }
-
- @Override
- public void close() throws IOException {
- // do not close the underlying stream
- }
- }
-
- private Pack200Streams() {
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Marc R. Hoffmann - initial API and implementation
+ *
+ *******************************************************************************/
+package org.jacoco.core.internal;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.FilterInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.lang.reflect.InvocationTargetException;
+import java.util.jar.JarInputStream;
+import java.util.jar.JarOutputStream;
+
+/**
+ * Internal wrapper for the weird Pack200 Java API to allow usage with streams.
+ */
+public final class Pack200Streams {
+
+ /**
+ * Unpack a stream in Pack200 format into a stream in JAR/ZIP format.
+ *
+ * @param input
+ * stream in Pack200 format
+ * @return stream in JAR/ZIP format
+ * @throws IOException
+ * in case of errors with the streams
+ */
+ @SuppressWarnings("resource")
+ public static InputStream unpack(final InputStream input)
+ throws IOException {
+ final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+ final JarOutputStream jar = new JarOutputStream(buffer);
+ try {
+ final Object unpacker = Class.forName("java.util.jar.Pack200")
+ .getMethod("newUnpacker").invoke(null);
+ Class.forName("java.util.jar.Pack200$Unpacker")
+ .getMethod("unpack", InputStream.class,
+ JarOutputStream.class)
+ .invoke(unpacker, new NoCloseInput(input), jar);
+ } catch (ClassNotFoundException e) {
+ throw newIOException(e);
+ } catch (NoSuchMethodException e) {
+ throw newIOException(e);
+ } catch (IllegalAccessException e) {
+ throw newIOException(e);
+ } catch (InvocationTargetException e) {
+ throw newIOException(e.getCause());
+ }
+ jar.finish();
+ return new ByteArrayInputStream(buffer.toByteArray());
+ }
+
+ /**
+ * Packs a buffer in JAR/ZIP format into a stream in Pack200 format.
+ *
+ * @param source
+ * source in JAR/ZIP format
+ * @param output
+ * stream in Pack200 format
+ * @throws IOException
+ * in case of errors with the streams
+ */
+ @SuppressWarnings("resource")
+ public static void pack(final byte[] source, final OutputStream output)
+ throws IOException {
+ final JarInputStream jar = new JarInputStream(
+ new ByteArrayInputStream(source));
+ try {
+ final Object packer = Class.forName("java.util.jar.Pack200")
+ .getMethod("newPacker").invoke(null);
+ Class.forName("java.util.jar.Pack200$Packer")
+ .getMethod("pack", JarInputStream.class, OutputStream.class)
+ .invoke(packer, jar, output);
+ } catch (ClassNotFoundException e) {
+ throw newIOException(e);
+ } catch (NoSuchMethodException e) {
+ throw newIOException(e);
+ } catch (IllegalAccessException e) {
+ throw newIOException(e);
+ } catch (InvocationTargetException e) {
+ throw newIOException(e.getCause());
+ }
+ }
+
+ private static IOException newIOException(final Throwable cause) {
+ final IOException exception = new IOException();
+ exception.initCause(cause);
+ return exception;
+ }
+
+ private static class NoCloseInput extends FilterInputStream {
+ protected NoCloseInput(final InputStream in) {
+ super(in);
+ }
+
+ @Override
+ public void close() throws IOException {
+ // do not close the underlying stream
+ }
+ }
+
+ private Pack200Streams() {
+ }
+
+}
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/analysis/BundleCoverageImpl.java b/org.jacoco.core/src/org/jacoco/core/internal/analysis/BundleCoverageImpl.java
index 9c6fcefc..8e799153 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/analysis/BundleCoverageImpl.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/analysis/BundleCoverageImpl.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.internal.analysis;
@@ -28,14 +29,14 @@ import org.jacoco.core.analysis.ISourceFileCoverage;
/**
* Implementation of {@link IBundleCoverage}.
*/
-public class BundleCoverageImpl extends CoverageNodeImpl implements
- IBundleCoverage {
+public class BundleCoverageImpl extends CoverageNodeImpl
+ implements IBundleCoverage {
private final Collection<IPackageCoverage> packages;
/**
* Creates a new instance of a bundle with the given name.
- *
+ *
* @param name
* name of this bundle
* @param packages
@@ -51,7 +52,7 @@ public class BundleCoverageImpl extends CoverageNodeImpl implements
/**
* Creates a new instance of a bundle with the given name. The packages are
* calculated from the given classes and source files.
- *
+ *
* @param name
* name of this bundle
* @param classes
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/analysis/ClassAnalyzer.java b/org.jacoco.core/src/org/jacoco/core/internal/analysis/ClassAnalyzer.java
index a18ee7ed..c42c7eea 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/analysis/ClassAnalyzer.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/analysis/ClassAnalyzer.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.internal.analysis;
@@ -21,6 +22,7 @@ import org.jacoco.core.internal.flow.ClassProbesVisitor;
import org.jacoco.core.internal.flow.MethodProbesVisitor;
import org.jacoco.core.internal.instr.InstrSupport;
import org.objectweb.asm.AnnotationVisitor;
+import org.objectweb.asm.Attribute;
import org.objectweb.asm.FieldVisitor;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.tree.MethodNode;
@@ -37,13 +39,15 @@ public class ClassAnalyzer extends ClassProbesVisitor
private final Set<String> classAnnotations = new HashSet<String>();
+ private final Set<String> classAttributes = new HashSet<String>();
+
private String sourceDebugExtension;
private final IFilter filter;
/**
* Creates a new analyzer that builds coverage data for a class.
- *
+ *
* @param coverage
* coverage node for the analyzed class data
* @param probes
@@ -76,6 +80,11 @@ public class ClassAnalyzer extends ClassProbesVisitor
}
@Override
+ public void visitAttribute(final Attribute attribute) {
+ classAttributes.add(attribute.type);
+ }
+
+ @Override
public void visitSource(final String source, final String debug) {
coverage.setSourceFileName(stringPool.get(source));
sourceDebugExtension = debug;
@@ -146,6 +155,10 @@ public class ClassAnalyzer extends ClassProbesVisitor
return classAnnotations;
}
+ public Set<String> getClassAttributes() {
+ return classAttributes;
+ }
+
public String getSourceFileName() {
return coverage.getSourceFileName();
}
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/analysis/ClassCoverageImpl.java b/org.jacoco.core/src/org/jacoco/core/internal/analysis/ClassCoverageImpl.java
index 444a81ed..f91c8f67 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/analysis/ClassCoverageImpl.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/analysis/ClassCoverageImpl.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.internal.analysis;
@@ -20,7 +21,8 @@ import org.jacoco.core.analysis.IMethodCoverage;
/**
* Implementation of {@link IClassCoverage}.
*/
-public class ClassCoverageImpl extends SourceNodeImpl implements IClassCoverage {
+public class ClassCoverageImpl extends SourceNodeImpl
+ implements IClassCoverage {
private final long id;
private final boolean noMatch;
@@ -32,7 +34,7 @@ public class ClassCoverageImpl extends SourceNodeImpl implements IClassCoverage
/**
* Creates a class coverage data object with the given parameters.
- *
+ *
* @param name
* VM name of the class
* @param id
@@ -51,7 +53,7 @@ public class ClassCoverageImpl extends SourceNodeImpl implements IClassCoverage
/**
* Add a method to this class.
- *
+ *
* @param method
* method data to add
*/
@@ -68,7 +70,7 @@ public class ClassCoverageImpl extends SourceNodeImpl implements IClassCoverage
/**
* Sets the VM signature of the class.
- *
+ *
* @param signature
* VM signature of the class (may be <code>null</code>)
*/
@@ -78,7 +80,7 @@ public class ClassCoverageImpl extends SourceNodeImpl implements IClassCoverage
/**
* Sets the VM name of the superclass.
- *
+ *
* @param superName
* VM name of the super class (may be <code>null</code>, i.e.
* <code>java/lang/Object</code>)
@@ -89,7 +91,7 @@ public class ClassCoverageImpl extends SourceNodeImpl implements IClassCoverage
/**
* Sets the VM names of implemented/extended interfaces.
- *
+ *
* @param interfaces
* VM names of implemented/extended interfaces
*/
@@ -99,7 +101,7 @@ public class ClassCoverageImpl extends SourceNodeImpl implements IClassCoverage
/**
* Sets the name of the corresponding source file for this class.
- *
+ *
* @param sourceFileName
* name of the source file
*/
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/analysis/CounterImpl.java b/org.jacoco.core/src/org/jacoco/core/internal/analysis/CounterImpl.java
index e166c626..0ff6d78b 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/analysis/CounterImpl.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/analysis/CounterImpl.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.internal.analysis;
@@ -22,7 +23,8 @@ public abstract class CounterImpl implements ICounter {
/** Max counter value for which singletons are created */
private static final int SINGLETON_LIMIT = 30;
- private static final CounterImpl[][] SINGLETONS = new CounterImpl[SINGLETON_LIMIT + 1][];
+ private static final CounterImpl[][] SINGLETONS = new CounterImpl[SINGLETON_LIMIT
+ + 1][];
static {
for (int i = 0; i <= SINGLETON_LIMIT; i++) {
@@ -74,7 +76,7 @@ public abstract class CounterImpl implements ICounter {
/**
* Factory method to retrieve a counter with the given number of items.
- *
+ *
* @param missed
* number of missed items
* @param covered
@@ -91,7 +93,7 @@ public abstract class CounterImpl implements ICounter {
/**
* Factory method to retrieve a clone of the given counter.
- *
+ *
* @param counter
* counter to copy
* @return counter instance
@@ -108,7 +110,7 @@ public abstract class CounterImpl implements ICounter {
/**
* Creates a new instance with the given numbers.
- *
+ *
* @param missed
* number of missed items
* @param covered
@@ -123,7 +125,7 @@ public abstract class CounterImpl implements ICounter {
* Returns a counter with values incremented by the numbers of the given
* counter. It is up to the implementation whether this counter instance is
* modified or a new instance is returned.
- *
+ *
* @param counter
* number of additional total and covered items
* @return counter instance with incremented values
@@ -136,7 +138,7 @@ public abstract class CounterImpl implements ICounter {
* Returns a counter with values incremented by the given numbers. It is up
* to the implementation whether this counter instance is modified or a new
* instance is returned.
- *
+ *
* @param missed
* number of missed items
* @param covered
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/analysis/Instruction.java b/org.jacoco.core/src/org/jacoco/core/internal/analysis/Instruction.java
index c5a1aaae..2e34bf03 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/analysis/Instruction.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/analysis/Instruction.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.internal.analysis;
@@ -22,31 +23,31 @@ import org.jacoco.core.analysis.ICounter;
* outgoing branch. Each instruction has at least one branch, for example in
* case of a simple sequence of instructions (by convention branch 0). Instances
* of this class are used in two steps:
- *
- * <h3>Step 1: Building the CFG</h3>
- *
+ *
+ * <h2>Step 1: Building the CFG</h2>
+ *
* For each bytecode instruction of a method a {@link Instruction} instance is
* created. In correspondence with the CFG these instances are linked with each
* other with the <code>addBranch()</code> methods. The executions status is
* either directly derived from a probe which has been inserted in the execution
* flow ({@link #addBranch(boolean, int)}) or indirectly propagated along the
* CFG edges ({@link #addBranch(Instruction, int)}).
- *
- * <h3>Step 2: Querying the Coverage Status</h3>
- *
+ *
+ * <h2>Step 2: Querying the Coverage Status</h2>
+ *
* After all instructions have been created and linked each instruction knows
* its execution status and can be queried with:
- *
+ *
* <ul>
* <li>{@link #getLine()}</li>
* <li>{@link #getInstructionCounter()}</li>
* <li>{@link #getBranchCounter()}</li>
* </ul>
- *
+ *
* For the purpose of filtering instructions can be combined to new
* instructions. Note that these methods create new {@link Instruction}
* instances and do not modify the existing ones.
- *
+ *
* <ul>
* <li>{@link #merge(Instruction)}</li>
* <li>{@link #replaceBranches(Collection)}</li>
@@ -66,7 +67,7 @@ public class Instruction {
/**
* New instruction at the given line.
- *
+ *
* @param line
* source line this instruction belongs to
*/
@@ -81,10 +82,10 @@ public class Instruction {
* derived from the execution status of the target instruction. In case the
* branch is covered the status is propagated also to the predecessors of
* this instruction.
- *
+ *
* Note: This method is not idempotent and must be called exactly once for
* every branch.
- *
+ *
* @param target
* target instruction of this branch
* @param branch
@@ -103,10 +104,10 @@ public class Instruction {
* Adds a branch to this instruction which execution status is directly
* derived from a probe. In case the branch is covered the status is
* propagated also to the predecessors of this instruction.
- *
+ *
* Note: This method is not idempotent and must be called exactly once for
* every branch.
- *
+ *
* @param executed
* whether the corresponding probe has been executed
* @param branch
@@ -134,7 +135,7 @@ public class Instruction {
/**
* Returns the source line this instruction belongs to.
- *
+ *
* @return corresponding source line
*/
public int getLine() {
@@ -144,7 +145,7 @@ public class Instruction {
/**
* Merges information about covered branches of this instruction with
* another instruction.
- *
+ *
* @param other
* instruction to merge with
* @return new instance with merged branches
@@ -161,7 +162,7 @@ public class Instruction {
* Creates a copy of this instruction where all outgoing branches are
* replaced with the given instructions. The coverage status of the new
* instruction is derived from the status of the given instructions.
- *
+ *
* @param newBranches
* new branches to consider
* @return new instance with replaced branches
@@ -182,7 +183,7 @@ public class Instruction {
/**
* Returns the instruction coverage counter of this instruction. It is
* always 1 instruction which is covered or not.
- *
+ *
* @return the instruction coverage counter
*/
public ICounter getInstructionCounter() {
@@ -193,7 +194,7 @@ public class Instruction {
/**
* Returns the branch coverage counter of this instruction. Only
* instructions with at least 2 outgoing edges report branches.
- *
+ *
* @return the branch coverage counter
*/
public ICounter getBranchCounter() {
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/analysis/InstructionsBuilder.java b/org.jacoco.core/src/org/jacoco/core/internal/analysis/InstructionsBuilder.java
index b22d872a..a69f34c8 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/analysis/InstructionsBuilder.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/analysis/InstructionsBuilder.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.internal.analysis;
@@ -46,7 +47,7 @@ class InstructionsBuilder {
/**
* The labels which mark the subsequent instructions.
- *
+ *
* Due to ASM issue #315745 there can be more than one label per instruction
*/
private final List<Label> currentLabel;
@@ -60,7 +61,7 @@ class InstructionsBuilder {
/**
* Creates a new builder instance which can be used to analyze a single
* method.
- *
+ *
* @param probes
* probe array of the corresponding class used to determine the
* coverage status of every instruction.
@@ -126,7 +127,7 @@ class InstructionsBuilder {
/**
* Adds a jump from the last added instruction.
- *
+ *
* @param target
* jump target
* @param branch
@@ -138,7 +139,7 @@ class InstructionsBuilder {
/**
* Adds a new probe for the last instruction.
- *
+ *
* @param probeId
* index in the probe array
* @param branch
@@ -152,7 +153,7 @@ class InstructionsBuilder {
/**
* Returns the status for all instructions of this method. This method must
* be called exactly once after the instructions have been added.
- *
+ *
* @return map of ASM instruction nodes to corresponding {@link Instruction}
* instances
*/
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/analysis/LineImpl.java b/org.jacoco.core/src/org/jacoco/core/internal/analysis/LineImpl.java
index 908bcb60..b504c510 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/analysis/LineImpl.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/analysis/LineImpl.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.internal.analysis;
@@ -25,7 +26,8 @@ public abstract class LineImpl implements ILine {
/** Max branch counter value for which singletons are created */
private static final int SINGLETON_BRA_LIMIT = 4;
- private static final LineImpl[][][][] SINGLETONS = new LineImpl[SINGLETON_INS_LIMIT + 1][][][];
+ private static final LineImpl[][][][] SINGLETONS = new LineImpl[SINGLETON_INS_LIMIT
+ + 1][][][];
static {
for (int i = 0; i <= SINGLETON_INS_LIMIT; i++) {
@@ -82,8 +84,8 @@ public abstract class LineImpl implements ILine {
*/
private static final class Fix extends LineImpl {
public Fix(final int im, final int ic, final int bm, final int bc) {
- super(CounterImpl.getInstance(im, ic), CounterImpl.getInstance(bm,
- bc));
+ super(CounterImpl.getInstance(im, ic),
+ CounterImpl.getInstance(bm, bc));
}
@Override
@@ -100,14 +102,15 @@ public abstract class LineImpl implements ILine {
/** branch counter */
protected CounterImpl branches;
- private LineImpl(final CounterImpl instructions, final CounterImpl branches) {
+ private LineImpl(final CounterImpl instructions,
+ final CounterImpl branches) {
this.instructions = instructions;
this.branches = branches;
}
/**
* Adds the given counters to this line.
- *
+ *
* @param instructions
* instructions to add
* @param branches
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/analysis/MethodAnalyzer.java b/org.jacoco.core/src/org/jacoco/core/internal/analysis/MethodAnalyzer.java
index 1aaadf2e..547d6b36 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/analysis/MethodAnalyzer.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/analysis/MethodAnalyzer.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.internal.analysis;
@@ -46,10 +47,9 @@ public class MethodAnalyzer extends MethodProbesVisitor {
for (final TryCatchBlockNode n : methodNode.tryCatchBlocks) {
n.accept(methodVisitor);
}
- currentNode = methodNode.instructions.getFirst();
- while (currentNode != null) {
- currentNode.accept(methodVisitor);
- currentNode = currentNode.getNext();
+ for (final AbstractInsnNode i : methodNode.instructions) {
+ currentNode = i;
+ i.accept(methodVisitor);
}
methodVisitor.visitEnd();
}
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/analysis/MethodCoverageCalculator.java b/org.jacoco.core/src/org/jacoco/core/internal/analysis/MethodCoverageCalculator.java
index ebe167a2..2906dd13 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/analysis/MethodCoverageCalculator.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/analysis/MethodCoverageCalculator.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.internal.analysis;
@@ -19,7 +20,6 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
-import org.jacoco.core.analysis.ISourceFileCoverage;
import org.jacoco.core.analysis.ISourceNode;
import org.jacoco.core.internal.analysis.filter.IFilterOutput;
import org.objectweb.asm.tree.AbstractInsnNode;
@@ -39,11 +39,11 @@ class MethodCoverageCalculator implements IFilterOutput {
* Instructions that should be merged form disjoint sets. Coverage
* information from instructions of one set will be merged into
* representative instruction of set.
- *
+ *
* Each such set is represented as a singly linked list: each element except
* one references another element from the same set, element without
* reference - is a representative of this set.
- *
+ *
* This map stores reference (value) for elements of sets (key).
*/
private final Map<AbstractInsnNode, AbstractInsnNode> merged;
@@ -61,7 +61,7 @@ class MethodCoverageCalculator implements IFilterOutput {
/**
* Applies all specified filtering commands and calculates the resulting
* coverage.
- *
+ *
* @param coverage
* the result is added to this coverage node
*/
@@ -121,8 +121,8 @@ class MethodCoverageCalculator implements IFilterOutput {
private void ensureCapacity(final MethodCoverageImpl coverage) {
// Determine line range:
- int firstLine = ISourceFileCoverage.UNKNOWN_LINE;
- int lastLine = ISourceFileCoverage.UNKNOWN_LINE;
+ int firstLine = ISourceNode.UNKNOWN_LINE;
+ int lastLine = ISourceNode.UNKNOWN_LINE;
for (final Entry<AbstractInsnNode, Instruction> entry : instructions
.entrySet()) {
if (!ignored.contains(entry.getKey())) {
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/analysis/MethodCoverageImpl.java b/org.jacoco.core/src/org/jacoco/core/internal/analysis/MethodCoverageImpl.java
index aa7dccf0..b6ba4f95 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/analysis/MethodCoverageImpl.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/analysis/MethodCoverageImpl.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.internal.analysis;
@@ -17,8 +18,8 @@ import org.jacoco.core.analysis.IMethodCoverage;
/**
* Implementation of {@link IMethodCoverage}.
*/
-public class MethodCoverageImpl extends SourceNodeImpl implements
- IMethodCoverage {
+public class MethodCoverageImpl extends SourceNodeImpl
+ implements IMethodCoverage {
private final String desc;
@@ -26,7 +27,7 @@ public class MethodCoverageImpl extends SourceNodeImpl implements
/**
* Creates a method coverage data object with the given parameters.
- *
+ *
* @param name
* name of the method
* @param desc
@@ -58,7 +59,8 @@ public class MethodCoverageImpl extends SourceNodeImpl implements
* branches have been incremented for this method coverage node.
*/
public void incrementMethodCounter() {
- final ICounter base = this.instructionCounter.getCoveredCount() == 0 ? CounterImpl.COUNTER_1_0
+ final ICounter base = this.instructionCounter.getCoveredCount() == 0
+ ? CounterImpl.COUNTER_1_0
: CounterImpl.COUNTER_0_1;
this.methodCounter = this.methodCounter.increment(base);
this.complexityCounter = this.complexityCounter.increment(base);
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/analysis/PackageCoverageImpl.java b/org.jacoco.core/src/org/jacoco/core/internal/analysis/PackageCoverageImpl.java
index 285ddd38..b9bad063 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/analysis/PackageCoverageImpl.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/analysis/PackageCoverageImpl.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.internal.analysis;
@@ -21,8 +22,8 @@ import org.jacoco.core.analysis.ISourceFileCoverage;
/**
* Implementation of {@link IPackageCoverage}.
*/
-public class PackageCoverageImpl extends CoverageNodeImpl implements
- IPackageCoverage {
+public class PackageCoverageImpl extends CoverageNodeImpl
+ implements IPackageCoverage {
private final Collection<IClassCoverage> classes;
@@ -30,7 +31,7 @@ public class PackageCoverageImpl extends CoverageNodeImpl implements
/**
* Creates package node instance for a package with the given name.
- *
+ *
* @param name
* vm name of the package
* @param classes
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/analysis/SourceFileCoverageImpl.java b/org.jacoco.core/src/org/jacoco/core/internal/analysis/SourceFileCoverageImpl.java
index dc4483f5..fafce46c 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/analysis/SourceFileCoverageImpl.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/analysis/SourceFileCoverageImpl.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.internal.analysis;
@@ -16,14 +17,14 @@ import org.jacoco.core.analysis.ISourceFileCoverage;
/**
* Implementation of {@link ISourceFileCoverage}.
*/
-public class SourceFileCoverageImpl extends SourceNodeImpl implements
- ISourceFileCoverage {
+public class SourceFileCoverageImpl extends SourceNodeImpl
+ implements ISourceFileCoverage {
private final String packagename;
/**
* Creates a source file data object with the given parameters.
- *
+ *
* @param name
* name of the source file
* @param packagename
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/analysis/SourceNodeImpl.java b/org.jacoco.core/src/org/jacoco/core/internal/analysis/SourceNodeImpl.java
index 3fa3d692..e577c55d 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/analysis/SourceNodeImpl.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/analysis/SourceNodeImpl.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.internal.analysis;
@@ -28,7 +29,7 @@ public class SourceNodeImpl extends CoverageNodeImpl implements ISourceNode {
/**
* Create a new source node implementation instance.
- *
+ *
* @param elementType
* element type
* @param name
@@ -44,7 +45,7 @@ public class SourceNodeImpl extends CoverageNodeImpl implements ISourceNode {
* Make sure that the internal buffer can keep lines from first to last.
* While the buffer is also incremented automatically, this method allows
* optimization in case the total range is known in advance.
- *
+ *
* @param first
* first line number or {@link ISourceNode#UNKNOWN_LINE}
* @param last
@@ -75,16 +76,16 @@ public class SourceNodeImpl extends CoverageNodeImpl implements ISourceNode {
* Increments all counters by the values of the given child. When
* incrementing the line counter it is assumed that the child refers to the
* same source file.
- *
+ *
* @param child
* child node to add
*/
public void increment(final ISourceNode child) {
- instructionCounter = instructionCounter.increment(child
- .getInstructionCounter());
+ instructionCounter = instructionCounter
+ .increment(child.getInstructionCounter());
branchCounter = branchCounter.increment(child.getBranchCounter());
- complexityCounter = complexityCounter.increment(child
- .getComplexityCounter());
+ complexityCounter = complexityCounter
+ .increment(child.getComplexityCounter());
methodCounter = methodCounter.increment(child.getMethodCounter());
classCounter = classCounter.increment(child.getClassCounter());
final int firstLine = child.getFirstLine();
@@ -103,7 +104,7 @@ public class SourceNodeImpl extends CoverageNodeImpl implements ISourceNode {
* Increments instructions and branches by the given counter values. If a
* optional line number is specified the instructions and branches are added
* to the given line. The line counter is incremented accordingly.
- *
+ *
* @param instructions
* instructions to add
* @param branches
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/analysis/StringPool.java b/org.jacoco.core/src/org/jacoco/core/internal/analysis/StringPool.java
index 97e25aaa..8b646e9e 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/analysis/StringPool.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/analysis/StringPool.java
@@ -1,14 +1,15 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
- * Brock Janiczak - analysis and concept
+ * Brock Janiczak - analysis and concept
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.internal.analysis;
@@ -31,7 +32,7 @@ public final class StringPool {
/**
* Returns a normalized instance that is equal to the given {@link String} .
- *
+ *
* @param s
* any string or <code>null</code>
* @return normalized instance or <code>null</code>
@@ -52,7 +53,7 @@ public final class StringPool {
* Returns a modified version of the array with all string slots normalized.
* It is up to the implementation to replace strings in the array instance
* or return a new array instance.
- *
+ *
* @param arr
* String array or <code>null</code>
* @return normalized instance or <code>null</code>
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/AbstractMatcher.java b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/AbstractMatcher.java
index 38860a83..837278e9 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/AbstractMatcher.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/AbstractMatcher.java
@@ -1,9 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
@@ -34,7 +35,7 @@ abstract class AbstractMatcher {
final void firstIsALoad0(final MethodNode methodNode) {
cursor = methodNode.instructions.getFirst();
skipNonOpcodes();
- if (cursor.getOpcode() == Opcodes.ALOAD
+ if (cursor != null && cursor.getOpcode() == Opcodes.ALOAD
&& ((VarInsnNode) cursor).var == 0) {
return;
}
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/AnnotationGeneratedFilter.java b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/AnnotationGeneratedFilter.java
index d78444c0..1653fa27 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/AnnotationGeneratedFilter.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/AnnotationGeneratedFilter.java
@@ -1,9 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/BridgeFilter.java b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/BridgeFilter.java
new file mode 100644
index 00000000..bc23941b
--- /dev/null
+++ b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/BridgeFilter.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Evgeny Mandrikov - initial API and implementation
+ *
+ *******************************************************************************/
+package org.jacoco.core.internal.analysis.filter;
+
+import org.objectweb.asm.Opcodes;
+import org.objectweb.asm.tree.MethodNode;
+
+/**
+ * Filters bridge methods.
+ */
+final class BridgeFilter implements IFilter {
+
+ public void filter(final MethodNode methodNode,
+ final IFilterContext context, final IFilterOutput output) {
+ if ((methodNode.access & Opcodes.ACC_BRIDGE) == 0) {
+ return;
+ }
+ output.ignore(methodNode.instructions.getFirst(),
+ methodNode.instructions.getLast());
+ }
+
+}
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/EnumEmptyConstructorFilter.java b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/EnumEmptyConstructorFilter.java
index 4a39d1e8..ae23c641 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/EnumEmptyConstructorFilter.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/EnumEmptyConstructorFilter.java
@@ -1,9 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/EnumFilter.java b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/EnumFilter.java
index 0c2eef58..faab0ad4 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/EnumFilter.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/EnumFilter.java
@@ -1,9 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/Filters.java b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/Filters.java
index 7a1053b5..484ccc00 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/Filters.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/Filters.java
@@ -1,9 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
@@ -27,24 +28,25 @@ public final class Filters implements IFilter {
/**
* Creates filter that combines all other filters.
- *
+ *
* @return filter that combines all other filters
*/
public static IFilter all() {
return new Filters(new EnumFilter(), new SyntheticFilter(),
- new SynchronizedFilter(), new TryWithResourcesJavac11Filter(),
+ new BridgeFilter(), new SynchronizedFilter(),
+ new TryWithResourcesJavac11Filter(),
new TryWithResourcesJavacFilter(),
new TryWithResourcesEcjFilter(), new FinallyFilter(),
new PrivateEmptyNoArgConstructorFilter(),
- new StringSwitchJavacFilter(), new StringSwitchEcjFilter(),
- new EnumEmptyConstructorFilter(),
+ new StringSwitchJavacFilter(), new StringSwitchFilter(),
+ new EnumEmptyConstructorFilter(), new RecordsFilter(),
new AnnotationGeneratedFilter(), new KotlinGeneratedFilter(),
new KotlinLateinitFilter(), new KotlinWhenFilter(),
new KotlinWhenStringFilter(),
new KotlinUnsafeCastOperatorFilter(),
new KotlinNotNullOperatorFilter(),
new KotlinDefaultArgumentsFilter(), new KotlinInlineFilter(),
- new KotlinCoroutineFilter());
+ new KotlinCoroutineFilter(), new KotlinDefaultMethodsFilter());
}
private Filters(final IFilter... filters) {
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/FinallyFilter.java b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/FinallyFilter.java
index b2e0b145..284d4322 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/FinallyFilter.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/FinallyFilter.java
@@ -1,9 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
@@ -26,7 +27,7 @@ import org.objectweb.asm.tree.VarInsnNode;
* Filters duplicates of finally blocks that compiler generates.
*
* To understand algorithm of filtering, consider following example:
- *
+ *
* <pre>
* try {
* if (x) {
@@ -44,7 +45,7 @@ import org.objectweb.asm.tree.VarInsnNode;
* There are 4 <b>distinct</b> points of exit out of these "try/catch/finally"
* blocks - three without exception, and one with Throwable if it is thrown
* prior to reaching first three points of exit.
- *
+ *
* "finally" block must be executed just before these points, so there must be 4
* copies of its bytecode instructions.
*
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/IFilter.java b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/IFilter.java
index b662ba4f..9f0a7589 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/IFilter.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/IFilter.java
@@ -1,9 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/IFilterContext.java b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/IFilterContext.java
index 8b97654d..992e3e8d 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/IFilterContext.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/IFilterContext.java
@@ -1,48 +1,54 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Marc R. Hoffmann - initial API and implementation
- *
- *******************************************************************************/
-package org.jacoco.core.internal.analysis.filter;
-
-import java.util.Set;
-
-/**
- * Context information provided to filters.
- */
-public interface IFilterContext {
-
- /**
- * @return vm name of the enclosing class
- */
- String getClassName();
-
- /**
- * @return vm name of the super class of the enclosing class
- */
- String getSuperClassName();
-
- /**
- * @return vm names of the class annotations of the enclosing class
- */
- Set<String> getClassAnnotations();
-
- /**
- * @return file name of the corresponding source file or <code>null</code>
- * if not available
- */
- String getSourceFileName();
-
- /**
- * @return value of SourceDebugExtension attribute or <code>null</code> if
- * not available
- */
- String getSourceDebugExtension();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Marc R. Hoffmann - initial API and implementation
+ *
+ *******************************************************************************/
+package org.jacoco.core.internal.analysis.filter;
+
+import java.util.Set;
+
+/**
+ * Context information provided to filters.
+ */
+public interface IFilterContext {
+
+ /**
+ * @return vm name of the enclosing class
+ */
+ String getClassName();
+
+ /**
+ * @return vm name of the super class of the enclosing class
+ */
+ String getSuperClassName();
+
+ /**
+ * @return vm names of the class annotations of the enclosing class
+ */
+ Set<String> getClassAnnotations();
+
+ /**
+ * @return names of the class attributes
+ */
+ Set<String> getClassAttributes();
+
+ /**
+ * @return file name of the corresponding source file or <code>null</code>
+ * if not available
+ */
+ String getSourceFileName();
+
+ /**
+ * @return value of SourceDebugExtension attribute or <code>null</code> if
+ * not available
+ */
+ String getSourceDebugExtension();
+
+}
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/IFilterOutput.java b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/IFilterOutput.java
index 0f022201..93ad2eeb 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/IFilterOutput.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/IFilterOutput.java
@@ -1,9 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
@@ -35,7 +36,7 @@ public interface IFilterOutput {
/**
* Marks two instructions that should be merged during computation of
* coverage.
- *
+ *
* @param i1
* first instruction
* @param i2
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinCoroutineFilter.java b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinCoroutineFilter.java
index 66d450a3..4b850f33 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinCoroutineFilter.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinCoroutineFilter.java
@@ -1,9 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
@@ -19,6 +20,7 @@ import org.objectweb.asm.Type;
import org.objectweb.asm.tree.AbstractInsnNode;
import org.objectweb.asm.tree.JumpInsnNode;
import org.objectweb.asm.tree.LdcInsnNode;
+import org.objectweb.asm.tree.MethodInsnNode;
import org.objectweb.asm.tree.MethodNode;
import org.objectweb.asm.tree.TableSwitchInsnNode;
@@ -27,7 +29,11 @@ import org.objectweb.asm.tree.TableSwitchInsnNode;
*/
public final class KotlinCoroutineFilter implements IFilter {
- static boolean isLastArgumentContinuation(final MethodNode methodNode) {
+ static boolean isImplementationOfSuspendFunction(
+ final MethodNode methodNode) {
+ if (methodNode.name.startsWith("access$")) {
+ return false;
+ }
final Type methodType = Type.getMethodType(methodNode.desc);
final int lastArgument = methodType.getArgumentTypes().length - 1;
return lastArgument >= 0 && "kotlin.coroutines.Continuation".equals(
@@ -42,16 +48,41 @@ public final class KotlinCoroutineFilter implements IFilter {
}
new Matcher().match(methodNode, output);
-
+ new Matcher().matchOptimizedTailCall(methodNode, output);
}
private static class Matcher extends AbstractMatcher {
+
+ private void matchOptimizedTailCall(final MethodNode methodNode,
+ final IFilterOutput output) {
+ for (final AbstractInsnNode i : methodNode.instructions) {
+ cursor = i;
+ nextIs(Opcodes.DUP);
+ nextIsInvoke(Opcodes.INVOKESTATIC,
+ "kotlin/coroutines/intrinsics/IntrinsicsKt",
+ "getCOROUTINE_SUSPENDED", "()Ljava/lang/Object;");
+ nextIs(Opcodes.IF_ACMPNE);
+ nextIs(Opcodes.ARETURN);
+ nextIs(Opcodes.POP);
+ if (cursor != null) {
+ output.ignore(i.getNext(), cursor);
+ }
+ }
+ }
+
private void match(final MethodNode methodNode,
final IFilterOutput output) {
- cursor = methodNode.instructions.getFirst();
- nextIsInvoke(Opcodes.INVOKESTATIC,
- "kotlin/coroutines/intrinsics/IntrinsicsKt",
- "getCOROUTINE_SUSPENDED", "()Ljava/lang/Object;");
+ cursor = skipNonOpcodes(methodNode.instructions.getFirst());
+ if (cursor == null || cursor.getOpcode() != Opcodes.INVOKESTATIC) {
+ cursor = null;
+ } else {
+ final MethodInsnNode m = (MethodInsnNode) cursor;
+ if (!"kotlin/coroutines/intrinsics/IntrinsicsKt".equals(m.owner)
+ || !"getCOROUTINE_SUSPENDED".equals(m.name)
+ || !"()Ljava/lang/Object;".equals(m.desc)) {
+ cursor = null;
+ }
+ }
if (cursor == null) {
cursor = skipNonOpcodes(methodNode.instructions.getFirst());
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinDefaultArgumentsFilter.java b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinDefaultArgumentsFilter.java
index ef198447..b734d234 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinDefaultArgumentsFilter.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinDefaultArgumentsFilter.java
@@ -1,9 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
@@ -18,15 +19,16 @@ import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;
import org.objectweb.asm.tree.AbstractInsnNode;
import org.objectweb.asm.tree.JumpInsnNode;
+import org.objectweb.asm.tree.LdcInsnNode;
import org.objectweb.asm.tree.MethodNode;
import org.objectweb.asm.tree.VarInsnNode;
/**
* Filters branches that Kotlin compiler generates for default arguments.
- *
+ *
* For each default argument Kotlin compiler generates following bytecode to
* determine if it should be used or not:
- *
+ *
* <pre>
* ILOAD maskVar
* ICONST_x, BIPUSH, SIPUSH, LDC or LDC_W
@@ -35,16 +37,30 @@ import org.objectweb.asm.tree.VarInsnNode;
* default argument
* label:
* </pre>
- *
+ *
* Where <code>maskVar</code> is penultimate argument of synthetic method with
- * suffix "$default". And its value can't be zero - invocation with all
- * arguments uses original non synthetic method, thus <code>IFEQ</code>
- * instructions should be ignored.
+ * suffix "$default" or of synthetic constructor with last argument
+ * "kotlin.jvm.internal.DefaultConstructorMarker". And its value can't be zero -
+ * invocation with all arguments uses original non synthetic method, thus
+ * <code>IFEQ</code> instructions should be ignored.
*/
public final class KotlinDefaultArgumentsFilter implements IFilter {
- static boolean isDefaultArgumentsMethodName(final String methodName) {
- return methodName.endsWith("$default");
+ static boolean isDefaultArgumentsMethod(final MethodNode methodNode) {
+ return methodNode.name.endsWith("$default");
+ }
+
+ static boolean isDefaultArgumentsConstructor(final MethodNode methodNode) {
+ if (!"<init>".equals(methodNode.name)) {
+ return false;
+ }
+ final Type[] argumentTypes = Type.getMethodType(methodNode.desc)
+ .getArgumentTypes();
+ if (argumentTypes.length < 2) {
+ return false;
+ }
+ return "kotlin.jvm.internal.DefaultConstructorMarker"
+ .equals(argumentTypes[argumentTypes.length - 1].getClassName());
}
public void filter(final MethodNode methodNode,
@@ -52,24 +68,45 @@ public final class KotlinDefaultArgumentsFilter implements IFilter {
if ((methodNode.access & Opcodes.ACC_SYNTHETIC) == 0) {
return;
}
- if (!isDefaultArgumentsMethodName(methodNode.name)) {
- return;
- }
if (!KotlinGeneratedFilter.isKotlinClass(context)) {
return;
}
- new Matcher().match(methodNode, output);
+ if (isDefaultArgumentsMethod(methodNode)) {
+ new Matcher().match(methodNode, output, false);
+ } else if (isDefaultArgumentsConstructor(methodNode)) {
+ new Matcher().match(methodNode, output, true);
+ }
}
private static class Matcher extends AbstractMatcher {
public void match(final MethodNode methodNode,
- final IFilterOutput output) {
- cursor = methodNode.instructions.getFirst();
+ final IFilterOutput output, final boolean constructor) {
+ cursor = skipNonOpcodes(methodNode.instructions.getFirst());
+
+ nextIs(Opcodes.IFNULL);
+ nextIsType(Opcodes.NEW, "java/lang/UnsupportedOperationException");
+ nextIs(Opcodes.DUP);
+ nextIs(Opcodes.LDC);
+ if (cursor == null
+ || !(((LdcInsnNode) cursor).cst instanceof String)
+ || !(((String) ((LdcInsnNode) cursor).cst).startsWith(
+ "Super calls with default arguments not supported in this target"))) {
+ cursor = null;
+ }
+ nextIsInvoke(Opcodes.INVOKESPECIAL,
+ "java/lang/UnsupportedOperationException", "<init>",
+ "(Ljava/lang/String;)V");
+ nextIs(Opcodes.ATHROW);
+ if (cursor != null) {
+ output.ignore(methodNode.instructions.getFirst(), cursor);
+ next();
+ } else {
+ cursor = skipNonOpcodes(methodNode.instructions.getFirst());
+ }
final Set<AbstractInsnNode> ignore = new HashSet<AbstractInsnNode>();
- final int maskVar = Type.getMethodType(methodNode.desc)
- .getArgumentTypes().length - 2;
+ final int maskVar = maskVar(methodNode.desc, constructor);
while (true) {
if (cursor.getOpcode() != Opcodes.ILOAD) {
break;
@@ -92,6 +129,22 @@ public final class KotlinDefaultArgumentsFilter implements IFilter {
output.ignore(i, i);
}
}
+
+ private static int maskVar(final String desc,
+ final boolean constructor) {
+ int slot = 0;
+ if (constructor) {
+ // one slot for reference to current object
+ slot++;
+ }
+ final Type[] argumentTypes = Type.getMethodType(desc)
+ .getArgumentTypes();
+ final int penultimateArgument = argumentTypes.length - 2;
+ for (int i = 0; i < penultimateArgument; i++) {
+ slot += argumentTypes[i].getSize();
+ }
+ return slot;
+ }
}
}
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinDefaultMethodsFilter.java b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinDefaultMethodsFilter.java
new file mode 100644
index 00000000..50d6280e
--- /dev/null
+++ b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinDefaultMethodsFilter.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Evgeny Mandrikov - initial API and implementation
+ *
+ *******************************************************************************/
+package org.jacoco.core.internal.analysis.filter;
+
+import org.objectweb.asm.Opcodes;
+import org.objectweb.asm.tree.MethodInsnNode;
+import org.objectweb.asm.tree.MethodNode;
+
+/**
+ * Filters methods that Kotlin compiler generates for non-overridden
+ * non-abstract methods of interfaces.
+ */
+final class KotlinDefaultMethodsFilter implements IFilter {
+
+ public void filter(final MethodNode methodNode,
+ final IFilterContext context, final IFilterOutput output) {
+ if (!KotlinGeneratedFilter.isKotlinClass(context)) {
+ return;
+ }
+ new Matcher().match(methodNode, output);
+ }
+
+ private static class Matcher extends AbstractMatcher {
+ private void match(final MethodNode methodNode,
+ final IFilterOutput output) {
+ firstIsALoad0(methodNode);
+ nextIs(Opcodes.INVOKESTATIC);
+ if (cursor != null && ((MethodInsnNode) cursor).owner
+ .endsWith("$DefaultImpls")) {
+ output.ignore(methodNode.instructions.getFirst(),
+ methodNode.instructions.getLast());
+ }
+ }
+ }
+
+}
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinGeneratedFilter.java b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinGeneratedFilter.java
index 129580a9..4ebc3707 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinGeneratedFilter.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinGeneratedFilter.java
@@ -1,9 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Nikolay Krasko - initial API and implementation
@@ -49,8 +50,7 @@ public class KotlinGeneratedFilter implements IFilter {
}
private boolean hasLineNumber(final MethodNode methodNode) {
- for (AbstractInsnNode i = methodNode.instructions
- .getFirst(); i != null; i = i.getNext()) {
+ for (final AbstractInsnNode i : methodNode.instructions) {
if (AbstractInsnNode.LINE == i.getType()) {
return true;
}
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinInlineFilter.java b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinInlineFilter.java
index 5666de2d..f3e7d6b9 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinInlineFilter.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinInlineFilter.java
@@ -1,9 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
@@ -46,8 +47,7 @@ public final class KotlinInlineFilter implements IFilter {
}
int line = 0;
- for (AbstractInsnNode i = methodNode.instructions
- .getFirst(); i != null; i = i.getNext()) {
+ for (final AbstractInsnNode i : methodNode.instructions) {
if (AbstractInsnNode.LINE == i.getType()) {
line = ((LineNumberNode) i).line;
}
@@ -92,7 +92,11 @@ public final class KotlinInlineFilter implements IFilter {
}
// LineSection
int min = Integer.MAX_VALUE;
- while (!"*E".equals(line = br.readLine())) {
+ while (true) {
+ line = br.readLine();
+ if (line.equals("*E") || line.equals("*S KotlinDebug")) {
+ break;
+ }
final Matcher m = LINE_INFO_PATTERN.matcher(line);
if (!m.matches()) {
throw new IllegalStateException(
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinLateinitFilter.java b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinLateinitFilter.java
index 12fe926c..a5e20265 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinLateinitFilter.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinLateinitFilter.java
@@ -1,9 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Fabian Mastenbroek - initial API and implementation
@@ -13,6 +14,7 @@ package org.jacoco.core.internal.analysis.filter;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.tree.AbstractInsnNode;
+import org.objectweb.asm.tree.JumpInsnNode;
import org.objectweb.asm.tree.MethodNode;
/**
@@ -24,9 +26,8 @@ public class KotlinLateinitFilter implements IFilter {
public void filter(final MethodNode methodNode,
final IFilterContext context, final IFilterOutput output) {
final Matcher matcher = new Matcher();
- for (AbstractInsnNode i = methodNode.instructions
- .getFirst(); i != null; i = i.getNext()) {
- matcher.match(i, output);
+ for (final AbstractInsnNode node : methodNode.instructions) {
+ matcher.match(node, output);
}
}
@@ -44,6 +45,13 @@ public class KotlinLateinitFilter implements IFilter {
"throwUninitializedPropertyAccessException",
"(Ljava/lang/String;)V");
+ if (cursor != null
+ && skipNonOpcodes(cursor.getNext()) != skipNonOpcodes(
+ ((JumpInsnNode) start).label)) {
+ nextIs(Opcodes.ACONST_NULL);
+ nextIs(Opcodes.ATHROW);
+ }
+
if (cursor != null) {
output.ignore(start, cursor);
}
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinNotNullOperatorFilter.java b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinNotNullOperatorFilter.java
index 4dd223a3..dda54210 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinNotNullOperatorFilter.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinNotNullOperatorFilter.java
@@ -1,9 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
@@ -24,8 +25,7 @@ public final class KotlinNotNullOperatorFilter implements IFilter {
public void filter(final MethodNode methodNode,
final IFilterContext context, final IFilterOutput output) {
final Matcher matcher = new Matcher();
- for (AbstractInsnNode i = methodNode.instructions
- .getFirst(); i != null; i = i.getNext()) {
+ for (final AbstractInsnNode i : methodNode.instructions) {
matcher.match(i, output);
}
}
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinUnsafeCastOperatorFilter.java b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinUnsafeCastOperatorFilter.java
index c298e945..82522a8a 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinUnsafeCastOperatorFilter.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinUnsafeCastOperatorFilter.java
@@ -1,9 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
@@ -23,27 +24,29 @@ import org.objectweb.asm.tree.MethodNode;
*/
public final class KotlinUnsafeCastOperatorFilter implements IFilter {
- private static final String KOTLIN_TYPE_CAST_EXCEPTION = "kotlin/TypeCastException";
-
public void filter(final MethodNode methodNode,
final IFilterContext context, final IFilterOutput output) {
+ if (!KotlinGeneratedFilter.isKotlinClass(context)) {
+ return;
+ }
final Matcher matcher = new Matcher();
- for (AbstractInsnNode i = methodNode.instructions
- .getFirst(); i != null; i = i.getNext()) {
- matcher.match(i, output);
+ for (final AbstractInsnNode i : methodNode.instructions) {
+ matcher.match("kotlin/TypeCastException", i, output);
+ // Since Kotlin 1.4.0:
+ matcher.match("java/lang/NullPointerException", i, output);
}
}
private static class Matcher extends AbstractMatcher {
- public void match(final AbstractInsnNode start,
- final IFilterOutput output) {
+ public void match(final String exceptionType,
+ final AbstractInsnNode start, final IFilterOutput output) {
if (Opcodes.IFNONNULL != start.getOpcode()) {
return;
}
cursor = start;
-
- nextIsType(Opcodes.NEW, KOTLIN_TYPE_CAST_EXCEPTION);
+ final JumpInsnNode jumpInsnNode = (JumpInsnNode) cursor;
+ nextIsType(Opcodes.NEW, exceptionType);
nextIs(Opcodes.DUP);
nextIs(Opcodes.LDC);
if (cursor == null) {
@@ -54,13 +57,13 @@ public final class KotlinUnsafeCastOperatorFilter implements IFilter {
.startsWith("null cannot be cast to non-null type"))) {
return;
}
- nextIsInvoke(Opcodes.INVOKESPECIAL, KOTLIN_TYPE_CAST_EXCEPTION,
- "<init>", "(Ljava/lang/String;)V");
+ nextIsInvoke(Opcodes.INVOKESPECIAL, exceptionType, "<init>",
+ "(Ljava/lang/String;)V");
nextIs(Opcodes.ATHROW);
if (cursor == null) {
return;
}
- if (cursor.getNext() != ((JumpInsnNode) start).label) {
+ if (cursor.getNext() != jumpInsnNode.label) {
return;
}
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinWhenFilter.java b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinWhenFilter.java
index a229aa04..ba2fb95c 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinWhenFilter.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinWhenFilter.java
@@ -1,9 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
@@ -17,7 +18,6 @@ import java.util.Set;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.tree.AbstractInsnNode;
-import org.objectweb.asm.tree.InsnNode;
import org.objectweb.asm.tree.JumpInsnNode;
import org.objectweb.asm.tree.LabelNode;
import org.objectweb.asm.tree.LookupSwitchInsnNode;
@@ -37,15 +37,14 @@ public final class KotlinWhenFilter implements IFilter {
public void filter(final MethodNode methodNode,
final IFilterContext context, final IFilterOutput output) {
final Matcher matcher = new Matcher();
- for (AbstractInsnNode i = methodNode.instructions
- .getFirst(); i != null; i = i.getNext()) {
+ for (final AbstractInsnNode i : methodNode.instructions) {
matcher.match(i, output);
}
}
private static class Matcher extends AbstractMatcher {
void match(final AbstractInsnNode start, final IFilterOutput output) {
- if (start.getType() != InsnNode.LABEL) {
+ if (start.getType() != AbstractInsnNode.LABEL) {
return;
}
cursor = start;
@@ -92,7 +91,7 @@ public final class KotlinWhenFilter implements IFilter {
labels = ((TableSwitchInsnNode) switchNode).labels;
}
final Set<AbstractInsnNode> newTargets = new HashSet<AbstractInsnNode>();
- for (LabelNode label : labels) {
+ for (final LabelNode label : labels) {
newTargets.add(AbstractMatcher.skipNonOpcodes(label));
}
output.replaceBranches(switchNode, newTargets);
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinWhenStringFilter.java b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinWhenStringFilter.java
index fcccb550..5fd20874 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinWhenStringFilter.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinWhenStringFilter.java
@@ -1,9 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
@@ -32,8 +33,7 @@ public final class KotlinWhenStringFilter implements IFilter {
public void filter(final MethodNode methodNode,
final IFilterContext context, final IFilterOutput output) {
final Matcher matcher = new Matcher();
- for (AbstractInsnNode i = methodNode.instructions
- .getFirst(); i != null; i = i.getNext()) {
+ for (final AbstractInsnNode i : methodNode.instructions) {
matcher.match(i, output);
}
}
@@ -67,10 +67,14 @@ public final class KotlinWhenStringFilter implements IFilter {
hashCodes = tableSwitch.labels.size();
}
+ if (hashCodes == 0) {
+ return;
+ }
+
final Set<AbstractInsnNode> replacements = new HashSet<AbstractInsnNode>();
replacements.add(skipNonOpcodes(defaultLabel));
- for (int i = 0; i < hashCodes; i++) {
+ for (int i = 1; i <= hashCodes; i++) {
while (true) {
nextIsVar(Opcodes.ALOAD, "s");
nextIs(Opcodes.LDC);
@@ -79,18 +83,24 @@ public final class KotlinWhenStringFilter implements IFilter {
// jump to next comparison or default case
nextIs(Opcodes.IFEQ);
final JumpInsnNode jump = (JumpInsnNode) cursor;
- // jump to case
- nextIs(Opcodes.GOTO);
+ next();
if (cursor == null) {
return;
- }
-
- replacements
- .add(skipNonOpcodes(((JumpInsnNode) cursor).label));
-
- if (jump.label == defaultLabel) {
- // end of comparisons for same hashCode
+ } else if (cursor.getOpcode() == Opcodes.GOTO) {
+ // jump to case body
+ replacements.add(
+ skipNonOpcodes(((JumpInsnNode) cursor).label));
+ if (jump.label == defaultLabel) {
+ // end of comparisons for same hashCode
+ break;
+ }
+ } else if (i == hashCodes && jump.label == defaultLabel) {
+ // case body
+ replacements.add(cursor);
+ cursor = jump;
break;
+ } else {
+ return;
}
}
}
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/PrivateEmptyNoArgConstructorFilter.java b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/PrivateEmptyNoArgConstructorFilter.java
index 236ef712..4b22dc29 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/PrivateEmptyNoArgConstructorFilter.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/PrivateEmptyNoArgConstructorFilter.java
@@ -1,9 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/RecordsFilter.java b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/RecordsFilter.java
new file mode 100644
index 00000000..745848ba
--- /dev/null
+++ b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/RecordsFilter.java
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Evgeny Mandrikov - initial API and implementation
+ *
+ *******************************************************************************/
+package org.jacoco.core.internal.analysis.filter;
+
+import org.objectweb.asm.Handle;
+import org.objectweb.asm.Opcodes;
+import org.objectweb.asm.tree.InvokeDynamicInsnNode;
+import org.objectweb.asm.tree.MethodNode;
+
+/**
+ * Filters methods <code>toString</code>, <code>hashCode</code> and
+ * <code>equals</code> that compiler generates for records.
+ */
+public final class RecordsFilter implements IFilter {
+
+ public void filter(final MethodNode methodNode,
+ final IFilterContext context, final IFilterOutput output) {
+ if (!"java/lang/Record".equals(context.getSuperClassName())) {
+ return;
+ }
+ final Matcher matcher = new Matcher();
+ if (matcher.isEquals(methodNode) || matcher.isHashCode(methodNode)
+ || matcher.isToString(methodNode)) {
+ output.ignore(methodNode.instructions.getFirst(),
+ methodNode.instructions.getLast());
+ }
+ }
+
+ private static class Matcher extends AbstractMatcher {
+ boolean isToString(final MethodNode m) {
+ if (!"toString".equals(m.name)
+ || !"()Ljava/lang/String;".equals(m.desc)) {
+ return false;
+ }
+ firstIsALoad0(m);
+ nextIsInvokeDynamic("toString");
+ nextIs(Opcodes.ARETURN);
+ return cursor != null;
+ }
+
+ boolean isHashCode(final MethodNode m) {
+ if (!"hashCode".equals(m.name) || !"()I".equals(m.desc)) {
+ return false;
+ }
+ firstIsALoad0(m);
+ nextIsInvokeDynamic("hashCode");
+ nextIs(Opcodes.IRETURN);
+ return cursor != null;
+ }
+
+ boolean isEquals(final MethodNode m) {
+ if (!"equals".equals(m.name)
+ || !"(Ljava/lang/Object;)Z".equals(m.desc)) {
+ return false;
+ }
+ firstIsALoad0(m);
+ nextIs(Opcodes.ALOAD);
+ nextIsInvokeDynamic("equals");
+ nextIs(Opcodes.IRETURN);
+ return cursor != null;
+ }
+
+ private void nextIsInvokeDynamic(final String name) {
+ nextIs(Opcodes.INVOKEDYNAMIC);
+ if (cursor == null) {
+ return;
+ }
+ final InvokeDynamicInsnNode i = (InvokeDynamicInsnNode) cursor;
+ final Handle bsm = i.bsm;
+ if (name.equals(i.name)
+ && "java/lang/runtime/ObjectMethods".equals(bsm.getOwner())
+ && "bootstrap".equals(bsm.getName())) {
+ return;
+ }
+ cursor = null;
+ }
+ }
+
+}
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/StringSwitchEcjFilter.java b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/StringSwitchFilter.java
index e0aba35d..a78e253e 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/StringSwitchEcjFilter.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/StringSwitchFilter.java
@@ -1,9 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
@@ -25,15 +26,15 @@ import org.objectweb.asm.tree.VarInsnNode;
/**
* Filters code that is generated by ECJ for a <code>switch</code> statement
- * with a <code>String</code>.
+ * with a <code>String</code> and by Kotlin compiler 1.5 and above for a
+ * <code>when</code> expression with a <code>String</code>.
*/
-public final class StringSwitchEcjFilter implements IFilter {
+public final class StringSwitchFilter implements IFilter {
public void filter(final MethodNode methodNode,
final IFilterContext context, final IFilterOutput output) {
final Matcher matcher = new Matcher();
- for (AbstractInsnNode i = methodNode.instructions
- .getFirst(); i != null; i = i.getNext()) {
+ for (final AbstractInsnNode i : methodNode.instructions) {
matcher.match(i, output);
}
}
@@ -42,7 +43,8 @@ public final class StringSwitchEcjFilter implements IFilter {
public void match(final AbstractInsnNode start,
final IFilterOutput output) {
- if (Opcodes.ASTORE != start.getOpcode()) {
+ if (start.getOpcode() != /* ECJ */ Opcodes.ASTORE
+ && start.getOpcode() != /* Kotlin */ Opcodes.ALOAD) {
return;
}
cursor = start;
@@ -67,6 +69,10 @@ public final class StringSwitchEcjFilter implements IFilter {
hashCodes = tableSwitch.labels.size();
}
+ if (hashCodes == 0) {
+ return;
+ }
+
final Set<AbstractInsnNode> replacements = new HashSet<AbstractInsnNode>();
replacements.add(skipNonOpcodes(defaultLabel));
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/StringSwitchJavacFilter.java b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/StringSwitchJavacFilter.java
index 3033d9bc..a5baf34c 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/StringSwitchJavacFilter.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/StringSwitchJavacFilter.java
@@ -1,9 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
@@ -26,10 +27,8 @@ public final class StringSwitchJavacFilter implements IFilter {
public void filter(final MethodNode methodNode,
final IFilterContext context, final IFilterOutput output) {
- AbstractInsnNode i = methodNode.instructions.getFirst();
- while (i != null) {
+ for (final AbstractInsnNode i : methodNode.instructions) {
filter(i, output);
- i = i.getNext();
}
}
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/SynchronizedFilter.java b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/SynchronizedFilter.java
index 6341328f..abc9e45b 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/SynchronizedFilter.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/SynchronizedFilter.java
@@ -1,9 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/SyntheticFilter.java b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/SyntheticFilter.java
index 69c4092a..127f7b03 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/SyntheticFilter.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/SyntheticFilter.java
@@ -1,9 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
@@ -19,6 +20,11 @@ import org.objectweb.asm.tree.MethodNode;
*/
public final class SyntheticFilter implements IFilter {
+ private static boolean isScalaClass(final IFilterContext context) {
+ return context.getClassAttributes().contains("ScalaSig")
+ || context.getClassAttributes().contains("Scala");
+ }
+
public void filter(final MethodNode methodNode,
final IFilterContext context, final IFilterOutput output) {
if ((methodNode.access & Opcodes.ACC_SYNTHETIC) == 0) {
@@ -29,13 +35,25 @@ public final class SyntheticFilter implements IFilter {
return;
}
+ if (isScalaClass(context)) {
+ if (methodNode.name.startsWith("$anonfun$")) {
+ return;
+ }
+ }
+
if (KotlinGeneratedFilter.isKotlinClass(context)) {
if (KotlinDefaultArgumentsFilter
- .isDefaultArgumentsMethodName(methodNode.name)) {
+ .isDefaultArgumentsMethod(methodNode)) {
+ return;
+ }
+
+ if (KotlinDefaultArgumentsFilter
+ .isDefaultArgumentsConstructor(methodNode)) {
return;
}
- if (KotlinCoroutineFilter.isLastArgumentContinuation(methodNode)) {
+ if (KotlinCoroutineFilter
+ .isImplementationOfSuspendFunction(methodNode)) {
return;
}
}
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/TryWithResourcesEcjFilter.java b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/TryWithResourcesEcjFilter.java
index 94dea561..714ab223 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/TryWithResourcesEcjFilter.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/TryWithResourcesEcjFilter.java
@@ -1,9 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/TryWithResourcesJavac11Filter.java b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/TryWithResourcesJavac11Filter.java
index 7a20f74f..0b451750 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/TryWithResourcesJavac11Filter.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/TryWithResourcesJavac11Filter.java
@@ -1,9 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
@@ -55,7 +56,7 @@ public final class TryWithResourcesJavac11Filter implements IFilter {
* throw primaryExc;
* }
* </pre>
- *
+ *
* <code>null</code> check for resource is omitted when it is initialized
* using <code>new</code>
*/
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/TryWithResourcesJavacFilter.java b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/TryWithResourcesJavacFilter.java
index 23ecb0e6..c3a0fa32 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/TryWithResourcesJavacFilter.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/TryWithResourcesJavacFilter.java
@@ -1,9 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
@@ -47,7 +48,7 @@ public final class TryWithResourcesJavacFilter implements IFilter {
* compilation of source code that is described in <a href=
* "http://docs.oracle.com/javase/specs/jls/se8/html/jls-14.html#jls-14.20.3.1">JLS
* 14.20.3. try-with-resources</a>:
- *
+ *
* <pre>
* Resource r = ...;
* Throwable primaryExc = null;
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/data/CRC64.java b/org.jacoco.core/src/org/jacoco/core/internal/data/CRC64.java
index 620a46f0..b0e8a098 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/data/CRC64.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/data/CRC64.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.internal.data;
@@ -16,7 +17,7 @@ import org.objectweb.asm.Opcodes;
/**
* CRC64 checksum calculator based on the polynom specified in ISO 3309. The
* implementation is based on the following publications:
- *
+ *
* <ul>
* <li>http://en.wikipedia.org/wiki/Cyclic_redundancy_check</li>
* <li>http://www.geocities.com/SiliconValley/Pines/8659/crc.htm</li>
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/data/CompactDataInput.java b/org.jacoco.core/src/org/jacoco/core/internal/data/CompactDataInput.java
index 945b2b64..2f4e2eee 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/data/CompactDataInput.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/data/CompactDataInput.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.internal.data;
@@ -17,7 +18,7 @@ import java.io.InputStream;
/**
* Additional data input methods for compact storage of data structures.
- *
+ *
* @see CompactDataOutput
*/
public class CompactDataInput extends DataInputStream {
@@ -25,7 +26,7 @@ public class CompactDataInput extends DataInputStream {
/**
* Creates a new {@link CompactDataInput} that uses the specified underlying
* input stream.
- *
+ *
* @param in
* underlying input stream
*/
@@ -35,7 +36,7 @@ public class CompactDataInput extends DataInputStream {
/**
* Reads a variable length representation of an integer value.
- *
+ *
* @return read value
* @throws IOException
* if thrown by the underlying stream
@@ -50,7 +51,7 @@ public class CompactDataInput extends DataInputStream {
/**
* Reads a boolean array.
- *
+ *
* @return boolean array
* @throws IOException
* if thrown by the underlying stream
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/data/CompactDataOutput.java b/org.jacoco.core/src/org/jacoco/core/internal/data/CompactDataOutput.java
index 4d230f8e..ba52555e 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/data/CompactDataOutput.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/data/CompactDataOutput.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.internal.data;
@@ -17,7 +18,7 @@ import java.io.OutputStream;
/**
* Additional data output methods for compact storage of data structures.
- *
+ *
* @see CompactDataInput
*/
public class CompactDataOutput extends DataOutputStream {
@@ -25,7 +26,7 @@ public class CompactDataOutput extends DataOutputStream {
/**
* Creates a new {@link CompactDataOutput} instance that writes data to the
* specified underlying output stream
- *
+ *
* @param out
* underlying output stream
*/
@@ -37,7 +38,7 @@ public class CompactDataOutput extends DataOutputStream {
* Writes a variable length representation of an integer value that reduces
* the number of written bytes for small positive values. Depending on the
* given value 1 to 5 bytes will be written to the underlying stream.
- *
+ *
* @param value
* value to write
* @throws IOException
@@ -55,7 +56,7 @@ public class CompactDataOutput extends DataOutputStream {
/**
* Writes a boolean array. Internally a sequence of boolean values is packed
* into single bits.
- *
+ *
* @param value
* boolean array
* @throws IOException
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/flow/ClassProbesAdapter.java b/org.jacoco.core/src/org/jacoco/core/internal/flow/ClassProbesAdapter.java
index 876a1351..3ed19a88 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/flow/ClassProbesAdapter.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/flow/ClassProbesAdapter.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.internal.flow;
@@ -20,8 +21,8 @@ import org.objectweb.asm.commons.AnalyzerAdapter;
* A {@link org.objectweb.asm.ClassVisitor} that calculates probes for every
* method.
*/
-public class ClassProbesAdapter extends ClassVisitor implements
- IProbeIdGenerator {
+public class ClassProbesAdapter extends ClassVisitor
+ implements IProbeIdGenerator {
private static final MethodProbesVisitor EMPTY_METHOD_PROBES_VISITOR = new MethodProbesVisitor() {
};
@@ -36,7 +37,7 @@ public class ClassProbesAdapter extends ClassVisitor implements
/**
* Creates a new adapter that delegates to the given visitor.
- *
+ *
* @param cv
* instance to delegate to
* @param trackFrames
@@ -59,7 +60,8 @@ public class ClassProbesAdapter extends ClassVisitor implements
@Override
public final MethodVisitor visitMethod(final int access, final String name,
- final String desc, final String signature, final String[] exceptions) {
+ final String desc, final String signature,
+ final String[] exceptions) {
final MethodProbesVisitor methodProbes;
final MethodProbesVisitor mv = cv.visitMethod(access, name, desc,
signature, exceptions);
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/flow/ClassProbesVisitor.java b/org.jacoco.core/src/org/jacoco/core/internal/flow/ClassProbesVisitor.java
index 54817e80..f8325efc 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/flow/ClassProbesVisitor.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/flow/ClassProbesVisitor.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.internal.flow;
@@ -29,7 +30,7 @@ public abstract class ClassProbesVisitor extends ClassVisitor {
/**
* New visitor instance that delegates to the given visitor.
- *
+ *
* @param cv
* optional next visitor in chain
*/
@@ -50,7 +51,7 @@ public abstract class ClassProbesVisitor extends ClassVisitor {
* is called just before {@link ClassVisitor#visitEnd()}. For interfaces
* this method is called before the first method (the static initializer) is
* emitted.
- *
+ *
* @param count
* total number of probes
*/
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/flow/FrameSnapshot.java b/org.jacoco.core/src/org/jacoco/core/internal/flow/FrameSnapshot.java
index a0c7449f..b8c819da 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/flow/FrameSnapshot.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/flow/FrameSnapshot.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.internal.flow;
@@ -36,7 +37,7 @@ class FrameSnapshot implements IFrame {
/**
* Create a IFrame instance based on the given analyzer.
- *
+ *
* @param analyzer
* analyzer instance or <code>null</code>
* @param popCount
@@ -58,7 +59,8 @@ class FrameSnapshot implements IFrame {
* {@link MethodVisitor#visitFrame(int, int, Object[], int, Object[])}
* method.
*/
- private static Object[] reduce(final List<Object> source, final int popCount) {
+ private static Object[] reduce(final List<Object> source,
+ final int popCount) {
final List<Object> copy = new ArrayList<Object>(source);
final int size = source.size() - popCount;
copy.subList(size, source.size()).clear();
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/flow/IFrame.java b/org.jacoco.core/src/org/jacoco/core/internal/flow/IFrame.java
index 6079f443..5c10ae76 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/flow/IFrame.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/flow/IFrame.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.internal.flow;
@@ -20,7 +21,7 @@ public interface IFrame {
/**
* Emits a frame event with the current content to the given visitor.
- *
+ *
* @param mv
* method visitor to emit frame event to
*/
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/flow/IProbeIdGenerator.java b/org.jacoco.core/src/org/jacoco/core/internal/flow/IProbeIdGenerator.java
index 6f3f1977..692fea03 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/flow/IProbeIdGenerator.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/flow/IProbeIdGenerator.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.internal.flow;
@@ -18,7 +19,7 @@ public interface IProbeIdGenerator {
/**
* Returns the next unique probe id.
- *
+ *
* @return unique probe id
*/
int nextId();
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/flow/LabelFlowAnalyzer.java b/org.jacoco.core/src/org/jacoco/core/internal/flow/LabelFlowAnalyzer.java
index 0f0e4d33..f44d66da 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/flow/LabelFlowAnalyzer.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/flow/LabelFlowAnalyzer.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.internal.flow;
@@ -27,7 +28,7 @@ public final class LabelFlowAnalyzer extends MethodVisitor {
/**
* Marks all labels of the method with control flow information.
- *
+ *
* @param method
* Method to mark labels
*/
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/flow/LabelInfo.java b/org.jacoco.core/src/org/jacoco/core/internal/flow/LabelInfo.java
index 85dc1d81..122d62b5 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/flow/LabelInfo.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/flow/LabelInfo.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.internal.flow;
@@ -48,7 +49,7 @@ public final class LabelInfo {
/**
* Defines that the given label is a jump target.
- *
+ *
* @param label
* label to define
*/
@@ -64,7 +65,7 @@ public final class LabelInfo {
/**
* Defines that the given label is the possible successor of the previous
* instruction in the method.
- *
+ *
* @param label
* label to define
*/
@@ -81,7 +82,7 @@ public final class LabelInfo {
* to a certain label are: jump targets, exception handlers and normal
* control flow from its predecessor instruction (unless this is an
* unconditional jump or method exit).
- *
+ *
* @param label
* label to check
* @return <code>true</code> if the given multiple control paths lead to the
@@ -96,7 +97,7 @@ public final class LabelInfo {
* Checks whether this label is the possible successor of the previous
* instruction in the method. This is the case if the predecessor isn't a
* unconditional jump or method exit instruction.
- *
+ *
* @param label
* label to check
* @return <code>true</code> if the label is a possible instruction
@@ -109,7 +110,7 @@ public final class LabelInfo {
/**
* Mark a given label as the beginning of a line with method invocations.
- *
+ *
* @param label
* label to mark
*/
@@ -120,7 +121,7 @@ public final class LabelInfo {
/**
* Checks whether the a given label has been marked as a line with method
* invocations.
- *
+ *
* @param label
* label to check
* @return <code>true</code> if the label represents a line with method
@@ -133,7 +134,7 @@ public final class LabelInfo {
/**
* Determines whether the given label needs a probe to be inserted before.
- *
+ *
* @param label
* label to test
* @return <code>true</code> if a probe should be inserted before
@@ -146,7 +147,7 @@ public final class LabelInfo {
/**
* Mark a given label as done.
- *
+ *
* @param label
* label to mark
*/
@@ -156,7 +157,7 @@ public final class LabelInfo {
/**
* Resets the "done" status of a given label.
- *
+ *
* @param label
* label to reset
*/
@@ -169,7 +170,7 @@ public final class LabelInfo {
/**
* Resets the "done" status of all given labels.
- *
+ *
* @param labels
* labels to reset
*/
@@ -181,7 +182,7 @@ public final class LabelInfo {
/**
* Checks whether this label is marked as done.
- *
+ *
* @param label
* label to check
* @return <code>true</code> if this label is marked as done
@@ -193,7 +194,7 @@ public final class LabelInfo {
/**
* Sets the given probe id to the given label.
- *
+ *
* @param label
* label to assign a probe to
* @param id
@@ -205,7 +206,7 @@ public final class LabelInfo {
/**
* Returns the assigned probe id.
- *
+ *
* @param label
* label to check
* @return probe id or {@link #NO_PROBE} if no probe is assigned to the
@@ -219,7 +220,7 @@ public final class LabelInfo {
/**
* Defines an intermediate label for the given label. Such intermediate
* labels are required during instrumentation to add probes to jump targets.
- *
+ *
* @param label
* label to define for
* @param intermediate
@@ -233,7 +234,7 @@ public final class LabelInfo {
/**
* Returns the intermediate label for the given label if one has been
* defined.
- *
+ *
* @param label
* label to look for
* @return intermediate label or <code>null</code>
@@ -245,7 +246,7 @@ public final class LabelInfo {
/**
* Sets the instruction corresponding to this label.
- *
+ *
* @param label
* label to set the instruction for
* @param instruction
@@ -259,7 +260,7 @@ public final class LabelInfo {
/**
* Returns the corresponding instruction for the given label if one has been
* defined.
- *
+ *
* @param label
* label to look for
* @return corresponding instruction or <code>null</code>
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/flow/MethodProbesAdapter.java b/org.jacoco.core/src/org/jacoco/core/internal/flow/MethodProbesAdapter.java
index 40e20a3e..30253d02 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/flow/MethodProbesAdapter.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/flow/MethodProbesAdapter.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.internal.flow;
@@ -36,7 +37,7 @@ public final class MethodProbesAdapter extends MethodVisitor {
/**
* Create a new adapter instance.
- *
+ *
* @param probesVisitor
* visitor to delegate to
* @param idGenerator
@@ -53,7 +54,7 @@ public final class MethodProbesAdapter extends MethodVisitor {
/**
* If an analyzer is set {@link IFrame} handles are calculated and emitted
* to the probes methods.
- *
+ *
* @param analyzer
* optional analyzer to set
*/
@@ -64,8 +65,8 @@ public final class MethodProbesAdapter extends MethodVisitor {
@Override
public void visitTryCatchBlock(final Label start, final Label end,
final Label handler, final String type) {
- probesVisitor.visitTryCatchBlock(getTryCatchLabel(start), getTryCatchLabel(end),
- handler, type);
+ probesVisitor.visitTryCatchBlock(getTryCatchLabel(start),
+ getTryCatchLabel(end), handler, type);
}
private Label getTryCatchLabel(Label label) {
@@ -154,8 +155,8 @@ public final class MethodProbesAdapter extends MethodVisitor {
public void visitTableSwitchInsn(final int min, final int max,
final Label dflt, final Label... labels) {
if (markLabels(dflt, labels)) {
- probesVisitor.visitTableSwitchInsnWithProbes(min, max, dflt,
- labels, frame(1));
+ probesVisitor.visitTableSwitchInsnWithProbes(min, max, dflt, labels,
+ frame(1));
} else {
probesVisitor.visitTableSwitchInsn(min, max, dflt, labels);
}
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/flow/MethodProbesVisitor.java b/org.jacoco.core/src/org/jacoco/core/internal/flow/MethodProbesVisitor.java
index 75e63555..b9073c4b 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/flow/MethodProbesVisitor.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/flow/MethodProbesVisitor.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.internal.flow;
@@ -31,7 +32,7 @@ public abstract class MethodProbesVisitor extends MethodVisitor {
/**
* New visitor instance that delegates to the given visitor.
- *
+ *
* @param mv
* optional next visitor in chain
*/
@@ -42,7 +43,7 @@ public abstract class MethodProbesVisitor extends MethodVisitor {
/**
* Visits an unconditional probe that should be inserted at the current
* position.
- *
+ *
* @param probeId
* id of the probe to insert
*/
@@ -54,7 +55,7 @@ public abstract class MethodProbesVisitor extends MethodVisitor {
* Visits a jump instruction. A probe with the given id should be inserted
* in a way that it is executed only when the jump to the given label is
* executed.
- *
+ *
* @param opcode
* the opcode of the type instruction to be visited. This opcode
* is either IFEQ, IFNE, IFLT, IFGE, IFGT, IFLE, IF_ICMPEQ,
@@ -81,7 +82,7 @@ public abstract class MethodProbesVisitor extends MethodVisitor {
* Visits a zero operand instruction with a probe. This event is used only
* for instructions that terminate the method. Therefore the probe must be
* inserted before the actual instruction.
- *
+ *
* @param opcode
* the opcode of the instruction to be visited. This opcode is
* either IRETURN, LRETURN, FRETURN, DRETURN, ARETURN, RETURN or
@@ -100,7 +101,7 @@ public abstract class MethodProbesVisitor extends MethodVisitor {
* target labels will always have the same probe id within a call to this
* method. The probe id for each label can be obtained with
* {@link LabelInfo#getProbeId(Label)}.
- *
+ *
* @param min
* the minimum key value.
* @param max
@@ -128,7 +129,7 @@ public abstract class MethodProbesVisitor extends MethodVisitor {
* target labels will always have the same probe id within a call to this
* method. The probe id for each label can be obtained with
* {@link LabelInfo#getProbeId(Label)}.
- *
+ *
* @param dflt
* beginning of the default handler block.
* @param keys
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/flow/MethodSanitizer.java b/org.jacoco.core/src/org/jacoco/core/internal/flow/MethodSanitizer.java
index 92b08947..34c38004 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/flow/MethodSanitizer.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/flow/MethodSanitizer.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.internal.flow;
@@ -18,7 +19,7 @@ import org.objectweb.asm.commons.JSRInlinerAdapter;
/**
* This method visitor fixes two potential issues with Java byte code:
- *
+ *
* <ul>
* <li>Remove JSR/RET instructions by inlining subroutines which are deprecated
* since Java 6. The RET statement complicates control flow analysis as the jump
@@ -30,8 +31,8 @@ import org.objectweb.asm.commons.JSRInlinerAdapter;
*/
class MethodSanitizer extends JSRInlinerAdapter {
- MethodSanitizer(final MethodVisitor mv, final int access,
- final String name, final String desc, final String signature,
+ MethodSanitizer(final MethodVisitor mv, final int access, final String name,
+ final String desc, final String signature,
final String[] exceptions) {
super(InstrSupport.ASM_API_VERSION, mv, access, name, desc, signature,
exceptions);
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/instr/ClassFieldProbeArrayStrategy.java b/org.jacoco.core/src/org/jacoco/core/internal/instr/ClassFieldProbeArrayStrategy.java
index 950be683..7a54b6d8 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/instr/ClassFieldProbeArrayStrategy.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/instr/ClassFieldProbeArrayStrategy.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.internal.instr;
@@ -27,7 +28,8 @@ class ClassFieldProbeArrayStrategy implements IProbeArrayStrategy {
/**
* Frame stack with a single boolean array.
*/
- private static final Object[] FRAME_STACK_ARRZ = new Object[] { InstrSupport.DATAFIELD_DESC };
+ private static final Object[] FRAME_STACK_ARRZ = new Object[] {
+ InstrSupport.DATAFIELD_DESC };
/**
* Empty frame locals.
@@ -107,9 +109,9 @@ class ClassFieldProbeArrayStrategy implements IProbeArrayStrategy {
/**
* Generates the byte code to initialize the static coverage data field
* within this class.
- *
+ *
* The code will push the [Z data array on the operand stack.
- *
+ *
* @param mv
* generator to emit code to
*/
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/instr/ClassInstrumenter.java b/org.jacoco.core/src/org/jacoco/core/internal/instr/ClassInstrumenter.java
index 7d5e9759..476c9e34 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/instr/ClassInstrumenter.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/instr/ClassInstrumenter.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.internal.instr;
@@ -28,7 +29,7 @@ public class ClassInstrumenter extends ClassProbesVisitor {
/**
* Emits a instrumented version of this class to the given class visitor.
- *
+ *
* @param probeArrayStrategy
* this strategy will be used to access the probe array
* @param cv
@@ -58,7 +59,8 @@ public class ClassInstrumenter extends ClassProbesVisitor {
@Override
public MethodProbesVisitor visitMethod(final int access, final String name,
- final String desc, final String signature, final String[] exceptions) {
+ final String desc, final String signature,
+ final String[] exceptions) {
InstrSupport.assertNotInstrumented(name, className);
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/instr/CondyProbeArrayStrategy.java b/org.jacoco.core/src/org/jacoco/core/internal/instr/CondyProbeArrayStrategy.java
index ca2fb60d..31cc97a9 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/instr/CondyProbeArrayStrategy.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/instr/CondyProbeArrayStrategy.java
@@ -1,9 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
@@ -11,9 +12,9 @@
*******************************************************************************/
package org.jacoco.core.internal.instr;
+import org.jacoco.core.runtime.IExecutionDataAccessorGenerator;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ConstantDynamic;
-import org.jacoco.core.runtime.IExecutionDataAccessorGenerator;
import org.objectweb.asm.Handle;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/instr/DuplicateFrameEliminator.java b/org.jacoco.core/src/org/jacoco/core/internal/instr/DuplicateFrameEliminator.java
index bc3e54bf..dfc88b44 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/instr/DuplicateFrameEliminator.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/instr/DuplicateFrameEliminator.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.internal.instr;
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/instr/IProbeArrayStrategy.java b/org.jacoco.core/src/org/jacoco/core/internal/instr/IProbeArrayStrategy.java
index 5fe0cdca..9b24f9a6 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/instr/IProbeArrayStrategy.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/instr/IProbeArrayStrategy.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.internal.instr;
@@ -23,7 +24,7 @@ public interface IProbeArrayStrategy {
/**
* Creates code that stores the probe array instance in the given variable.
- *
+ *
* @param mv
* visitor to create code
* @param clinit
@@ -37,7 +38,7 @@ public interface IProbeArrayStrategy {
/**
* Adds additional class members required by this strategy. This method is
* called after all original members of the class has been processed.
- *
+ *
* @param cv
* visitor to create fields and methods
* @param probeCount
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/instr/IProbeInserter.java b/org.jacoco.core/src/org/jacoco/core/internal/instr/IProbeInserter.java
index 2f8dab61..9b22ede4 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/instr/IProbeInserter.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/instr/IProbeInserter.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.internal.instr;
@@ -19,7 +20,7 @@ interface IProbeInserter {
/**
* Inserts the probe with the given id.
- *
+ *
* @param id
* id of the probe to insert
*/
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/instr/InstrSupport.java b/org.jacoco.core/src/org/jacoco/core/internal/instr/InstrSupport.java
index 4d4e1ba1..c125112d 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/instr/InstrSupport.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/instr/InstrSupport.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.internal.instr;
@@ -26,7 +27,7 @@ public final class InstrSupport {
}
/** ASM API version */
- public static final int ASM_API_VERSION = Opcodes.ASM7;
+ public static final int ASM_API_VERSION = Opcodes.ASM9;
// === Data Field ===
@@ -212,7 +213,7 @@ public final class InstrSupport {
/**
* Determines whether the given class file version requires stackmap frames.
- *
+ *
* @param version
* class file version
* @return <code>true</code> if frames are required
@@ -226,7 +227,7 @@ public final class InstrSupport {
* Ensures that the given member does not correspond to a internal member
* created by the instrumentation process. This would mean that the class is
* already instrumented.
- *
+ *
* @param member
* name of the member to check
* @param owner
@@ -248,7 +249,7 @@ public final class InstrSupport {
* Generates the instruction to push the given int value on the stack.
* Implementation taken from
* {@link org.objectweb.asm.commons.GeneratorAdapter#push(int)}.
- *
+ *
* @param mv
* visitor to emit the instruction
* @param value
@@ -276,9 +277,9 @@ public final class InstrSupport {
*/
public static ClassReader classReaderFor(final byte[] b) {
final int originalVersion = getMajorVersion(b);
- if (originalVersion == Opcodes.V12 + 1) {
+ if (originalVersion == Opcodes.V16 + 1) {
// temporarily downgrade version to bypass check in ASM
- setMajorVersion(Opcodes.V12, b);
+ setMajorVersion(Opcodes.V16, b);
}
final ClassReader classReader = new ClassReader(b);
setMajorVersion(originalVersion, b);
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/instr/InterfaceFieldProbeArrayStrategy.java b/org.jacoco.core/src/org/jacoco/core/internal/instr/InterfaceFieldProbeArrayStrategy.java
index bf855fea..decd234c 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/instr/InterfaceFieldProbeArrayStrategy.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/instr/InterfaceFieldProbeArrayStrategy.java
@@ -1,9 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
@@ -27,7 +28,8 @@ class InterfaceFieldProbeArrayStrategy implements IProbeArrayStrategy {
/**
* Frame stack with a single boolean array.
*/
- private static final Object[] FRAME_STACK_ARRZ = new Object[] { InstrSupport.DATAFIELD_DESC };
+ private static final Object[] FRAME_STACK_ARRZ = new Object[] {
+ InstrSupport.DATAFIELD_DESC };
/**
* Empty frame locals.
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/instr/LocalProbeArrayStrategy.java b/org.jacoco.core/src/org/jacoco/core/internal/instr/LocalProbeArrayStrategy.java
index 67068ed7..9e30703e 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/instr/LocalProbeArrayStrategy.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/instr/LocalProbeArrayStrategy.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.internal.instr;
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/instr/MethodInstrumenter.java b/org.jacoco.core/src/org/jacoco/core/internal/instr/MethodInstrumenter.java
index 396368b5..7fcab58e 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/instr/MethodInstrumenter.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/instr/MethodInstrumenter.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.internal.instr;
@@ -28,7 +29,7 @@ class MethodInstrumenter extends MethodProbesVisitor {
/**
* Create a new instrumenter instance for the given method.
- *
+ *
* @param mv
* next method visitor in the chain
* @param probeInserter
@@ -159,7 +160,8 @@ class MethodInstrumenter extends MethodProbesVisitor {
return intermediate;
}
- private void insertIntermediateProbe(final Label label, final IFrame frame) {
+ private void insertIntermediateProbe(final Label label,
+ final IFrame frame) {
final int probeId = LabelInfo.getProbeId(label);
if (probeId != LabelInfo.NO_PROBE && !LabelInfo.isDone(label)) {
mv.visitLabel(LabelInfo.getIntermediateLabel(label));
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/instr/NoneProbeArrayStrategy.java b/org.jacoco.core/src/org/jacoco/core/internal/instr/NoneProbeArrayStrategy.java
index b3a4186f..427678bf 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/instr/NoneProbeArrayStrategy.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/instr/NoneProbeArrayStrategy.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.internal.instr;
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 bc957b91..b2223768 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
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.internal.instr;
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/instr/ProbeCounter.java b/org.jacoco.core/src/org/jacoco/core/internal/instr/ProbeCounter.java
index de223265..c41a9b35 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/instr/ProbeCounter.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/instr/ProbeCounter.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.internal.instr;
@@ -30,7 +31,8 @@ class ProbeCounter extends ClassProbesVisitor {
@Override
public MethodProbesVisitor visitMethod(final int access, final String name,
- final String desc, final String signature, final String[] exceptions) {
+ final String desc, final String signature,
+ final String[] exceptions) {
if (!InstrSupport.CLINIT_NAME.equals(name)
&& (access & Opcodes.ACC_ABSTRACT) == 0) {
methods = true;
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/instr/ProbeInserter.java b/org.jacoco.core/src/org/jacoco/core/internal/instr/ProbeInserter.java
index 0cac8f8f..20794f60 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/instr/ProbeInserter.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/instr/ProbeInserter.java
@@ -1,20 +1,23 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.internal.instr;
+import org.objectweb.asm.AnnotationVisitor;
import org.objectweb.asm.Label;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;
+import org.objectweb.asm.TypePath;
/**
* Internal utility to add probes into the control flow of a method. The code
@@ -40,7 +43,7 @@ class ProbeInserter extends MethodVisitor implements IProbeInserter {
/**
* Creates a new {@link ProbeInserter}.
- *
+ *
* @param access
* access flags of the adapted method
* @param name
@@ -53,8 +56,8 @@ class ProbeInserter extends MethodVisitor implements IProbeInserter {
* callback to create the code that retrieves the reference to
* the probe array
*/
- ProbeInserter(final int access, final String name, final String desc, final MethodVisitor mv,
- final IProbeArrayStrategy arrayStrategy) {
+ ProbeInserter(final int access, final String name, final String desc,
+ final MethodVisitor mv, final IProbeArrayStrategy arrayStrategy) {
super(InstrSupport.ASM_API_VERSION, mv);
this.clinit = InstrSupport.CLINIT_NAME.equals(name);
this.arrayStrategy = arrayStrategy;
@@ -107,6 +110,18 @@ class ProbeInserter extends MethodVisitor implements IProbeInserter {
}
@Override
+ public AnnotationVisitor visitLocalVariableAnnotation(final int typeRef,
+ final TypePath typePath, final Label[] start, final Label[] end,
+ final int[] index, final String descriptor, final boolean visible) {
+ final int[] newIndex = new int[index.length];
+ for (int i = 0; i < newIndex.length; i++) {
+ newIndex[i] = map(index[i]);
+ }
+ return mv.visitLocalVariableAnnotation(typeRef, typePath, start, end,
+ newIndex, descriptor, visible);
+ }
+
+ @Override
public void visitMaxs(final int maxStack, final int maxLocals) {
// Max stack size of the probe code is 3 which can add to the
// original stack size depending on the probe locations. The accessor
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/instr/SignatureRemover.java b/org.jacoco.core/src/org/jacoco/core/internal/instr/SignatureRemover.java
index 06994c0d..310dcc88 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/instr/SignatureRemover.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/instr/SignatureRemover.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.internal.instr;
@@ -47,7 +48,7 @@ public class SignatureRemover {
/**
* Defines whether this remover should be active. If it is not active it
* will not remove any entries.
- *
+ *
* @param active
* <code>true</code> if it should remove signature related
* entries.
@@ -58,7 +59,7 @@ public class SignatureRemover {
/**
* Checks whether a entry with the provided name should be ignored at all.
- *
+ *
* @param name
* path name of the entry in question
* @return true is the entry should be ignored
@@ -69,7 +70,7 @@ public class SignatureRemover {
/**
* Filters the content of the entry with the provided name if necessary.
- *
+ *
* @param name
* path name of the entry in question
* @param in
@@ -102,7 +103,8 @@ public class SignatureRemover {
}
private void filterManifestEntryAttributes(final Attributes attrs) {
- for (final Iterator<Object> i = attrs.keySet().iterator(); i.hasNext();) {
+ for (final Iterator<Object> i = attrs.keySet().iterator(); i
+ .hasNext();) {
if (String.valueOf(i.next()).endsWith(DIGEST_SUFFIX)) {
i.remove();
}
diff --git a/org.jacoco.core/src/org/jacoco/core/jacoco.properties b/org.jacoco.core/src/org/jacoco/core/jacoco.properties
index e2f9aca6..443b3943 100644
--- a/org.jacoco.core/src/org/jacoco/core/jacoco.properties
+++ b/org.jacoco.core/src/org/jacoco/core/jacoco.properties
@@ -1,6 +1,5 @@
#This file is supposed to be processed by Maven, but Android doesn't run Maven
#So in Android we've filled in the resulting values below
-VERSION=0.7.10.201704181138.android
+VERSION=0.8.7.android
HOMEURL=http://www.jacoco.org/jacoco
RUNTIMEPACKAGE=org.jacoco.agent.rt.internal
-
diff --git a/org.jacoco.core/src/org/jacoco/core/package-info.java b/org.jacoco.core/src/org/jacoco/core/package-info.java
index 84ebdf87..7b84d8d1 100644
--- a/org.jacoco.core/src/org/jacoco/core/package-info.java
+++ b/org.jacoco.core/src/org/jacoco/core/package-info.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
/**
diff --git a/org.jacoco.core/src/org/jacoco/core/runtime/AbstractRuntime.java b/org.jacoco.core/src/org/jacoco/core/runtime/AbstractRuntime.java
index 388e3e4f..7d417b2d 100644
--- a/org.jacoco.core/src/org/jacoco/core/runtime/AbstractRuntime.java
+++ b/org.jacoco.core/src/org/jacoco/core/runtime/AbstractRuntime.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.runtime;
@@ -32,7 +33,7 @@ public abstract class AbstractRuntime implements IRuntime {
/**
* Creates a random session identifier.
- *
+ *
* @return random session identifier
*/
public static String createRandomId() {
diff --git a/org.jacoco.core/src/org/jacoco/core/runtime/AgentOptions.java b/org.jacoco.core/src/org/jacoco/core/runtime/AgentOptions.java
index 60f03c0a..2bf1b394 100644
--- a/org.jacoco.core/src/org/jacoco/core/runtime/AgentOptions.java
+++ b/org.jacoco.core/src/org/jacoco/core/runtime/AgentOptions.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.runtime;
@@ -26,7 +27,7 @@ import java.util.regex.Pattern;
/**
* Utility to create and parse options for the runtime agent. Options are
* represented as a string in the following format:
- *
+ *
* <pre>
* key1=value1,key2=value2,key3=value3
* </pre>
@@ -53,7 +54,7 @@ public final class AgentOptions {
/**
* Wildcard expression for class names that should be included for code
* coverage. Default is <code>*</code> (all classes included).
- *
+ *
* @see WildcardMatcher
*/
public static final String INCLUDES = "includes";
@@ -61,7 +62,7 @@ public final class AgentOptions {
/**
* Wildcard expression for class names that should be excluded from code
* coverage. Default is the empty string (no exclusions).
- *
+ *
* @see WildcardMatcher
*/
public static final String EXCLUDES = "excludes";
@@ -72,7 +73,7 @@ public final class AgentOptions {
* loader which full qualified name matches this expression will be ignored
* for code coverage regardless of all other filtering settings. Default is
* <code>sun.reflect.DelegatingClassLoader</code>.
- *
+ *
* @see WildcardMatcher
*/
public static final String EXCLCLASSLOADER = "exclclassloader";
@@ -106,7 +107,7 @@ public final class AgentOptions {
/**
* Specifies the output mode. Default is {@link OutputMode#file}.
- *
+ *
* @see OutputMode#file
* @see OutputMode#tcpserver
* @see OutputMode#tcpclient
@@ -204,7 +205,7 @@ public final class AgentOptions {
/**
* New instance parsed from the given option string.
- *
+ *
* @param optionstr
* string to parse or <code>null</code>
*/
@@ -219,8 +220,8 @@ public final class AgentOptions {
}
final String key = entry.substring(0, pos);
if (!VALID_OPTIONS.contains(key)) {
- throw new IllegalArgumentException(format(
- "Unknown agent option \"%s\".", key));
+ throw new IllegalArgumentException(
+ format("Unknown agent option \"%s\".", key));
}
final String value = entry.substring(pos + 1);
@@ -233,7 +234,7 @@ public final class AgentOptions {
/**
* New instance read from the given {@link Properties} object.
- *
+ *
* @param properties
* {@link Properties} object to read configuration options from
*/
@@ -260,7 +261,7 @@ public final class AgentOptions {
/**
* Returns the output file location.
- *
+ *
* @return output file location
*/
public String getDestfile() {
@@ -269,7 +270,7 @@ public final class AgentOptions {
/**
* Sets the output file location.
- *
+ *
* @param destfile
* output file location
*/
@@ -279,7 +280,7 @@ public final class AgentOptions {
/**
* Returns whether the output should be appended to an existing file.
- *
+ *
* @return <code>true</code>, when the output should be appended
*/
public boolean getAppend() {
@@ -288,7 +289,7 @@ public final class AgentOptions {
/**
* Sets whether the output should be appended to an existing file.
- *
+ *
* @param append
* <code>true</code>, when the output should be appended
*/
@@ -298,7 +299,7 @@ public final class AgentOptions {
/**
* Returns the wildcard expression for classes to include.
- *
+ *
* @return wildcard expression for classes to include
* @see WildcardMatcher
*/
@@ -308,7 +309,7 @@ public final class AgentOptions {
/**
* Sets the wildcard expression for classes to include.
- *
+ *
* @param includes
* wildcard expression for classes to include
* @see WildcardMatcher
@@ -319,7 +320,7 @@ public final class AgentOptions {
/**
* Returns the wildcard expression for classes to exclude.
- *
+ *
* @return wildcard expression for classes to exclude
* @see WildcardMatcher
*/
@@ -329,7 +330,7 @@ public final class AgentOptions {
/**
* Sets the wildcard expression for classes to exclude.
- *
+ *
* @param excludes
* wildcard expression for classes to exclude
* @see WildcardMatcher
@@ -340,7 +341,7 @@ public final class AgentOptions {
/**
* Returns the wildcard expression for excluded class loaders.
- *
+ *
* @return expression for excluded class loaders
* @see WildcardMatcher
*/
@@ -350,7 +351,7 @@ public final class AgentOptions {
/**
* Sets the wildcard expression for excluded class loaders.
- *
+ *
* @param expression
* expression for excluded class loaders
* @see WildcardMatcher
@@ -362,7 +363,7 @@ public final class AgentOptions {
/**
* Returns whether classes from the bootstrap classloader should be
* instrumented.
- *
+ *
* @return <code>true</code> if classes from the bootstrap classloader
* should be instrumented
*/
@@ -373,7 +374,7 @@ public final class AgentOptions {
/**
* Sets whether classes from the bootstrap classloader should be
* instrumented.
- *
+ *
* @param include
* <code>true</code> if bootstrap classes should be instrumented
*/
@@ -383,7 +384,7 @@ public final class AgentOptions {
/**
* Returns whether classes without source location should be instrumented.
- *
+ *
* @return <code>true</code> if classes without source location should be
* instrumented
*/
@@ -393,7 +394,7 @@ public final class AgentOptions {
/**
* Sets whether classes without source location should be instrumented.
- *
+ *
* @param include
* <code>true</code> if classes without source location should be
* instrumented
@@ -404,7 +405,7 @@ public final class AgentOptions {
/**
* Returns the session identifier.
- *
+ *
* @return session identifier
*/
public String getSessionId() {
@@ -413,7 +414,7 @@ public final class AgentOptions {
/**
* Sets the session identifier.
- *
+ *
* @param id
* session identifier
*/
@@ -423,7 +424,7 @@ public final class AgentOptions {
/**
* Returns whether coverage data should be dumped on exit.
- *
+ *
* @return <code>true</code> if coverage data will be written on VM exit
*/
public boolean getDumpOnExit() {
@@ -432,7 +433,7 @@ public final class AgentOptions {
/**
* Sets whether coverage data should be dumped on exit.
- *
+ *
* @param dumpOnExit
* <code>true</code> if coverage data should be written on VM
* exit
@@ -445,7 +446,7 @@ public final class AgentOptions {
* Returns the port on which to listen to when the output is
* <code>tcpserver</code> or the port to connect to when output is
* <code>tcpclient</code>.
- *
+ *
* @return port to listen on or connect to
*/
public int getPort() {
@@ -455,7 +456,7 @@ public final class AgentOptions {
/**
* Sets the port on which to listen to when output is <code>tcpserver</code>
* or the port to connect to when output is <code>tcpclient</code>
- *
+ *
* @param port
* port to listen on or connect to
*/
@@ -468,7 +469,7 @@ public final class AgentOptions {
* Gets the hostname or IP address to listen to when output is
* <code>tcpserver</code> or connect to when output is
* <code>tcpclient</code>
- *
+ *
* @return Hostname or IP address
*/
public String getAddress() {
@@ -479,7 +480,7 @@ public final class AgentOptions {
* Sets the hostname or IP address to listen to when output is
* <code>tcpserver</code> or connect to when output is
* <code>tcpclient</code>
- *
+ *
* @param address
* Hostname or IP address
*/
@@ -489,7 +490,7 @@ public final class AgentOptions {
/**
* Returns the output mode
- *
+ *
* @return current output mode
*/
public OutputMode getOutput() {
@@ -502,7 +503,7 @@ public final class AgentOptions {
/**
* Sets the output mode
- *
+ *
* @param output
* Output mode
*/
@@ -512,7 +513,7 @@ public final class AgentOptions {
/**
* Sets the output mode
- *
+ *
* @param output
* Output mode
*/
@@ -523,7 +524,7 @@ public final class AgentOptions {
/**
* Returns the location of the directory where class files should be dumped
* to.
- *
+ *
* @return dump location or <code>null</code> (no dumps)
*/
public String getClassDumpDir() {
@@ -532,7 +533,7 @@ public final class AgentOptions {
/**
* Sets the directory where class files should be dumped to.
- *
+ *
* @param location
* dump location or <code>null</code> (no dumps)
*/
@@ -542,7 +543,7 @@ public final class AgentOptions {
/**
* Returns whether the agent exposes functionality via JMX.
- *
+ *
* @return <code>true</code>, when JMX is enabled
*/
public boolean getJmx() {
@@ -551,7 +552,7 @@ public final class AgentOptions {
/**
* Sets whether the agent should expose functionality via JMX.
- *
+ *
* @param jmx
* <code>true</code> if JMX should be enabled
*/
@@ -589,7 +590,7 @@ public final class AgentOptions {
/**
* Generate required JVM argument based on current configuration and
* supplied agent jar location.
- *
+ *
* @param agentJarFile
* location of the JaCoCo Agent Jar
* @return Argument to pass to create new VM with coverage enabled
@@ -601,7 +602,7 @@ public final class AgentOptions {
/**
* Generate required quoted JVM argument based on current configuration and
* supplied agent jar location.
- *
+ *
* @param agentJarFile
* location of the JaCoCo Agent Jar
* @return Quoted argument to pass to create new VM with coverage enabled
@@ -615,7 +616,7 @@ public final class AgentOptions {
* prepends it to the given argument command line. If a agent with the same
* JAR file is already specified this parameter is removed from the existing
* command line.
- *
+ *
* @param arguments
* existing command line arguments or <code>null</code>
* @param agentJarFile
diff --git a/org.jacoco.core/src/org/jacoco/core/runtime/CommandLineSupport.java b/org.jacoco.core/src/org/jacoco/core/runtime/CommandLineSupport.java
index 1f7fafc2..534fb243 100644
--- a/org.jacoco.core/src/org/jacoco/core/runtime/CommandLineSupport.java
+++ b/org.jacoco.core/src/org/jacoco/core/runtime/CommandLineSupport.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.runtime;
@@ -25,7 +26,7 @@ final class CommandLineSupport {
/**
* Quotes a single command line argument if necessary.
- *
+ *
* @param arg
* command line argument
* @return quoted argument
@@ -47,7 +48,7 @@ final class CommandLineSupport {
/**
* Builds a single command line string from the given argument list.
* Arguments are quoted when necessary.
- *
+ *
* @param args
* command line arguments
* @return combined command line
@@ -68,7 +69,7 @@ final class CommandLineSupport {
/**
* Splits a command line into single arguments and removes quotes if
* present.
- *
+ *
* @param commandline
* combined command line
* @return list of arguments
diff --git a/org.jacoco.core/src/org/jacoco/core/runtime/IExecutionDataAccessorGenerator.java b/org.jacoco.core/src/org/jacoco/core/runtime/IExecutionDataAccessorGenerator.java
index 83df5744..b3dfe225 100644
--- a/org.jacoco.core/src/org/jacoco/core/runtime/IExecutionDataAccessorGenerator.java
+++ b/org.jacoco.core/src/org/jacoco/core/runtime/IExecutionDataAccessorGenerator.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.runtime;
@@ -28,12 +29,12 @@ public interface IExecutionDataAccessorGenerator {
* process will embed this code into a method that is called on class
* initialization. This method can be called at any time even outside the
* target VM.
- *
+ *
* The generated code must push a <code>boolean[]</code> instance to the
* operand stack. Except this result object the generated code must not make
* any assumptions about the structure of the embedding method or class. The
* generated code must not use or allocate local variables.
- *
+ *
* @param classid
* identifier of the class
* @param classname
diff --git a/org.jacoco.core/src/org/jacoco/core/runtime/IRemoteCommandVisitor.java b/org.jacoco.core/src/org/jacoco/core/runtime/IRemoteCommandVisitor.java
index 9057a4e4..ce2389ca 100644
--- a/org.jacoco.core/src/org/jacoco/core/runtime/IRemoteCommandVisitor.java
+++ b/org.jacoco.core/src/org/jacoco/core/runtime/IRemoteCommandVisitor.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.runtime;
@@ -20,7 +21,7 @@ public interface IRemoteCommandVisitor {
/**
* Requests a execution data dump with an optional reset.
- *
+ *
* @param dump
* <code>true</code> if the dump should be executed
* @param reset
diff --git a/org.jacoco.core/src/org/jacoco/core/runtime/IRuntime.java b/org.jacoco.core/src/org/jacoco/core/runtime/IRuntime.java
index ea055632..2ae60f41 100644
--- a/org.jacoco.core/src/org/jacoco/core/runtime/IRuntime.java
+++ b/org.jacoco.core/src/org/jacoco/core/runtime/IRuntime.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.runtime;
@@ -20,7 +21,7 @@ public interface IRuntime extends IExecutionDataAccessorGenerator {
/**
* Starts the coverage runtime. This method MUST be called before any class
* instrumented for this runtime is loaded.
- *
+ *
* @param data
* the execution data for this runtime
* @throws Exception
diff --git a/org.jacoco.core/src/org/jacoco/core/runtime/InjectedClassRuntime.java b/org.jacoco.core/src/org/jacoco/core/runtime/InjectedClassRuntime.java
index ee7aa1ac..c362fb92 100644
--- a/org.jacoco.core/src/org/jacoco/core/runtime/InjectedClassRuntime.java
+++ b/org.jacoco.core/src/org/jacoco/core/runtime/InjectedClassRuntime.java
@@ -1,9 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
diff --git a/org.jacoco.core/src/org/jacoco/core/runtime/LoggerRuntime.java b/org.jacoco.core/src/org/jacoco/core/runtime/LoggerRuntime.java
index bef42030..1fc2b70f 100644
--- a/org.jacoco.core/src/org/jacoco/core/runtime/LoggerRuntime.java
+++ b/org.jacoco.core/src/org/jacoco/core/runtime/LoggerRuntime.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.runtime;
@@ -24,7 +25,7 @@ import org.objectweb.asm.Opcodes;
* This {@link IRuntime} implementation uses the Java logging API to report
* coverage data.
* <p>
- *
+ *
* The implementation uses a dedicated log channel. Instrumented classes call
* {@link Logger#log(Level, String, Object[])} with the class identifier in the
* first slot of the parameter array. The runtime implements a {@link Handler}
@@ -133,9 +134,7 @@ public class LoggerRuntime extends AbstractRuntime {
// Stack[1]: Ljava/util/logging/Logger;
// Stack[0]: [Ljava/lang/Object;
- mv.visitMethodInsn(
- Opcodes.INVOKEVIRTUAL,
- "java/util/logging/Logger",
+ mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "java/util/logging/Logger",
"log",
"(Ljava/util/logging/Level;Ljava/lang/String;[Ljava/lang/Object;)V",
false);
diff --git a/org.jacoco.core/src/org/jacoco/core/runtime/ModifiedSystemClassRuntime.java b/org.jacoco.core/src/org/jacoco/core/runtime/ModifiedSystemClassRuntime.java
index 5f2cc497..a7936715 100644
--- a/org.jacoco.core/src/org/jacoco/core/runtime/ModifiedSystemClassRuntime.java
+++ b/org.jacoco.core/src/org/jacoco/core/runtime/ModifiedSystemClassRuntime.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.runtime;
@@ -44,12 +45,12 @@ public class ModifiedSystemClassRuntime extends AbstractRuntime {
/**
* Creates a new runtime based on the given class and members.
- *
+ *
* @param systemClass
* system class that contains the execution data
* @param accessFieldName
* name of the public static runtime access field
- *
+ *
*/
public ModifiedSystemClassRuntime(final Class<?> systemClass,
final String accessFieldName) {
@@ -85,13 +86,13 @@ public class ModifiedSystemClassRuntime extends AbstractRuntime {
* Creates a new {@link ModifiedSystemClassRuntime} using the given class as
* the data container. Member is created with internal default name. The
* given class must not have been loaded before by the agent.
- *
+ *
* @param inst
* instrumentation interface
* @param className
* VM name of the class to use
* @return new runtime instance
- *
+ *
* @throws ClassNotFoundException
* id the given class can not be found
*/
@@ -104,7 +105,7 @@ public class ModifiedSystemClassRuntime extends AbstractRuntime {
* Creates a new {@link ModifiedSystemClassRuntime} using the given class as
* the data container. The given class must not have been loaded before by
* the agent.
- *
+ *
* @param inst
* instrumentation interface
* @param className
@@ -112,7 +113,7 @@ public class ModifiedSystemClassRuntime extends AbstractRuntime {
* @param accessFieldName
* name of the added runtime access field
* @return new runtime instance
- *
+ *
* @throws ClassNotFoundException
* if the given class can not be found
*/
@@ -120,10 +121,10 @@ public class ModifiedSystemClassRuntime extends AbstractRuntime {
final String className, final String accessFieldName)
throws ClassNotFoundException {
final ClassFileTransformer transformer = new ClassFileTransformer() {
- public byte[] transform(final ClassLoader loader,
- final String name, final Class<?> classBeingRedefined,
- final ProtectionDomain protectionDomain, final byte[] source)
- throws IllegalClassFormatException {
+ public byte[] transform(final ClassLoader loader, final String name,
+ final Class<?> classBeingRedefined,
+ final ProtectionDomain protectionDomain,
+ final byte[] source) throws IllegalClassFormatException {
if (name.equals(className)) {
return instrument(source, accessFieldName);
}
@@ -136,15 +137,16 @@ public class ModifiedSystemClassRuntime extends AbstractRuntime {
try {
clazz.getField(accessFieldName);
} catch (final NoSuchFieldException e) {
- throw new RuntimeException(format(
- "Class %s could not be instrumented.", className), e);
+ throw new RuntimeException(
+ format("Class %s could not be instrumented.", className),
+ e);
}
return new ModifiedSystemClassRuntime(clazz, accessFieldName);
}
/**
* Adds the static data field to the given class definition.
- *
+ *
* @param source
* class definition source
* @param accessFieldName
@@ -169,9 +171,10 @@ public class ModifiedSystemClassRuntime extends AbstractRuntime {
private static void createDataField(final ClassVisitor visitor,
final String dataField) {
- visitor.visitField(Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC
- | Opcodes.ACC_SYNTHETIC | Opcodes.ACC_TRANSIENT, dataField,
- ACCESS_FIELD_TYPE, null, null);
+ visitor.visitField(
+ Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC | Opcodes.ACC_SYNTHETIC
+ | Opcodes.ACC_TRANSIENT,
+ dataField, ACCESS_FIELD_TYPE, null, null);
}
}
diff --git a/org.jacoco.core/src/org/jacoco/core/runtime/OfflineInstrumentationAccessGenerator.java b/org.jacoco.core/src/org/jacoco/core/runtime/OfflineInstrumentationAccessGenerator.java
index a5e88b60..78ef3064 100644
--- a/org.jacoco.core/src/org/jacoco/core/runtime/OfflineInstrumentationAccessGenerator.java
+++ b/org.jacoco.core/src/org/jacoco/core/runtime/OfflineInstrumentationAccessGenerator.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.runtime;
@@ -22,8 +23,8 @@ import org.objectweb.asm.Opcodes;
* obtain probe arrays. This generator is designed for offline instrumentation
* only.
*/
-public class OfflineInstrumentationAccessGenerator implements
- IExecutionDataAccessorGenerator {
+public class OfflineInstrumentationAccessGenerator
+ implements IExecutionDataAccessorGenerator {
private final String runtimeClassName;
@@ -37,7 +38,7 @@ public class OfflineInstrumentationAccessGenerator implements
/**
* Creates a new instance with the given runtime class name for testing
* purposes
- *
+ *
* @param runtimeClassName
* VM name of the runtime class
*/
diff --git a/org.jacoco.core/src/org/jacoco/core/runtime/RemoteControlReader.java b/org.jacoco.core/src/org/jacoco/core/runtime/RemoteControlReader.java
index 46fb6d2c..0f4b1cb3 100644
--- a/org.jacoco.core/src/org/jacoco/core/runtime/RemoteControlReader.java
+++ b/org.jacoco.core/src/org/jacoco/core/runtime/RemoteControlReader.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.runtime;
@@ -25,7 +26,7 @@ public class RemoteControlReader extends ExecutionDataReader {
/**
* Create a new read based on the given input stream.
- *
+ *
* @param input
* input stream to read commands from
* @throws IOException
@@ -50,7 +51,7 @@ public class RemoteControlReader extends ExecutionDataReader {
/**
* Sets an listener for agent commands.
- *
+ *
* @param visitor
* visitor to retrieve agent commands
*/
diff --git a/org.jacoco.core/src/org/jacoco/core/runtime/RemoteControlWriter.java b/org.jacoco.core/src/org/jacoco/core/runtime/RemoteControlWriter.java
index 8534471f..6e8b5cde 100644
--- a/org.jacoco.core/src/org/jacoco/core/runtime/RemoteControlWriter.java
+++ b/org.jacoco.core/src/org/jacoco/core/runtime/RemoteControlWriter.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.runtime;
@@ -19,8 +20,8 @@ import org.jacoco.core.data.ExecutionDataWriter;
/**
* {@link ExecutionDataWriter} with commands added for runtime remote control.
*/
-public class RemoteControlWriter extends ExecutionDataWriter implements
- IRemoteCommandVisitor {
+public class RemoteControlWriter extends ExecutionDataWriter
+ implements IRemoteCommandVisitor {
/** Block identifier to confirm successful command execution. */
public static final byte BLOCK_CMDOK = 0x20;
@@ -30,7 +31,7 @@ public class RemoteControlWriter extends ExecutionDataWriter implements
/**
* Creates a new writer based on the given output stream.
- *
+ *
* @param output
* stream to write commands to
* @throws IOException
@@ -43,7 +44,7 @@ public class RemoteControlWriter extends ExecutionDataWriter implements
/**
* Sends a confirmation that a commands has been successfully executed and
* the response is completed.
- *
+ *
* @throws IOException
* in case of problems with the remote connection
*/
diff --git a/org.jacoco.core/src/org/jacoco/core/runtime/RuntimeData.java b/org.jacoco.core/src/org/jacoco/core/runtime/RuntimeData.java
index c0fbb654..00fb4b07 100644
--- a/org.jacoco.core/src/org/jacoco/core/runtime/RuntimeData.java
+++ b/org.jacoco.core/src/org/jacoco/core/runtime/RuntimeData.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.runtime;
@@ -61,7 +62,7 @@ public class RuntimeData {
* execution data is collected. If no identifier is explicitly set a
* identifier is generated from the host name and a random number. This
* method can be called at any time.
- *
+ *
* @see #collect(IExecutionDataVisitor, ISessionInfoVisitor, boolean)
* @param id
* new session identifier
@@ -72,7 +73,7 @@ public class RuntimeData {
/**
* Get the current a session identifier for this runtime.
- *
+ *
* @see #setSessionId(String)
* @return current session identifier
*/
@@ -83,7 +84,7 @@ public class RuntimeData {
/**
* Collects the current execution data and writes it to the given
* {@link IExecutionDataVisitor} object.
- *
+ *
* @param executionDataVisitor
* handler to write coverage data to
* @param sessionInfoVisitor
@@ -119,7 +120,7 @@ public class RuntimeData {
* Returns the coverage data for the class with the given identifier. If
* there is no data available under the given id a new entry is created.
* This is a synchronized access to the underlying store.
- *
+ *
* @param id
* class identifier
* @param name
@@ -142,19 +143,19 @@ public class RuntimeData {
* Retrieves the execution data for a given class. The passed
* {@link Object} array instance is used for parameters and the return value
* as follows. Call parameters:
- *
+ *
* <ul>
* <li>args[0]: class id ({@link Long})
* <li>args[1]: vm class name ({@link String})
* <li>args[2]: probe count ({@link Integer})
* </ul>
- *
+ *
* Return value:
- *
+ *
* <ul>
* <li>args[0]: execution data ({@link IExecutionData})
* </ul>
- *
+ *
* @param args
* parameter array of length 3
*/
@@ -169,7 +170,7 @@ public class RuntimeData {
/**
* In violation of the regular semantic of {@link Object#equals(Object)}
* this implementation is used as the interface to the execution data store.
- *
+ *
* @param args
* the arguments as an {@link Object} array
* @return has no meaning
@@ -188,7 +189,7 @@ public class RuntimeData {
* Generates code that creates the argument array for the
* {@link #getProbes(Object[])} method. The array instance is left on the
* operand stack. The generated code requires a stack size of 5.
- *
+ *
* @param classid
* class identifier
* @param classname
@@ -199,7 +200,8 @@ public class RuntimeData {
* visitor to emit generated code
*/
public static void generateArgumentArray(final long classid,
- final String classname, final int probecount, final MethodVisitor mv) {
+ final String classname, final int probecount,
+ final MethodVisitor mv) {
mv.visitInsn(Opcodes.ICONST_3);
mv.visitTypeInsn(Opcodes.ANEWARRAY, "java/lang/Object");
@@ -221,8 +223,8 @@ public class RuntimeData {
mv.visitInsn(Opcodes.DUP);
mv.visitInsn(Opcodes.ICONST_2);
InstrSupport.push(mv, probecount);
- mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Integer",
- "valueOf", "(I)Ljava/lang/Integer;", false);
+ mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Integer", "valueOf",
+ "(I)Ljava/lang/Integer;", false);
mv.visitInsn(Opcodes.AASTORE);
}
@@ -232,7 +234,7 @@ public class RuntimeData {
* {@link Object} instance from the stack and pushes the probe array of type
* <code>boolean[]</code> on the operand stack. The generated code requires
* a stack size of 6.
- *
+ *
* @param classid
* class identifier
* @param classname
@@ -243,7 +245,8 @@ public class RuntimeData {
* visitor to emit generated code
*/
public static void generateAccessCall(final long classid,
- final String classname, final int probecount, final MethodVisitor mv) {
+ final String classname, final int probecount,
+ final MethodVisitor mv) {
// stack[0]: Ljava/lang/Object;
generateArgumentArray(classid, classname, probecount, mv);
diff --git a/org.jacoco.core/src/org/jacoco/core/runtime/SystemPropertiesRuntime.java b/org.jacoco.core/src/org/jacoco/core/runtime/SystemPropertiesRuntime.java
index d7c338c8..97ec2af9 100644
--- a/org.jacoco.core/src/org/jacoco/core/runtime/SystemPropertiesRuntime.java
+++ b/org.jacoco.core/src/org/jacoco/core/runtime/SystemPropertiesRuntime.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.runtime;
@@ -19,7 +20,7 @@ import org.objectweb.asm.Opcodes;
* through a special entry in the {@link System#getProperties()} hash table. The
* advantage is, that the instrumented classes do not get dependencies to other
* classes than the JRE library itself.
- *
+ *
* This runtime may cause problems in environments with security restrictions,
* in applications that replace the system properties or in applications that
* fail if non-String values are placed in the system properties.
@@ -50,8 +51,8 @@ public class SystemPropertiesRuntime extends AbstractRuntime {
// Stack[1]: Ljava/lang/String;
// Stack[0]: Ljava/util/Properties;
- mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "java/util/Properties",
- "get", "(Ljava/lang/Object;)Ljava/lang/Object;", false);
+ mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "java/util/Properties", "get",
+ "(Ljava/lang/Object;)Ljava/lang/Object;", false);
// Stack[0]: Ljava/lang/Object;
diff --git a/org.jacoco.core/src/org/jacoco/core/runtime/URLStreamHandlerRuntime.java b/org.jacoco.core/src/org/jacoco/core/runtime/URLStreamHandlerRuntime.java
deleted file mode 100644
index 55f9c874..00000000
--- a/org.jacoco.core/src/org/jacoco/core/runtime/URLStreamHandlerRuntime.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Marc R. Hoffmann - initial API and implementation
- *
- *******************************************************************************/
-package org.jacoco.core.runtime;
-
-import java.io.IOException;
-import java.lang.reflect.Field;
-import java.net.URL;
-import java.net.URLConnection;
-import java.net.URLStreamHandler;
-import java.util.Map;
-
-import org.jacoco.core.internal.instr.InstrSupport;
-import org.objectweb.asm.MethodVisitor;
-import org.objectweb.asm.Opcodes;
-
-/**
- * This {@link IRuntime} implementation registers a special
- * {@link URLStreamHandler} to process coverage data. The handler is not
- * actually used for opening a URL, but to get access to the runtime object.
- */
-public class URLStreamHandlerRuntime extends AbstractRuntime {
-
- private static final String PROTOCOLPREFIX = "jacoco-";
-
- private final String protocol;
-
- private Map<String, URLStreamHandler> handlers;
-
- /**
- * Creates a new runtime.
- */
- public URLStreamHandlerRuntime() {
- super();
- protocol = PROTOCOLPREFIX + Integer.toHexString(hashCode());
- }
-
- @Override
- public void startup(final RuntimeData data) throws Exception {
- super.startup(data);
- handlers = getHandlersReference();
- handlers.put(protocol, handler);
- }
-
- private Map<String, URLStreamHandler> getHandlersReference()
- throws Exception {
- final Field field = URL.class.getDeclaredField("handlers");
- field.setAccessible(true);
- @SuppressWarnings("unchecked")
- final Map<String, URLStreamHandler> map = (Map<String, URLStreamHandler>) field
- .get(null);
- return map;
- }
-
- public void shutdown() {
- handlers.remove(protocol);
- }
-
- public int generateDataAccessor(final long classid, final String classname,
- final int probecount, final MethodVisitor mv) {
-
- // The data accessor performs the following steps:
- //
- // final URL url = new URL(protocol, null, "");
- // final URLConnection connection = url.openConnection();
- // final Object[] args = new Object[3];
- // args[0] = Long.valueOf(classid);
- // args[1] = classname;
- // args[2] = Integer.valueOf(probecount);
- // connection.equals(args);
- // final byte[] probedata = (byte[]) args[0];
-
- RuntimeData.generateArgumentArray(classid, classname, probecount, mv);
- mv.visitInsn(Opcodes.DUP);
-
- // Stack[1]: [Ljava/lang/Object;
- // Stack[0]: [Ljava/lang/Object;
-
- mv.visitTypeInsn(Opcodes.NEW, "java/net/URL");
- mv.visitInsn(Opcodes.DUP);
- mv.visitLdcInsn(protocol);
- mv.visitInsn(Opcodes.ACONST_NULL);
- mv.visitLdcInsn("");
- mv.visitMethodInsn(Opcodes.INVOKESPECIAL, "java/net/URL", "<init>",
- "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V",
- false);
-
- // Stack[2]: [Ljava/net/URL;
- // Stack[1]: [Ljava/lang/Object;
- // Stack[0]: [Ljava/lang/Object;
-
- mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "java/net/URL",
- "openConnection", "()Ljava/net/URLConnection;", false);
-
- // Stack[2]: [Ljava/net/URLConnection;
- // Stack[1]: [Ljava/lang/Object;
- // Stack[0]: [Ljava/lang/Object;
-
- mv.visitInsn(Opcodes.SWAP);
-
- // Stack[2]: [Ljava/lang/Object;
- // Stack[1]: [Ljava/net/URLConnection;
- // Stack[0]: [Ljava/lang/Object;
-
- mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "java/lang/Object", "equals",
- "(Ljava/lang/Object;)Z", false);
-
- // Stack[1]: Z;
- // Stack[0]: [Ljava/lang/Object;
-
- mv.visitInsn(Opcodes.POP);
-
- // Stack[0]: [Ljava/lang/Object;
-
- mv.visitInsn(Opcodes.ICONST_0);
- mv.visitInsn(Opcodes.AALOAD);
- mv.visitTypeInsn(Opcodes.CHECKCAST, InstrSupport.DATAFIELD_DESC);
-
- return 7;
- }
-
- private final URLStreamHandler handler = new URLStreamHandler() {
- @Override
- protected URLConnection openConnection(final URL u) throws IOException {
- return connection;
- }
- };
-
- private final URLConnection connection = new URLConnection(null) {
- @Override
- public void connect() throws IOException {
- throw new AssertionError();
- }
-
- @Override
- public boolean equals(final Object obj) {
- return data.equals(obj);
- }
- };
-
-}
diff --git a/org.jacoco.core/src/org/jacoco/core/runtime/WildcardMatcher.java b/org.jacoco.core/src/org/jacoco/core/runtime/WildcardMatcher.java
index 91feaa66..b12255db 100644
--- a/org.jacoco.core/src/org/jacoco/core/runtime/WildcardMatcher.java
+++ b/org.jacoco.core/src/org/jacoco/core/runtime/WildcardMatcher.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.runtime;
@@ -25,7 +26,7 @@ public class WildcardMatcher {
/**
* Creates a new matcher with the given expression.
- *
+ *
* @param expression
* wildcard expressions
*/
@@ -63,7 +64,7 @@ public class WildcardMatcher {
/**
* Matches the given string against the expressions of this matcher.
- *
+ *
* @param s
* string to test
* @return <code>true</code>, if the expression matches
diff --git a/org.jacoco.core/src/org/jacoco/core/runtime/package-info.java b/org.jacoco.core/src/org/jacoco/core/runtime/package-info.java
index 1ac7cccb..85f792a1 100644
--- a/org.jacoco.core/src/org/jacoco/core/runtime/package-info.java
+++ b/org.jacoco.core/src/org/jacoco/core/runtime/package-info.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
/**
diff --git a/org.jacoco.core/src/org/jacoco/core/tools/ExecDumpClient.java b/org.jacoco.core/src/org/jacoco/core/tools/ExecDumpClient.java
index 35617b49..420c7680 100644
--- a/org.jacoco.core/src/org/jacoco/core/tools/ExecDumpClient.java
+++ b/org.jacoco.core/src/org/jacoco/core/tools/ExecDumpClient.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.tools;
@@ -43,7 +44,7 @@ public class ExecDumpClient {
/**
* Specifies whether a dump should be requested
- *
+ *
* @param dump
* <code>true</code> if a dump should be requested
*/
@@ -53,7 +54,7 @@ public class ExecDumpClient {
/**
* Specifies whether execution data should be reset.
- *
+ *
* @param reset
* <code>true</code> if execution data should be reset
*/
@@ -64,7 +65,7 @@ public class ExecDumpClient {
/**
* Sets the number of retry attempts to connect to the target socket. This
* allows to wait for a certain time until the target agent has initialized.
- *
+ *
* @param retryCount
* number of retries
*/
@@ -74,7 +75,7 @@ public class ExecDumpClient {
/**
* Sets the delay time before between connection attempts.
- *
+ *
* @param retryDelay
* delay in milliseconds
*/
@@ -84,7 +85,7 @@ public class ExecDumpClient {
/**
* Requests a dump from the given end-point.
- *
+ *
* @param address
* IP-Address to connect to
* @param port
@@ -100,7 +101,7 @@ public class ExecDumpClient {
/**
* Requests a dump from the given end-point.
- *
+ *
* @param address
* host name or IP-Address to connect to
* @param port
@@ -162,7 +163,7 @@ public class ExecDumpClient {
/**
* This method can be overwritten to get an event just before a connection
* is made.
- *
+ *
* @param address
* target address
* @param port
@@ -176,7 +177,7 @@ public class ExecDumpClient {
/**
* This method can be overwritten to get an event for connection failures
* when another retry will be attempted.
- *
+ *
* @param exception
* connection error
*/
diff --git a/org.jacoco.core/src/org/jacoco/core/tools/ExecFileLoader.java b/org.jacoco.core/src/org/jacoco/core/tools/ExecFileLoader.java
index cf7b2e56..d0b4815e 100644
--- a/org.jacoco.core/src/org/jacoco/core/tools/ExecFileLoader.java
+++ b/org.jacoco.core/src/org/jacoco/core/tools/ExecFileLoader.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
package org.jacoco.core.tools;
@@ -45,7 +46,7 @@ public class ExecFileLoader {
/**
* Reads all data from given input stream.
- *
+ *
* @param stream
* Stream to read data from
* @throws IOException
@@ -61,7 +62,7 @@ public class ExecFileLoader {
/**
* Reads all data from given input stream.
- *
+ *
* @param file
* file to read data from
* @throws IOException
@@ -78,7 +79,7 @@ public class ExecFileLoader {
/**
* Saves the current content into the given output stream.
- *
+ *
* @param stream
* stream to save content to
* @throws IOException
@@ -94,7 +95,7 @@ public class ExecFileLoader {
* Saves the current content into the given file. Parent directories are
* created as needed. Also a files system lock is acquired to avoid
* concurrent write access.
- *
+ *
* @param file
* file to save content to
* @param append
@@ -111,7 +112,8 @@ public class ExecFileLoader {
final FileOutputStream fileStream = new FileOutputStream(file, append);
// Avoid concurrent writes from other processes:
fileStream.getChannel().lock();
- final OutputStream bufferedStream = new BufferedOutputStream(fileStream);
+ final OutputStream bufferedStream = new BufferedOutputStream(
+ fileStream);
try {
save(bufferedStream);
} finally {
@@ -121,7 +123,7 @@ public class ExecFileLoader {
/**
* Returns the session info store with all loaded sessions.
- *
+ *
* @return session info store
*/
public SessionInfoStore getSessionInfoStore() {
@@ -130,7 +132,7 @@ public class ExecFileLoader {
/**
* Returns the execution data store with data for all loaded classes.
- *
+ *
* @return execution data store
*/
public ExecutionDataStore getExecutionDataStore() {
diff --git a/org.jacoco.core/src/org/jacoco/core/tools/package-info.java b/org.jacoco.core/src/org/jacoco/core/tools/package-info.java
index c35c5f9a..dfe00a9c 100644
--- a/org.jacoco.core/src/org/jacoco/core/tools/package-info.java
+++ b/org.jacoco.core/src/org/jacoco/core/tools/package-info.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
+ * This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
- *
+ *
*******************************************************************************/
/**