aboutsummaryrefslogtreecommitdiff
path: root/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinCoroutineFilter.java
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/src/org/jacoco/core/internal/analysis/filter/KotlinCoroutineFilter.java
parentf93bf2cbce7253f670bc10aa10f95b7e831f9a53 (diff)
downloadjacoco-fd90e3ee3404d4996f42fa95eef32c45464592bb.tar.gz
synthetic methods that represent Kotlin suspend functions should not be ignored (#804)
Diffstat (limited to 'org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinCoroutineFilter.java')
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/KotlinCoroutineFilter.java8
1 files changed, 8 insertions, 0 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) {