After upgrading to `2.2.0-Beta2`, compilation fail...
# compiler
s
After upgrading to
2.2.0-Beta2
, compilation fails with the following error
Copy code
e: org.jetbrains.kotlin.util.FileAnalysisException: While analysing /../sandbox/build/generated/buildconfig/BuildConfig.kt:9:1: java.lang.AbstractMethodError: Missing implementation of resolved method 'abstract void check(org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext, org.jetbrains.kotlin.diagnostics.DiagnosticReporter, org.jetbrains.kotlin.fir.declarations.FirDeclaration)' of abstract class org.jetbrains.kotlin.fir.analysis.checkers.declaration.FirDeclarationChecker.
        at org.jetbrains.kotlin.util.AnalysisExceptionsKt.wrapIntoFileAnalysisExceptionIfNeeded(AnalysisExceptions.kt:57)
        at org.jetbrains.kotlin.fir.FirCliExceptionHandler.handleExceptionOnFileAnalysis(Utils.kt:257)
        at org.jetbrains.kotlin.fir.pipeline.AnalyseKt.runCheckers(analyse.kt:68)
        at org.jetbrains.kotlin.fir.pipeline.FirUtilsKt.resolveAndCheckFir(firUtils.kt:77)
        at org.jetbrains.kotlin.cli.pipeline.jvm.JvmFrontendPipelinePhase.executePhase(JvmFrontendPipelinePhase.kt:174)

Caused by: java.lang.AbstractMethodError: Missing implementation of resolved method 'abstract void check(org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext, org.jetbrains.kotlin.diagnostics.DiagnosticReporter, org.jetbrains.kotlin.fir.declarations.FirDeclaration)' of abstract class org.jetbrains.kotlin.fir.analysis.checkers.declaration.FirDeclarationChecker.
        at org.jetbrains.kotlin.fir.analysis.checkers.declaration.DeclarationCheckersDiagnosticComponent.visitRegularClass(DeclarationCheckersDiagnosticComponent.kt:275)
        at org.jetbrains.kotlin.fir.analysis.checkers.declaration.DeclarationCheckersDiagnosticComponent.visitRegularClass(DeclarationCheckersDiagnosticComponent.kt:25)
        at org.jetbrains.kotlin.fir.declarations.FirRegularClass.accept(FirRegularClass.kt:49)
The source file is generated as part of a gradle task (like build info).
b
I responded here but we can continue the conversation here if you would like.
thank you color 1
s
Thanks for the hint. I am using a couple of compiler plugins. Is there any way to know the offending one? The stacktrace or .kotlin/error.log doesn’t show anything
b
Unless you are using a custom version for an official plugin, it's going to be a third-party compiler plugin. Unfortunately, I think that's all we have to go on right now. It for sure has a
FirRegularClassChecker
implementation of some kind, but without knowing which plugins you are using, that's about all I can offer.
d
I don't suppose there's a way for custom compiler plugins to work around this? I.e. 2.2.0 will have to be a hard break for custom compiler plugins?
b
If you wanted to get tricky, you might be able to have a checker with both signatures. The original signature might not actually override anything, but it might still be called at runtime since it has the right signature?
Copy code
object MyChecker : FirRegularClassChecker(MppCheckerKind.Common) {
    context(context: CheckerContext, reporter: DiagnosticReporter)
    override fun check(declaration: FirRegularClass) {
        check(declaration, context, reporter)
    }

    fun check(declaration: FirRegularClass, context: CheckerContext, reporter: DiagnosticReporter) {
        // ...
    }
}
s
@bnorm Thanks. Disabling the two third-party compiler plugins I was using fixed the issue (https://github.com/ZacSweers/redacted-compiler-plugin https://github.com/JavierSegoviaCordoba/kopy)
👍 1
d
cc @Zac Sweers, @Javier
j
Those are the checkers I have: https://github.com/JavierSegoviaCordoba/kopy/tree/main/kopy-compiler/main/kotlin/com/javiersc/kotlin/kopy/compiler/fir/checker/checkers I am not extending the
FirRegularClassChecker
, is that the only one that can generate this issue?
Look like Redacted has a
FirClassChecker
, but I haven’t see a Regular one at a glance
@suresh if you disable one by one and Kopy has the issue, can you open it on the GitHub repo?
z
yeah it's on my radar, I haven't had a chance to prep for 2.2.0 yet
s
@Javier Yes, I have already opened the GitHub issues on both repos.
j
But is it happening on Kopy?
s
yes
👍 1
d
It’s happens for all subclasses of
FirDeclarationChecker
j
@dmitriy.novozhilov, is it a breaking change transforming some function parameters to context parameters? I would expect it to be compatible if the final result is “the same” in terms of parameters.
d
The order of params changed
👀 1
Because the trailing params became the context params, which in bytecode are the leading params
👍 1
thank you color 1
@bnorm Appears that doesn’t work, same stacktrace.
sad panda 1
It would be nice if
FirDeclarationChecker
could have a
DeprecationLevel.HIDDEN
overload with the old signature and a default impl calling the new signature
b
@Drew Hamilton I can discuss it with the team, but it would be good to start with an issue as we're in 2.2.0 ramp-down. Details about impact, lack of workaround, etc will all be good to have.
👍 1
d
Filed KT-77283
👍 1
Actually providing the missing function signature as an overload does work, with the caveat that the type of the
declaration
param must be
FirDeclaration
rather than its generic subtype used by the class. 😌 Comment with example added to the above issue.