I am trying to instantiate a Kotlin class from Java but every time I try to compile with Maven I get the error cannot find symbol
:
class ConfigCommand(private val game: Game) : Command("config", "") {
init {
addAliases("cfg")
}
override fun getRequiredRank(): Rank? {
return null
}
override fun getDescription(): String {
return "Shows the config for the game"
}
@Throws(CommandException::class)
override fun execute(sender: CommandSender, args: Array<String>): Boolean {
if (args.isEmpty()) {
if (sender !is Player)
throw NoConsoleAccessException()
sender.openInventory(ConfigGUI(game).build())
return true
}
return false
}
}
Not sure why that didn't format correctly but anyway before I converted it to a Kotlin class it worked but I need to register this command in my main class which is a Java class. When I try to instantiate a Kotlin class from a Java class there are no errors in the IDE but when I go to compile it maven screams
cannot find symbol
[ERROR] symbol: class ConfigCommand
pom.xml
as described here? If yes, what does yourpom.xml
look like? By the way, code formatting on StackOverflow is done using 4 space indentation. – SomersomerssourceDirs
declarations shown in the link @ChristianBrüggemann told you about... here again: kotlinlang.org/docs/reference/… – Bumble