org.mockito.internal.creation.SuspendMethod Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of securemock Show documentation
Show all versions of securemock Show documentation
Libraries for Elasticsearch
The newest version!
/*
* Copyright (c) 2017 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
package org.mockito.internal.creation;
import java.util.Arrays;
/**
* Utilities for Kotlin Continuation-Passing-Style suspending function, detecting and trimming last hidden parameter.
* See Design docs for details.
*/
public class SuspendMethod {
private static final String KOTLIN_CONTINUATION = "kotlin.coroutines.experimental.Continuation";
public static Class>[] trimSuspendParameterTypes(Class>[] parameterTypes) {
int n = parameterTypes.length;
if (n > 0 && parameterTypes[n - 1].getName().equals(KOTLIN_CONTINUATION))
return Arrays.copyOf(parameterTypes, n - 1);
return parameterTypes;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy