Open
Description
Description
If Java code has a private boolean field x
with public getter declared as isX
(and, optionally, setter setX
) Kotlin will treat it as property isX
and will allow only direct property access. (See docs for more info).
Currently we still think of this as of private property and use refleciton even though it is unnecessary.
To Reproduce
Create a Java class
public class KotlinExample {
private boolean x;
public boolean isX() {
return x;
}
public void setX(boolean value) {
x = value;
}
}
Then create a Kotlin class
class TestExample {
fun f(a: KotlinExample): KotlinExample {
a.isX = true;
return a;
}
}
and launch action on it.
Expected behavior
In tests field x
is set using direct access to property isX
.
Actual behavior
Generated tests will use reflection to set field in instances of KotlinExample
Additional context
Strongly related to #496
Metadata
Metadata
Assignees
Type
Projects
Status
Todo