K2: add sourceElement for binary Java classes
#KT-60555 Fixed
This commit is contained in:
committed by
Space Team
parent
10e94f90ac
commit
4d9457862f
@@ -11,7 +11,6 @@ dependencies {
|
|||||||
api(project(":compiler:resolution.common.jvm"))
|
api(project(":compiler:resolution.common.jvm"))
|
||||||
api(project(":compiler:frontend.common"))
|
api(project(":compiler:frontend.common"))
|
||||||
api(project(":compiler:frontend.common.jvm"))
|
api(project(":compiler:frontend.common.jvm"))
|
||||||
// api(project(":compiler:fir:resolve"))
|
|
||||||
api(project(":compiler:fir:resolve"))
|
api(project(":compiler:fir:resolve"))
|
||||||
api(project(":compiler:fir:checkers"))
|
api(project(":compiler:fir:checkers"))
|
||||||
api(project(":compiler:fir:fir-deserialization"))
|
api(project(":compiler:fir:fir-deserialization"))
|
||||||
@@ -19,6 +18,7 @@ dependencies {
|
|||||||
implementation(project(":core:deserialization.common.jvm"))
|
implementation(project(":core:deserialization.common.jvm"))
|
||||||
|
|
||||||
compileOnly(intellijCore())
|
compileOnly(intellijCore())
|
||||||
|
compileOnly(commonDependency("org.jetbrains.intellij.deps:asm-all"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import org.jetbrains.kotlin.fir.declarations.impl.FirDeclarationStatusImpl
|
|||||||
import org.jetbrains.kotlin.fir.declarations.impl.FirResolvedDeclarationStatusImpl
|
import org.jetbrains.kotlin.fir.declarations.impl.FirResolvedDeclarationStatusImpl
|
||||||
import org.jetbrains.kotlin.fir.declarations.utils.effectiveVisibility
|
import org.jetbrains.kotlin.fir.declarations.utils.effectiveVisibility
|
||||||
import org.jetbrains.kotlin.fir.declarations.utils.modality
|
import org.jetbrains.kotlin.fir.declarations.utils.modality
|
||||||
|
import org.jetbrains.kotlin.fir.declarations.utils.sourceElement
|
||||||
import org.jetbrains.kotlin.fir.extensions.FirStatusTransformerExtension
|
import org.jetbrains.kotlin.fir.extensions.FirStatusTransformerExtension
|
||||||
import org.jetbrains.kotlin.fir.extensions.extensionService
|
import org.jetbrains.kotlin.fir.extensions.extensionService
|
||||||
import org.jetbrains.kotlin.fir.extensions.statusTransformerExtensions
|
import org.jetbrains.kotlin.fir.extensions.statusTransformerExtensions
|
||||||
@@ -40,6 +41,10 @@ import org.jetbrains.kotlin.fir.visitors.FirVisitorVoid
|
|||||||
import org.jetbrains.kotlin.load.java.JavaClassFinder
|
import org.jetbrains.kotlin.load.java.JavaClassFinder
|
||||||
import org.jetbrains.kotlin.load.java.structure.*
|
import org.jetbrains.kotlin.load.java.structure.*
|
||||||
import org.jetbrains.kotlin.load.java.structure.impl.JavaElementImpl
|
import org.jetbrains.kotlin.load.java.structure.impl.JavaElementImpl
|
||||||
|
import org.jetbrains.kotlin.load.java.structure.impl.classFiles.BinaryJavaClass
|
||||||
|
import org.jetbrains.kotlin.load.kotlin.KotlinJvmBinaryClass
|
||||||
|
import org.jetbrains.kotlin.load.kotlin.KotlinJvmBinarySourceElement
|
||||||
|
import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader
|
||||||
import org.jetbrains.kotlin.name.*
|
import org.jetbrains.kotlin.name.*
|
||||||
import org.jetbrains.kotlin.types.Variance.INVARIANT
|
import org.jetbrains.kotlin.types.Variance.INVARIANT
|
||||||
|
|
||||||
@@ -407,6 +412,10 @@ abstract class FirJavaFacade(
|
|||||||
if (javaClass.isRecord) {
|
if (javaClass.isRecord) {
|
||||||
this.isJavaRecord = true
|
this.isJavaRecord = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (javaClass is BinaryJavaClass) {
|
||||||
|
sourceElement = JavaBinarySourceElement(javaClass)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.kotlin.fir.java
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.descriptors.SourceElement
|
||||||
|
import org.jetbrains.kotlin.descriptors.SourceFile
|
||||||
|
import org.jetbrains.kotlin.load.java.structure.impl.classFiles.BinaryJavaClass
|
||||||
|
|
||||||
|
class JavaBinarySourceElement(val javaClass: BinaryJavaClass) : SourceElement {
|
||||||
|
override fun getContainingFile(): SourceFile = SourceFile.NO_SOURCE_FILE
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user