With the following code: ```private val configRege...
# multiplatform
e
With the following code:
Copy code
private val configRegex = Regex("^Config=(.+)$", RegexOption.MULTILINE)

internal class ServerExtensions {
  ...
}
Is it possible to generate a single
.class
file? I recall @mbonnin suggested
JvmMultifileClass
but it seems it's not applicable here
🚫 1
m
You'll have one class for holding your top level
val
and another one for
ServerExtensions
Why do you want everything in the same class?
e
Well it would make more sense logically since that regex is only used inside
ServerExtensions
. Not mandatory, but was just curious if it's feasible
m
You can always move the
val
inside your
ServerExtensions
If there are no top level declaration, the Kotlin compiler should skip generating a class
But this is all implementation detail in all cases. Unless you care about Java compat and/or some optimizations, that should not matter much
e
Yeah I've just ended up with
Copy code
private companion object {
  private val configRegex = Regex("^Config=(.+)$", RegexOption.MULTILINE)
}
The funny thing is now
configRegex
is a static field of
ServerExtensions
, and I got an instantiation of an empty
Companion
lol
m
You can certainly remove this with
@JvmStatic
if you really want to but...🤷
e
Seems like it's impossible to get rid of the useless companion class. Not a big deal tho
🤷 1
m
I'd say the companion is still used to hold some Kotlin metadata for the compiler but 🤷
e
Indeed there is metadata attached via the annotation. No problem! Thanks btw!