Skip to content

Commit

Permalink
Trying a fix for #557
Browse files Browse the repository at this point in the history
  • Loading branch information
jlink committed Mar 12, 2024
1 parent a4c462d commit e4409d4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ fun Class<*>.isKotlinClass(): Boolean = declaredAnnotations.any { it.annotationC

val Parameter.kotlinParameter: KParameter?
get() {
if (!this.declaringExecutable.declaringClass.isKotlinClass()) {
return null
}
if (isSuspendFunctionContinuationParameter()) {
return null
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ class SuspendedPropertyMethodsHook : ResolveParameterHook, InvokePropertyMethodH
}

private fun AnnotatedElement.isSuspendFunction() =
this is Method && this.kotlinFunction?.isSuspend ?: false
this is Method
// Added because of https://github.com/jqwik-team/jqwik/issues/557
&& this.declaringClass.isKotlinClass()
&& this.kotlinFunction?.isSuspend ?: false

override fun resolve(
parameterContext: ParameterResolutionContext,
Expand Down
10 changes: 10 additions & 0 deletions kotlin/src/test/java/net/jqwik/kotlin/java/JavaProperty.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package net.jqwik.kotlin.java;

import net.jqwik.api.*;

class JavaProperty {

@Property
void aProperty(@ForAll int anInt) {
}
}

0 comments on commit e4409d4

Please sign in to comment.