Usage of Kotlin together with other languages, most notably Java. e.g. Calling Kotlin functions from Java, or using Java classes from Kotlin.
Questions tagged [kotlin-interop]
117 questions
0
votes
2 answers
How to access Kotlin object from JavaScript
I'm using kotlin2js to generate JS library from Kotlin code. I'm then using this library in Javascript (not Kotlin). The code has some Kotlin objects and some normal classes. I can access normal classes from Javascript, but I can't access the…

David Vávra
- 18,446
- 7
- 48
- 56
0
votes
1 answer
Passing null as part of vararg parameter to Java method from Kotlin
I have something similar to this method declaration in Java. Let's say the class is named JavaClass:
public T execute(String s, Function f, Object... args) {}
If I want to call this from Kotlin (my version is 1.2.21), I could write something…

Joshua
- 2,932
- 2
- 24
- 40
0
votes
2 answers
How to properly test web socket connection with KotlinJS
I'm unable to test my code that uses a native WebSocket. This is the body of the test function:
val webSocket = WebSocket("ws://localhost:8888")
window.setTimeout({
assertEquals(WebSocket.OPEN, webSocket.readyState)
}, 1000)
I'm using Karma…

Czyzby
- 2,999
- 1
- 22
- 40
0
votes
1 answer
Kotlin and Spring Data JPA produces PropertyReferenceException
I am currently using Kotlin 1.2 and Spring Boot 2.0 M7 with Spring Data JPA. In this project I am using a custom base repository instead of JPARepository or PagingAndSortingRepository (really doesn't matter)
Here is the base…

Robby F
- 397
- 1
- 2
- 13
0
votes
0 answers
Java -> Kotlin conversion with raw types
I'm writing CRaSH plugin, which in Java looks like
public class AuthPlugin extends CRaSHPlugin implements AuthenticationPlugin {
@Override
public String getName() {
return "auth";
}
@Override
public Class…

M4ks
- 11,744
- 7
- 27
- 48
0
votes
4 answers
How do i make a loop like mentioned below in kotlin programming language?
How can I make it in kotlin using for loop?
for (double i = 0; i < 10.0; i += 0.25) {
System.out.println("value is:" + i);
}

Bhoopesh Tiwari
- 61
- 1
- 3
0
votes
1 answer
Mocking Kotlin methods with Java + Mockito
So I'm migrating a small Java codebase to Kotlin just for fun, and I've migrated this Java class:
public class Inputs {
private String engineURL;
private Map parameters;
public Inputs(String engineURL, Map

felipecao
- 993
- 1
- 10
- 23
0
votes
1 answer
'x' is not a function when passing parameters in Kotlin Javascript
I keep getting this error: TypeError: Scraper.dumpTitle is not a function
And I can't figure out why...
Index.html
Kotlin JS Demo