Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Kotlin to CodeCheck #66

Open
dmusican opened this issue Jun 23, 2024 · 3 comments
Open

Add Kotlin to CodeCheck #66

dmusican opened this issue Jun 23, 2024 · 3 comments

Comments

@dmusican
Copy link

dmusican commented Jun 23, 2024

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
Copy link
Author

dmusican commented Sep 1, 2024

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
Copy link
Owner

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
Copy link
Author

dmusican commented Sep 2, 2024

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?

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

No branches or pull requests

2 participants