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

Ktlint won't compile with version 0.3.0 #61

Closed
paul-dingemans opened this issue May 19, 2023 · 5 comments · Fixed by #62
Closed

Ktlint won't compile with version 0.3.0 #61

paul-dingemans opened this issue May 19, 2023 · 5 comments · Fixed by #62

Comments

@paul-dingemans
Copy link

I was trying to update the sarif4k dependency in Ktlint from version 0.2.0 to 0.3.0. It however results in compilation errors below on the ktlint-cli-reporter-sarif:

> Task :ktlint-cli-reporter-sarif:compileKotlin FAILED
e: Supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath:
    class io.github.detekt.sarif4k.Level.Companion, unresolved supertypes: kotlinx.serialization.KSerializer
    class io.github.detekt.sarif4k.Version.Companion, unresolved supertypes: kotlinx.serialization.KSerializer
Adding -Xextended-compiler-checks argument might provide additional information.


Supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath:
    class io.github.detekt.sarif4k.Level.Companion, unresolved supertypes: kotlinx.serialization.KSerializer
    class io.github.detekt.sarif4k.Version.Companion, unresolved supertypes: kotlinx.serialization.KSerializer
Adding -Xextended-compiler-checks argument might provide additional information.

Do you have any idea how to resolve?

@cortinico
Copy link
Member

cc @chao2zhang

@TWiStErRob
Copy link
Member

TWiStErRob commented May 19, 2023

github-ktlint$ gradlew :ktlint-cli-reporter-sarif:dep > deps.txt

image

Hmm 🤔, probably the result of going multiplatform: #6,
the weird thing is that we declare the dependency:

sarif4k/build.gradle.kts

Lines 34 to 38 in fdd0c3a

val commonMain by getting {
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1")
}
}

although as implementation, so it won't become part of your compileClasspath, see Runtime Dependencies at https://mvnrepository.com/artifact/io.github.detekt.sarif4k/sarif4k-jvm/0.3.0.

As a quick workaround you can add the missing dependency to ktlint-cli-reporter-sarif.

@TWiStErRob
Copy link
Member

TWiStErRob commented May 19, 2023

Quick decompile of sarif4k-jvm-0.3.0.jar shows:

package io.github.detekt.sarif4k;
import kotlinx.serialization.KSerializer;
import kotlinx.serialization.Serializable;

@Serializable(with = Companion.class)
public enum Level {
   public static final Companion Companion = new Companion((DefaultConstructorMarker)null);

   public static final class Companion implements KSerializer<Level> {

which means this dependency should be api.

@paul-dingemans
Copy link
Author

Problem is indeed solved with 0.4. Tnx.

@chao2zhang
Copy link
Member

Thank you for verifying!

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 a pull request may close this issue.

4 participants