JetBrains / JetBrains/rd

`javaClass.classLoader` in `registerSerializersCore` causes a compiler warning

Open
#492 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C#
Stars
417
Forks
62
Avg merge
9h 15m
Merged PRs (30d)
7

Description

Every generated Kotlin class contains this snippet:
```kotlin
override fun registerSerializersCore(serializers: ISerializers) {
val classLoader = javaClass.classLoader
```

`javaClass.classLoader` causes a Kotlin compiler warning:
> The resulting type of this 'javaClass' call is Class and not Class. Please use the more clear '::class.java' syntax to avoid confusion

Let's either replace it with `val classLoader = Companion::class.java.classLoader`, or add `@Suppress("JAVA_CLASS_ON_COMPANION")` to generated files.

Currently, this issue blocks compiling projects with generated files if we have enabled warnings-as-errors in Kotlin.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.