aboutsummaryrefslogtreecommitdiff
path: root/org.jacoco.core
diff options
context:
space:
mode:
authorEvgeny Mandrikov <Godin@users.noreply.github.com>2018-12-28 00:11:45 +0100
committerMarc R. Hoffmann <hoffmann@mountainminds.com>2018-12-28 00:11:45 +0100
commitfd90e3ee3404d4996f42fa95eef32c45464592bb (patch)
tree0225ebe4e6f40c8d4587eeb3a1769bd9ec351f34 /org.jacoco.core
parentf93bf2cbce7253f670bc10aa10f95b7e831f9a53 (diff)
downloadjacoco-fd90e3ee3404d4996f42fa95eef32c45464592bb.tar.gz
synthetic methods that represent Kotlin suspend functions should not be ignored (#804)
Diffstat (limited to 'org.jacoco.core')
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinCoroutineFilter.java8
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/SyntheticFilter.java13
2 files changed, 17 insertions, 4 deletions
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 f1261b22..d9944bf5 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
@@ -15,6 +15,7 @@ import java.util.ArrayList;
import java.util.List;
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;
@@ -26,6 +27,13 @@ import org.objectweb.asm.tree.TableSwitchInsnNode;
*/
public final class KotlinCoroutineFilter implements IFilter {
+ static boolean isLastArgumentContinuation(final MethodNode methodNode) {
+ final Type methodType = Type.getMethodType(methodNode.desc);
+ final int lastArgument = methodType.getArgumentTypes().length - 1;
+ return lastArgument >= 0 && "kotlin.coroutines.Continuation".equals(
+ methodType.getArgumentTypes()[lastArgument].getClassName());
+ }
+
public void filter(final MethodNode methodNode,
final IFilterContext context, final IFilterOutput output) {
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 5dfeecf5..34a66b18 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
@@ -29,10 +29,15 @@ public final class SyntheticFilter implements IFilter {
return;
}
- if (KotlinDefaultArgumentsFilter
- .isDefaultArgumentsMethodName(methodNode.name)
- && KotlinGeneratedFilter.isKotlinClass(context)) {
- return;
+ if (KotlinGeneratedFilter.isKotlinClass(context)) {
+ if (KotlinDefaultArgumentsFilter
+ .isDefaultArgumentsMethodName(methodNode.name)) {
+ return;
+ }
+
+ if (KotlinCoroutineFilter.isLastArgumentContinuation(methodNode)) {
+ return;
+ }
}
output.ignore(methodNode.instructions.getFirst(),