``` public static KFunction<?> getPrimaryCon...
# reflect
s
Copy code
public static KFunction<?> getPrimaryConstructorAsKFunction(Class<?> clazz) {
			KClass<?> kClass = JvmClassMappingKt.getKotlinClass(clazz);
			for (KFunction<?> constructor : kClass.getConstructors()) {
				ConstructorDescriptor descriptor = (ConstructorDescriptor)((KFunctionImpl)constructor).getDescriptor();
				if (descriptor.isPrimary()) {
					return constructor;
				}
			}
			throw new IllegalStateException("No primary constructor found");
		}