Hey guys, I'm trying out LWJGL and I came accross ...
# announcements
k
Hey guys, I'm trying out LWJGL and I came accross this piece of code: (https://github.com/Zi0P4tch0/LWJGL-Kotlin-Example/blob/ed8e30bcb0ad5f99a01a4f501461457a0bd9d36f/src/main/kotlin/com/example/Engine.kt#L47). I don't really understand why there's a "kotlin." in front of every type, why is that necessary? It doesn't compile without it, I get the error "Object must be declared abstract or implement abstract base class member public abstract operator fun invoke(p0: Long, p1: Int, p2: Int, p3: Int, p4: Int): Unit defined in org.lwjgl.glfw.GLFWKeyCallback". The definition of the "invoke" method can be found here: (https://github.com/LWJGL/lwjgl3-generated/blob/894ed035ec3037975a344cf719936159a632967b/java/org/lwjgl/glfw/GLFWKeyCallbackI.java#L41)
d
karelpeeters: I can’t tell without setting up the project, but I would assume there are multiple “Int” classes in the namespace so it has to specify. You could test this theory by navigating to the definition of plain “Int” after you changing one of the parameters in the signature.
k
@darienalvarez Yup, turns out that is the case, Int refers to org.lwjgl.system.libffi.Closure.Int, while kotlin.Int refers to the normal Int. Though I can declare Int vals just outside the implementation, and they're the normal ones. I don't really get how that's possible, any idea?
d
You at-ed the wrong person by the way 🙂
Um, I’m not very familiar with the specifics of type resolution. I would assume there’s something going on with the import statements that’s causing it to prefer the lwjgl Ints over Kotlin Ints.
k
@dalexander Ah oops, I hope this is correct? 😄 Strange, I don't import Closure anywhere. I'll read up on type resolution though, maybe I find something.
d
Yep, that’s me 🙂