Open jonathanswenson opened 3 years ago
repro: (using gradle 6.8.3)
build with ./gradlew shadowJar
to get kotlin runtime.
run with jruby repro.rb
tree: omitted gradle wrappers
.
├── build.gradle.kts
├── repro.rb
├── settings.gradle.kts
└── src
└── main
└── kotlin
└── com
└── looker
└── foo
└── TestClass.kt
plugins {
id("org.jetbrains.kotlin.jvm") version "1.5.0"
id("com.github.johnrengelman.shadow") version "6.1.0"
}
repositories {
mavenCentral()
}
dependencies {
implementation(platform("org.jetbrains.kotlin:kotlin-bom"))
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
}
rootProject.name = "jruby_repro"
package com.looker.foo
class TestClass {
companion object TestCompanionObject {
@JvmStatic
fun doit() {
println("done")
}
}
}
require_relative './build/libs/jruby_repro-all.jar'
# works
com.looker.foo.TestClass::TestCompanionObject.doit()
# throws NoMethodError: undefined method `NamedCompanionObject' for Java::ComLookerFoo::TestClass:Class
com.looker.foo.TestClass.NamedCompanionObject.doit()
Archive: build/libs/jruby_repro-all.jar
Length Method Size Cmpr Date Time CRC-32 Name
-------- ------ ------- ---- ---------- ----- -------- ----
0 Defl:N 2 0% 2021-09-20 20:20 00000000 META-INF/
25 Defl:N 27 -8% 2021-09-20 20:15 ee027fb2 META-INF/MANIFEST.MF
24 Defl:N 19 21% 2021-09-20 20:20 307d8f4d META-INF/jruby_repro.kotlin_module
0 Defl:N 2 0% 2021-09-20 20:15 00000000 com/
0 Defl:N 2 0% 2021-09-20 20:15 00000000 com/looker/
0 Defl:N 2 0% 2021-09-20 20:20 00000000 com/looker/foo/
939 Defl:N 584 38% 2021-09-20 20:20 dc25e58b com/looker/foo/TestClass.class
1080 Defl:N 638 41% 2021-09-20 20:20 f31c20bf com/looker/foo/TestClass$TestCompanionObject.class
268 Defl:N 151 44% 1980-02-01 00:00 32baac7f META-INF/kotlin-stdlib-jdk8.kotlin_module
0 Defl:N 2 0% 2021-09-20 20:20 00000000 kotlin/
... load of kotlin classes from the kotlin runtime
Could you turn this into an example repo? It might form the basis of a test kit for our Kotlin integration.
@headius what do you mean by / are you looking for in an example repo?
Environment Information
Provide at least:
jruby -v
) and command line (flags, JRUBY_OPTS, etc)jruby 9.3.0.0-SNAPSHOT (2.6.8) 2021-09-18 ffffffffff OpenJDK 64-Bit Server VM 25.272-b10 on 1.8.0_272-b10 +jit [linux-x86_64]
(built from source from most recent commit on master: 4727fcb3b037537ceecc67d771aa338bd5188af4 using a simple nix derivation)
uname -a
)Linux hostname 5.10.40-1rodete2-amd64 #1 SMP Debian 5.10.40-1rodete2 (2021-06-22) x86_64 GNU/Linux
(glinux)
Expected Behavior
I’m checking out 9.3.0.0 with our application (upgrading from 9.2.16.0).
We load in a jar that is written (mostly) in kotlin.
There exsts some kotlin in the form:
on 9.2.16.0, our application would reference this companion object via the syntax:
com.x.y.ClassName.CompanionObjectName.create(...)
Actual Behavior
but after upgrading to 9.3.0.0 that threw an error:
NoMethodError: undefined method `CompanionObjectName' for Java::ComXY::ClassName:Module
To get this to work I had to change to:
com.x.y.ClassName::CompanionObjectName.create(...)