Pacoandres
Pacoandres

Reputation: 46

Kotlin: Different results on cli compiling and IDEA compiling

I’m working on a project that uses the MathCat4J library (MathCat4J GitHub) and I’m obtaining different results with different compilers.

When compiling the following code:

import onl.mdw.mathcat4j.api.MathCat
import onl.mdw.mathcat4j.api.MathCatJni
import onl.mdw.mathcat4j.core.mathCAT
fun main() {
  println (mathCAT { (MathCat::getVersion) ()})
}

with the cli compiler command kotlinc -classpath mathcat4j-core-0.6.4-5.jar ktest_mc4j.kt -include-runtime -d ktest_mc4j.jar got no errors and everything works as expected.

But when compiling in IDEA I get the error:

Kotlin: No value passed for parameter 'p1'

And when using other methods like

mathCAT { (MathCat::setRulesDir) (dir)}

the IDEA compiling says

Kotlin: Type mismatch: inferred type is String but MathCat was expected

while with cli compiler everything works ok.

I've checked everything I know and can't find why this is happening. The only difference is that the file mathcat4j-core-0.6.4-5.jar is in the same directory in the case of cli compiling, while in the IDEA project it's in the local maven repository and (I think) this shouldn't be related with these errors.

I’m working on an Arch Linux system, with openjdk 22.0.2. The kotlin cli compiler version is 2.0.20, and the version configured in IDEA is also 2.0.20 and it’s using the system jdk and it's a maven based project.

Does anyboby know why everything works with the cli compiler and does not work in an IDEA project and how it could be solved?

PD: solved. The solution is explained in a comment.

Upvotes: 0

Views: 23

Answers (0)

Related Questions