cayhorstmann / codecheck2

Merging CodeCheck checker and Play server
GNU Affero General Public License v3.0
11 stars 29 forks source link

Add Kotlin to CodeCheck #66

Open dmusican opened 2 months ago

dmusican commented 2 months ago

It would be great if Kotlin could be added as a language option for CodeCheck. I had a previous exchange about this with Cay about this, and he asked me to answer the following:

Kotlin version: 2.0.0

Minimum required version of Java: Java 21 definitely works; perhaps an early version would work, I'm not sure.

How to download/install: I've been successfully using sdkman on Linux systems (https://sdkman.io/), and also in Docker. Commands to install:

curl -s "https://get.sdkman.io" | bash
sdk install java
sdk install kotlin 2.0.0

How to invoke the compiler and compiled program on command line: assuming that Main.kt is the name of the file with the main function in it...

kotlinc *.kt && kotlin MainKt

Typical examples for variable declarations: https://kotlinlang.org/docs/basic-syntax.html#variables

Main method: https://kotlinlang.org/docs/basic-syntax.html#program-entry-point

Some random compiler error messages:

Submission.kt:8:5: error: unresolved reference 'printxln'.
    printxln(Adder().doit(5))

Submission.kt:1:1: error: syntax error: Expecting a top level declaration.
claxss Adder {
^^^^^^
Submission.kt:1:8: error: syntax error: Expecting a top level declaration.
claxss Adder {
       ^^^^^
Submission.kt:1:14: error: syntax error: Expecting a top level declaration.
claxss Adder {
             ^
Submission.kt:1:14: error: function declaration must have a name.
claxss Adder {
             ^
Submission.kt:8:5: error: overload resolution ambiguity between candidates:
@InlineOnly() fun println(message: Any?): Unit
@InlineOnly() fun println(message: Boolean): Unit
@InlineOnly() fun println(message: Byte): Unit
@InlineOnly() fun println(message: Char): Unit
@InlineOnly() fun println(message: CharArray): Unit
@InlineOnly() fun println(message: Double): Unit
@InlineOnly() fun println(message: Float): Unit
@InlineOnly() fun println(message: Int): Unit
@InlineOnly() fun println(message: Long): Unit
@InlineOnly() fun println(message: Short): Unit
    println(Adder().doit(5))
    ^^^^^^^
Submission.kt:8:13: error: unresolved reference 'Adder'.
    println(Adder().doit(5))
            ^^^^^

Unit test framework:

https://kotlinlang.org/docs/jvm-test-using-junit.html

dmusican commented 2 weeks ago

I'm checking in, as I'm planning my course starting up for the fall. Has any progress been made on integrating Kotlin? (Thanks for CodeCheck regardless, it's great)

cayhorstmann commented 2 weeks ago

Hi, I didn't find a student to work on it during the summer, so it'll be me doing it. When does your course start?

dmusican commented 2 weeks ago

Mon, 9/16... but I'd be using it right away. I would only use it for the first two weeks of the course as we transition over to Kotlin, so I would need to be setting it up next week. That's likely unrealistic at this point, I assume?