Skip to content

Conversation

@zachwaffle4
Copy link
Contributor

@zachwaffle4 zachwaffle4 commented Sep 22, 2025

so now u do

object Something {
  var configVar by configurable("Something", "configVar", 0.0)
}

and it works yay wahoo

this uses reflection stuff like ReflectionConfig but also different somewhat so I had to write the entire thing again yayyyyyyyyyy

@BeepBot99
Copy link

Why can't you add support for Kotlin properties without @JvmField or @JvmStatic in an object, companion object, or top level instead? That way it would be much closer to the Java API.

@zachwaffle4
Copy link
Contributor Author

i do not want to write annotation processors

@BeepBot99
Copy link

That is not necessary, you can do it at runtime using Kotlin reflection.

@Vlad1-1
Copy link
Contributor

Vlad1-1 commented Oct 31, 2025

Just an opinion, I find this API much more native to kotlin.

However seeing kotlin properties from objects without @JvmField or @JvmStatic can be done from java by looking for the getProperty (or isProperty for Boolean properties) and setProperty functions in java reflection.

Also in my team's code we just use @file:Config at the top of the Constants file along with @JvmField on the properties to get top-level properties shown in the config menu. (it's shown as a ConstantsKt class generated by kotlin in bytecode)

@BeepBot99
Copy link

However seeing kotlin properties from objects without @JvmField or @JvmStatic can be done from java by looking for the getProperty (or isProperty for Boolean properties) and setProperty functions in java reflection.

Or just use kotlin reflection

Also in my team's code we just use @file:Config at the top of the Constants file along with @JvmField on the properties to get top-level properties shown in the config menu. (it's shown as a ConstantsKt class generated by kotlin in bytecode)

You can add @file:JvmName("Constants") to make it show as Constants.

@Vlad1-1
Copy link
Contributor

Vlad1-1 commented Nov 3, 2025

Or just use kotlin reflection

It's better that way, just said that as a hacky workaround

You can add @file:JvmName("Constants") to make it show as Constants.

I honestly forgot about that, thx.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants