-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
Milestone
Description
When using Kotlin companion objects from JRuby, we get an "already initialized constant Companion" warning simply by loading the class. The companion object works correctly and is accessible as a constant from the parent class.
We're seeing this on JRuby 9.2.11.1. I tested prior versions and this warning first appears in JRuby 9.2.9.0.
Detailed Description
Given a Kotlin class like:
package kotlintest
class Test {
companion object {
const val FOO = "foo"
}
}
And a ruby class like:
require 'java'
require './build/libs/test-all.jar'
p Java::Kotlintest::Test::FOO
We get the following output:
$ ruby test.rb
test.rb:4: warning: already initialized constant Companion
"foo"
The warning is triggered just by loading the class. So if you just reference Java::Kotlintest::Test, without the companion object, you still get the warning.
Gradlefile used to build the jar:
plugins {
id("org.jetbrains.kotlin.jvm") version "1.3.70"
id("com.github.johnrengelman.shadow") version "5.2.0"
}
repositories {
jcenter()
}
dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels