Skip to content

Kotlin 2 Kotlin, part1#1824

Closed
9il wants to merge 1 commit intoSlimeVR:mainfrom
9il:kmp1
Closed

Kotlin 2 Kotlin, part1#1824
9il wants to merge 1 commit intoSlimeVR:mainfrom
9il:kmp1

Conversation

@9il
Copy link
Copy Markdown
Contributor

@9il 9il commented Apr 25, 2026

This commit replaces some JVM library calls with cross platform kotlin calls.

It would be great to move towards KMP.

Replaced imports

Java Import Replacement Files
java.util.function.Consumer (T) -> Unit 18
java.util.function.BiConsumer (A, B) -> Unit 1
java.util.function.Function (T) -> R 1
java.util.stream.Collectors Kotlin collection ops (.filter().toList() etc.) 2
java.util.concurrent.CompletableFuture kotlinx.coroutines.CompletableDeferred 1
java.util.concurrent.Future kotlinx.coroutines.Deferred 1
java.util.concurrent.ExecutionException Removed (coroutines throw directly) 1
java.util.concurrent.LinkedBlockingQueue ArrayDeque + .removeFirstOrNull() 2
java.util.concurrent.ConcurrentLinkedDeque ArrayDeque 1
java.util.Queue / java.util.Deque ArrayDeque 3
java.nio.charset.StandardCharsets Charsets (kotlin.text) 2
java.lang.IllegalArgumentException IllegalArgumentException (kotlin-stdlib) 1
java.io.Closeable Closeable (kotlin.io) 1
java.util.ArrayList ArrayList (kotlin.collections) 1
java.util.Objects Kotlin !! non-null assertion 1
SAM Consumer { } patterns Kotlin lambda { } with forEach 6
.stream().filter().collect(Collectors.toList()) .filter().toList() 2

Other changes

  • Replaced .accept(x) / .apply(x) calls with direct invocations where Consumer/BiConsumer/Function were removed
  • Replaced .stream().filter().findFirst() with .find { } where StreamSequence conversion was possible
  • Kept java.util.stream.Stream on ProtocolAPIServer and SerialHandler interfaces that Java classes implement

@github-actions github-actions Bot added Area: Skeletal Model Deals with the model of the skeleton and its pose Area: Hardware Protocol Related to communication with hardware/software trackers Area: AutoBone The AutoBone feature Area: SteamVR Driver Related to the SteamVR Driver Area: Server Related to the server labels Apr 25, 2026
@9il 9il force-pushed the kmp1 branch 2 times, most recently from 579d303 to a6722d7 Compare April 25, 2026 20:32
Copy link
Copy Markdown
Member

@ButterscotchV ButterscotchV left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine, may need to double check that Android doesn't complain about any of these

@loucass003
Copy link
Copy Markdown
Member

KMP is the goal. but with the #1798 in progress that aim to that anyway. It feels a bit redundant to do it on the current codebase.

@9il
Copy link
Copy Markdown
Contributor Author

9il commented Apr 27, 2026

@loucass003 Looks big. Why not incremental changes with AI? It is very accurate and fast. That is the kind of job that AI does better than best engineers.
When the code is already KMP, the design issues can be addressed much easier.

@loucass003
Copy link
Copy Markdown
Member

The structural change is too big to be incremental. I already use Ai to assist in some ways but this is not a magic tool.

@9il
Copy link
Copy Markdown
Contributor Author

9il commented Apr 27, 2026

Agree, there is a huge tech dept. I thought it could be easier to split language and library change with structural. What maintainers say about your work? I would love it to merged and well tests. I just afraid it could be stalled. I hope it will not

@loucass003
Copy link
Copy Markdown
Member

Main contributors are on board and the slime team too. so it will reach completion. just so you know i am the lead dev of the project. this is happening and not a daydream of some random contributor

@9il
Copy link
Copy Markdown
Contributor Author

9il commented Apr 27, 2026

Thank you :)

@9il 9il closed this Apr 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: AutoBone The AutoBone feature Area: Hardware Protocol Related to communication with hardware/software trackers Area: Server Related to the server Area: Skeletal Model Deals with the model of the skeleton and its pose Area: SteamVR Driver Related to the SteamVR Driver

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants