Simplify usages of IncrementalPackageFragment and related code
Since its scope is now empty, no descriptor now has a container that is an instance of IncrementalPackageFragment -> a lot of code is not needed anymore
This commit is contained in:
@@ -321,7 +321,7 @@ open class IncrementalCacheImpl<Target>(
|
||||
override fun getObsoletePackageParts(): Collection<String> {
|
||||
val obsoletePackageParts =
|
||||
dirtyOutputClassesMap.getDirtyOutputClasses().filter { packagePartMap.isPackagePart(JvmClassName.byInternalName(it)) }
|
||||
debugLog("Obsolete package parts: ${obsoletePackageParts}")
|
||||
debugLog("Obsolete package parts: $obsoletePackageParts")
|
||||
return obsoletePackageParts
|
||||
}
|
||||
|
||||
@@ -346,10 +346,6 @@ open class IncrementalCacheImpl<Target>(
|
||||
return partNames.filter { !dirtyOutputClassesMap.isDirty(it) }
|
||||
}
|
||||
|
||||
override fun getMultifileFacade(partInternalName: String): String? {
|
||||
return partToMultifileFacade.get(partInternalName)
|
||||
}
|
||||
|
||||
override fun getModuleMappingData(): ByteArray? {
|
||||
return protoMap[JvmClassName.byInternalName(MODULE_MAPPING_FILE_NAME)]?.bytes
|
||||
}
|
||||
|
||||
@@ -828,17 +828,6 @@ public class AsmUtil {
|
||||
return JvmClassName.byFqNameWithoutInnerClasses(fqName).getInternalName();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String getSimpleInternalName(@NotNull String internalName) {
|
||||
int lastSlash = internalName.lastIndexOf('/');
|
||||
if (lastSlash >= 0) {
|
||||
return internalName.substring(lastSlash + 1);
|
||||
}
|
||||
else {
|
||||
return internalName;
|
||||
}
|
||||
}
|
||||
|
||||
public static void putJavaLangClassInstance(@NotNull InstructionAdapter v, @NotNull Type type) {
|
||||
if (isPrimitive(type)) {
|
||||
v.getstatic(boxType(type).getInternalName(), "TYPE", "Ljava/lang/Class;");
|
||||
|
||||
@@ -283,8 +283,6 @@ public class InlineCodegen extends CallGenerator {
|
||||
@NotNull final GenerationState state,
|
||||
@NotNull Method asmMethod
|
||||
) {
|
||||
KotlinTypeMapper typeMapper = state.getTypeMapper();
|
||||
|
||||
if (isBuiltInArrayIntrinsic(callableDescriptor)) {
|
||||
ClassId classId = IntrinsicArrayConstructorsKt.getClassId();
|
||||
byte[] bytes = InlineCacheKt.getOrPut(state.getInlineCache().getClassBytes(), classId, new Function0<byte[]>() {
|
||||
@@ -300,7 +298,7 @@ public class InlineCodegen extends CallGenerator {
|
||||
assert callableDescriptor instanceof DeserializedCallableMemberDescriptor : "Not a deserialized function or proper: " + callableDescriptor;
|
||||
|
||||
KotlinTypeMapper.ContainingClassesInfo containingClasses =
|
||||
typeMapper.getContainingClassesForDeserializedCallable((DeserializedCallableMemberDescriptor) callableDescriptor);
|
||||
KotlinTypeMapper.getContainingClassesForDeserializedCallable((DeserializedCallableMemberDescriptor) callableDescriptor);
|
||||
|
||||
final ClassId containerId = containingClasses.getImplClassId();
|
||||
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ import org.jetbrains.kotlin.resolve.jvm.jvmSignature.KotlinToJvmSignatureMapper
|
||||
|
||||
class KotlinToJvmSignatureMapperImpl : KotlinToJvmSignatureMapper {
|
||||
// We use empty BindingContext, because it is only used by KotlinTypeMapper for purposes irrelevant to the needs of this class
|
||||
private val typeMapper = KotlinTypeMapper(BindingContext.EMPTY, ClassBuilderMode.LIGHT_CLASSES, NoResolveFileClassesProvider, null,
|
||||
private val typeMapper = KotlinTypeMapper(BindingContext.EMPTY, ClassBuilderMode.LIGHT_CLASSES, NoResolveFileClassesProvider,
|
||||
IncompatibleClassTracker.DoNothing, JvmAbi.DEFAULT_MODULE_NAME, false)
|
||||
|
||||
override fun mapToJvmMethodSignature(function: FunctionDescriptor) = typeMapper.mapAsmMethod(function)
|
||||
|
||||
+3
-4
@@ -28,7 +28,6 @@ import org.jetbrains.kotlin.diagnostics.DiagnosticSink
|
||||
import org.jetbrains.kotlin.fileClasses.JvmFileClassesProvider
|
||||
import org.jetbrains.kotlin.load.java.descriptors.SamAdapterDescriptor
|
||||
import org.jetbrains.kotlin.load.java.descriptors.getParentJavaStaticClassScope
|
||||
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCache
|
||||
import org.jetbrains.kotlin.resolve.BindingContext
|
||||
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.overriddenTreeUniqueAsSequence
|
||||
@@ -59,13 +58,13 @@ class BuilderFactoryForDuplicateSignatureDiagnostics(
|
||||
bindingContext: BindingContext,
|
||||
private val diagnostics: DiagnosticSink,
|
||||
fileClassesProvider: JvmFileClassesProvider,
|
||||
incrementalCache: IncrementalCache?,
|
||||
moduleName: String
|
||||
) : SignatureCollectingClassBuilderFactory(builderFactory) {
|
||||
|
||||
// Avoid errors when some classes are not loaded for some reason
|
||||
private val typeMapper = KotlinTypeMapper(bindingContext, ClassBuilderMode.LIGHT_CLASSES, fileClassesProvider, incrementalCache,
|
||||
IncompatibleClassTracker.DoNothing, moduleName, false)
|
||||
private val typeMapper = KotlinTypeMapper(
|
||||
bindingContext, ClassBuilderMode.LIGHT_CLASSES, fileClassesProvider, IncompatibleClassTracker.DoNothing, moduleName, false
|
||||
)
|
||||
private val reportDiagnosticsTasks = ArrayList<() -> Unit>()
|
||||
|
||||
fun reportDiagnostics() {
|
||||
|
||||
@@ -135,8 +135,8 @@ class GenerationState @JvmOverloads constructor(
|
||||
filter = if (wantsDiagnostics) BindingTraceFilter.ACCEPT_ALL else BindingTraceFilter.NO_DIAGNOSTICS)
|
||||
val bindingContext: BindingContext = bindingTrace.bindingContext
|
||||
val typeMapper: KotlinTypeMapper = KotlinTypeMapper(
|
||||
this.bindingContext, classBuilderMode, fileClassesProvider, incrementalCacheForThisTarget,
|
||||
IncompatibleClassTrackerImpl(extraJvmDiagnosticsTrace), this.moduleName, isJvm8Target
|
||||
this.bindingContext, classBuilderMode, fileClassesProvider, IncompatibleClassTrackerImpl(extraJvmDiagnosticsTrace),
|
||||
this.moduleName, isJvm8Target
|
||||
)
|
||||
val intrinsics: IntrinsicMethods = IntrinsicMethods()
|
||||
val samWrapperClasses: SamWrapperClasses = SamWrapperClasses(this)
|
||||
@@ -173,7 +173,7 @@ class GenerationState @JvmOverloads constructor(
|
||||
{ OptimizationClassBuilderFactory(it, configuration.get(JVMConfigurationKeys.DISABLE_OPTIMIZATION, false)) },
|
||||
::CoroutineTransformerClassBuilderFactory,
|
||||
{ BuilderFactoryForDuplicateSignatureDiagnostics(
|
||||
it, this.bindingContext, diagnostics, fileClassesProvider, incrementalCacheForThisTarget, this.moduleName
|
||||
it, this.bindingContext, diagnostics, fileClassesProvider, this.moduleName
|
||||
).apply { duplicateSignatureFactory = this } },
|
||||
{ BuilderFactoryForDuplicateClassNameDiagnostics(it, diagnostics) },
|
||||
{ configuration.get(JVMConfigurationKeys.DECLARATIONS_JSON_PATH)
|
||||
|
||||
@@ -49,8 +49,6 @@ import org.jetbrains.kotlin.load.java.descriptors.JavaCallableMemberDescriptor;
|
||||
import org.jetbrains.kotlin.load.java.descriptors.JavaClassDescriptor;
|
||||
import org.jetbrains.kotlin.load.java.lazy.descriptors.LazyJavaPackageFragment;
|
||||
import org.jetbrains.kotlin.load.kotlin.*;
|
||||
import org.jetbrains.kotlin.load.kotlin.incremental.IncrementalPackageFragmentProvider;
|
||||
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCache;
|
||||
import org.jetbrains.kotlin.name.ClassId;
|
||||
import org.jetbrains.kotlin.name.FqName;
|
||||
import org.jetbrains.kotlin.name.Name;
|
||||
@@ -81,7 +79,7 @@ import org.jetbrains.org.objectweb.asm.commons.Method;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import static org.jetbrains.kotlin.codegen.AsmUtil.*;
|
||||
import static org.jetbrains.kotlin.codegen.AsmUtil.isStaticMethod;
|
||||
import static org.jetbrains.kotlin.codegen.JvmCodegenUtil.*;
|
||||
import static org.jetbrains.kotlin.codegen.binding.CodegenBinding.*;
|
||||
import static org.jetbrains.kotlin.resolve.BindingContextUtils.getDelegationConstructorCall;
|
||||
@@ -96,10 +94,10 @@ public class KotlinTypeMapper {
|
||||
private final BindingContext bindingContext;
|
||||
private final ClassBuilderMode classBuilderMode;
|
||||
private final JvmFileClassesProvider fileClassesProvider;
|
||||
private final IncrementalCache incrementalCache;
|
||||
private final IncompatibleClassTracker incompatibleClassTracker;
|
||||
private final String moduleName;
|
||||
private boolean isJvm8Target;
|
||||
private final boolean isJvm8Target;
|
||||
|
||||
private final TypeMappingConfiguration<Type> typeMappingConfiguration = new TypeMappingConfiguration<Type>() {
|
||||
@NotNull
|
||||
@Override
|
||||
@@ -125,7 +123,6 @@ public class KotlinTypeMapper {
|
||||
@NotNull BindingContext bindingContext,
|
||||
@NotNull ClassBuilderMode classBuilderMode,
|
||||
@NotNull JvmFileClassesProvider fileClassesProvider,
|
||||
@Nullable IncrementalCache incrementalCache,
|
||||
@NotNull IncompatibleClassTracker incompatibleClassTracker,
|
||||
@NotNull String moduleName,
|
||||
boolean isJvm8Target
|
||||
@@ -133,7 +130,6 @@ public class KotlinTypeMapper {
|
||||
this.bindingContext = bindingContext;
|
||||
this.classBuilderMode = classBuilderMode;
|
||||
this.fileClassesProvider = fileClassesProvider;
|
||||
this.incrementalCache = incrementalCache;
|
||||
this.incompatibleClassTracker = incompatibleClassTracker;
|
||||
this.moduleName = moduleName;
|
||||
this.isJvm8Target = isJvm8Target;
|
||||
@@ -154,7 +150,7 @@ public class KotlinTypeMapper {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Type mapOwner(@NotNull DeclarationDescriptor descriptor, boolean publicFacade) {
|
||||
private Type mapOwner(@NotNull DeclarationDescriptor descriptor, boolean publicFacade) {
|
||||
if (isLocalFunction(descriptor)) {
|
||||
return asmTypeForAnonymousClass(bindingContext, (FunctionDescriptor) descriptor);
|
||||
}
|
||||
@@ -214,45 +210,47 @@ public class KotlinTypeMapper {
|
||||
private final ClassId facadeClassId;
|
||||
private final ClassId implClassId;
|
||||
|
||||
public ContainingClassesInfo(ClassId facadeClassId, ClassId implClassId) {
|
||||
public ContainingClassesInfo(@NotNull ClassId facadeClassId, @NotNull ClassId implClassId) {
|
||||
this.facadeClassId = facadeClassId;
|
||||
this.implClassId = implClassId;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ClassId getFacadeClassId() {
|
||||
return facadeClassId;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ClassId getImplClassId() {
|
||||
return implClassId;
|
||||
}
|
||||
|
||||
private static @Nullable ContainingClassesInfo forPackageMemberOrNull(
|
||||
@Nullable
|
||||
private static ContainingClassesInfo forPackageMember(
|
||||
@NotNull FqName packageFqName,
|
||||
@Nullable String facadeClassName,
|
||||
@Nullable String implClassName
|
||||
@NotNull String facadeClassName,
|
||||
@NotNull String implClassName
|
||||
) {
|
||||
if (facadeClassName == null || implClassName == null) {
|
||||
return null;
|
||||
}
|
||||
return new ContainingClassesInfo(ClassId.topLevel(packageFqName.child(Name.identifier(facadeClassName))),
|
||||
ClassId.topLevel(packageFqName.child(Name.identifier(implClassName))));
|
||||
}
|
||||
|
||||
private static @Nullable ContainingClassesInfo forClassMemberOrNull(@Nullable ClassId classId) {
|
||||
if (classId == null) {
|
||||
return null;
|
||||
}
|
||||
@NotNull
|
||||
private static ContainingClassesInfo forClassMemberOrNull(@NotNull ClassId classId) {
|
||||
return new ContainingClassesInfo(classId, classId);
|
||||
}
|
||||
}
|
||||
|
||||
public ContainingClassesInfo getContainingClassesForDeserializedCallable(DeserializedCallableMemberDescriptor deserializedDescriptor) {
|
||||
@NotNull
|
||||
public static ContainingClassesInfo getContainingClassesForDeserializedCallable(
|
||||
@NotNull DeserializedCallableMemberDescriptor deserializedDescriptor
|
||||
) {
|
||||
DeclarationDescriptor parentDeclaration = deserializedDescriptor.getContainingDeclaration();
|
||||
ContainingClassesInfo containingClassesInfo;
|
||||
if (parentDeclaration instanceof PackageFragmentDescriptor) {
|
||||
containingClassesInfo = getPackageMemberContainingClassesInfo(deserializedDescriptor);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
ClassId classId = getContainerClassIdForClassDescriptor((ClassDescriptor) parentDeclaration);
|
||||
containingClassesInfo = ContainingClassesInfo.forClassMemberOrNull(classId);
|
||||
}
|
||||
@@ -262,7 +260,8 @@ public class KotlinTypeMapper {
|
||||
return containingClassesInfo;
|
||||
}
|
||||
|
||||
private static ClassId getContainerClassIdForClassDescriptor(ClassDescriptor classDescriptor) {
|
||||
@NotNull
|
||||
private static ClassId getContainerClassIdForClassDescriptor(@NotNull ClassDescriptor classDescriptor) {
|
||||
ClassId classId = DescriptorUtilsKt.getClassId(classDescriptor);
|
||||
if (isInterface(classDescriptor)) {
|
||||
FqName relativeClassName = classId.getRelativeClassName();
|
||||
@@ -273,7 +272,7 @@ public class KotlinTypeMapper {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private String getPackageMemberOwnerInternalName(@NotNull DeserializedCallableMemberDescriptor descriptor, boolean publicFacade) {
|
||||
private static String getPackageMemberOwnerInternalName(@NotNull DeserializedCallableMemberDescriptor descriptor, boolean publicFacade) {
|
||||
DeclarationDescriptor containingDeclaration = descriptor.getContainingDeclaration();
|
||||
assert containingDeclaration instanceof PackageFragmentDescriptor : "Not a top-level member: " + descriptor;
|
||||
|
||||
@@ -290,50 +289,24 @@ public class KotlinTypeMapper {
|
||||
private static final ClassId FAKE_CLASS_ID_FOR_BUILTINS = ClassId.topLevel(new FqName("kotlin.KotlinPackage"));
|
||||
|
||||
@Nullable
|
||||
private ContainingClassesInfo getPackageMemberContainingClassesInfo(@NotNull DeserializedCallableMemberDescriptor descriptor) {
|
||||
// XXX This method is a dirty hack.
|
||||
// We need some safe, concise way to identify multifile facade and multifile part
|
||||
// from a deserialized package member descriptor.
|
||||
private static ContainingClassesInfo getPackageMemberContainingClassesInfo(@NotNull DeserializedCallableMemberDescriptor descriptor) {
|
||||
DeclarationDescriptor containingDeclaration = descriptor.getContainingDeclaration();
|
||||
assert containingDeclaration instanceof PackageFragmentDescriptor
|
||||
: "Package member expected, got " + descriptor + " in " + containingDeclaration;
|
||||
PackageFragmentDescriptor packageFragmentDescriptor = (PackageFragmentDescriptor) containingDeclaration;
|
||||
|
||||
if (packageFragmentDescriptor instanceof BuiltInsPackageFragment) {
|
||||
if (containingDeclaration instanceof BuiltInsPackageFragment) {
|
||||
return new ContainingClassesInfo(FAKE_CLASS_ID_FOR_BUILTINS, FAKE_CLASS_ID_FOR_BUILTINS);
|
||||
}
|
||||
|
||||
assert containingDeclaration instanceof LazyJavaPackageFragment :
|
||||
"Unexpected package fragment for " + descriptor + ": " + containingDeclaration +
|
||||
" (" + containingDeclaration.getClass().getSimpleName() + ")";
|
||||
LazyJavaPackageFragment packageFragment = (LazyJavaPackageFragment) containingDeclaration;
|
||||
|
||||
Name implClassName = JvmFileClassUtil.getImplClassName(descriptor);
|
||||
assert implClassName != null : "No implClassName for " + descriptor;
|
||||
String implSimpleName = implClassName.asString();
|
||||
|
||||
String facadeSimpleName;
|
||||
String facadeSimpleName = packageFragment.getFacadeSimpleNameForPartSimpleName(implClassName.asString());
|
||||
if (facadeSimpleName == null) return null;
|
||||
|
||||
if (packageFragmentDescriptor instanceof LazyJavaPackageFragment) {
|
||||
facadeSimpleName = ((LazyJavaPackageFragment) packageFragmentDescriptor).getFacadeSimpleNameForPartSimpleName(
|
||||
implClassName.asString()
|
||||
);
|
||||
}
|
||||
else if (packageFragmentDescriptor instanceof IncrementalPackageFragmentProvider.IncrementalPackageFragment) {
|
||||
assert incrementalCache != null
|
||||
: "IncrementalPackageFragment found outside of incremental compilation context " +
|
||||
"for " + descriptor + " in package " + packageFragmentDescriptor;
|
||||
|
||||
String implClassInternalName = internalNameByFqNameWithoutInnerClasses(
|
||||
packageFragmentDescriptor.getFqName().child(implClassName));
|
||||
String facadeClassInternalName = incrementalCache.getMultifileFacade(implClassInternalName);
|
||||
if (facadeClassInternalName == null) {
|
||||
facadeSimpleName = implClassName.asString();
|
||||
}
|
||||
else {
|
||||
facadeSimpleName = getSimpleInternalName(facadeClassInternalName);
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw new AssertionError("Unexpected package fragment for " + descriptor + ": " +
|
||||
packageFragmentDescriptor + " (" + packageFragmentDescriptor.getClass().getSimpleName() + ")");
|
||||
}
|
||||
return ContainingClassesInfo.forPackageMemberOrNull(packageFragmentDescriptor.getFqName(), facadeSimpleName, implSimpleName);
|
||||
return ContainingClassesInfo.forPackageMember(packageFragment.getFqName(), facadeSimpleName, implClassName.asString());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -692,7 +665,7 @@ public class KotlinTypeMapper {
|
||||
}
|
||||
|
||||
FunctionDescriptor overriddenSpecialBuiltinFunction =
|
||||
SpecialBuiltinMembers.<FunctionDescriptor>getOverriddenBuiltinReflectingJvmDescriptor(functionDescriptor.getOriginal());
|
||||
SpecialBuiltinMembers.getOverriddenBuiltinReflectingJvmDescriptor(functionDescriptor.getOriginal());
|
||||
FunctionDescriptor functionToCall = overriddenSpecialBuiltinFunction != null && !superCall
|
||||
? overriddenSpecialBuiltinFunction.getOriginal()
|
||||
: functionDescriptor.getOriginal();
|
||||
|
||||
@@ -18,11 +18,10 @@ package org.jetbrains.kotlin.cli.common
|
||||
|
||||
import com.intellij.openapi.Disposable
|
||||
import com.intellij.openapi.project.Project
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
import org.jetbrains.kotlin.load.kotlin.ModuleVisibilityManager
|
||||
import org.jetbrains.kotlin.load.kotlin.getSourceElement
|
||||
import org.jetbrains.kotlin.load.kotlin.isContainedByCompiledPartOfOurModule
|
||||
import org.jetbrains.kotlin.load.kotlin.isFromIncrementalPackageFragment
|
||||
import org.jetbrains.kotlin.modules.Module
|
||||
import org.jetbrains.kotlin.resolve.lazy.descriptors.LazyPackageDescriptor
|
||||
import org.jetbrains.kotlin.resolve.source.KotlinSourceElement
|
||||
@@ -36,11 +35,11 @@ class ModuleVisibilityHelperImpl : ModuleVisibilityHelper {
|
||||
// We should check accessibility of 'from' in current module (some set of source files, which are compiled together),
|
||||
// so we can assume that 'from' should have sources or is a LazyPackageDescriptor with some package files.
|
||||
val project: Project = if (fromSource is KotlinSourceElement) {
|
||||
fromSource.psi.project
|
||||
}
|
||||
else {
|
||||
(from as? LazyPackageDescriptor)?.declarationProvider?.getPackageFiles()?.firstOrNull()?.project ?: return true
|
||||
}
|
||||
fromSource.psi.project
|
||||
}
|
||||
else {
|
||||
(from as? LazyPackageDescriptor)?.declarationProvider?.getPackageFiles()?.firstOrNull()?.project ?: return true
|
||||
}
|
||||
|
||||
val moduleVisibilityManager = ModuleVisibilityManager.SERVICE.getInstance(project)
|
||||
moduleVisibilityManager.friendPaths.forEach {
|
||||
@@ -60,10 +59,6 @@ class ModuleVisibilityHelperImpl : ModuleVisibilityHelper {
|
||||
|
||||
if (modules.isEmpty()) return false
|
||||
|
||||
// Hack for incremental compilation (now there is no way to determine the module of descriptor in case of incremental package fragment)
|
||||
// TODO Implement full check for access to internal for incremental compilation
|
||||
if (what.isFromIncrementalPackageFragment) return true
|
||||
|
||||
if (modules.size == 1 && isContainedByCompiledPartOfOurModule(what, File(modules.single().getOutputDirectory()))) return true
|
||||
|
||||
return findModule(from, modules) === findModule(what, modules)
|
||||
@@ -77,7 +72,7 @@ class ModuleVisibilityHelperImpl : ModuleVisibilityHelper {
|
||||
else {
|
||||
return modules.firstOrNull { module ->
|
||||
isContainedByCompiledPartOfOurModule(descriptor, File(module.getOutputDirectory())) ||
|
||||
module.getFriendPaths().any { isContainedByCompiledPartOfOurModule(descriptor, File(it))}
|
||||
module.getFriendPaths().any { isContainedByCompiledPartOfOurModule(descriptor, File(it)) }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -102,4 +97,4 @@ class CliModuleVisibilityManagerImpl() : ModuleVisibilityManager, Disposable {
|
||||
override fun dispose() {
|
||||
chunk.clear()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-2
@@ -51,8 +51,6 @@ class CompilerCallbackServicesFacadeServer(
|
||||
|
||||
override fun incrementalCache_getMultifileFacadeParts(target: TargetId, internalName: String): Collection<String>? = incrementalCompilationComponents!!.getIncrementalCache(target).getStableMultifileFacadeParts(internalName)
|
||||
|
||||
override fun incrementalCache_getMultifileFacade(target: TargetId, partInternalName: String): String? = incrementalCompilationComponents!!.getIncrementalCache(target).getMultifileFacade(partInternalName)
|
||||
|
||||
override fun incrementalCache_getPackagePartData(target: TargetId, partInternalName: String): JvmPackagePartProto? = incrementalCompilationComponents!!.getIncrementalCache(target).getPackagePartData(partInternalName)
|
||||
|
||||
override fun incrementalCache_getModuleMappingData(target: TargetId): ByteArray? = incrementalCompilationComponents!!.getIncrementalCache(target).getModuleMappingData()
|
||||
|
||||
+1
-4
@@ -48,9 +48,6 @@ interface CompilerCallbackServicesFacade : Remote {
|
||||
@Throws(RemoteException::class)
|
||||
fun incrementalCache_getObsoleteMultifileClassFacades(target: TargetId): Collection<String>
|
||||
|
||||
@Throws(RemoteException::class)
|
||||
fun incrementalCache_getMultifileFacade(target: TargetId, partInternalName: String): String?
|
||||
|
||||
@Throws(RemoteException::class)
|
||||
fun incrementalCache_getPackagePartData(target: TargetId, partInternalName: String): JvmPackagePartProto?
|
||||
|
||||
@@ -91,4 +88,4 @@ class RmiFriendlyCompilationCanceledException : Exception(), Serializable {
|
||||
companion object {
|
||||
private val serialVersionUID: Long = 8228357578L // just a random number, but should never be changed to avoid deserialization problems
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,8 +33,6 @@ class RemoteIncrementalCacheClient(val facade: CompilerCallbackServicesFacade, v
|
||||
|
||||
override fun getPackagePartData(partInternalName: String): JvmPackagePartProto? = profiler.withMeasure(this) { facade.incrementalCache_getPackagePartData(target, partInternalName) }
|
||||
|
||||
override fun getMultifileFacade(partInternalName: String): String? = profiler.withMeasure(this) { facade.incrementalCache_getMultifileFacade(target, partInternalName) }
|
||||
|
||||
override fun getModuleMappingData(): ByteArray? = profiler.withMeasure(this) { facade.incrementalCache_getModuleMappingData(target) }
|
||||
|
||||
override fun registerInline(fromPath: String, jvmSignature: String, toPath: String) {
|
||||
|
||||
-2
@@ -27,8 +27,6 @@ interface IncrementalCache {
|
||||
|
||||
fun getStableMultifileFacadeParts(facadeInternalName: String): Collection<String>?
|
||||
|
||||
fun getMultifileFacade(partInternalName: String): String?
|
||||
|
||||
fun getPackagePartData(partInternalName: String): JvmPackagePartProto?
|
||||
|
||||
fun getModuleMappingData(): ByteArray?
|
||||
|
||||
+4
-10
@@ -22,7 +22,6 @@ import com.intellij.openapi.vfs.StandardFileSystems
|
||||
import com.intellij.openapi.vfs.VfsUtilCore
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.load.java.lazy.descriptors.LazyJavaPackageFragment
|
||||
import org.jetbrains.kotlin.load.kotlin.incremental.IncrementalPackageFragmentProvider
|
||||
import org.jetbrains.kotlin.modules.Module
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedCallableMemberDescriptor
|
||||
@@ -40,16 +39,11 @@ interface ModuleVisibilityManager {
|
||||
}
|
||||
}
|
||||
|
||||
val DeclarationDescriptor.isFromIncrementalPackageFragment: Boolean
|
||||
get() =
|
||||
DescriptorUtils.getParentOfType(this, PackageFragmentDescriptor::class.java, false) is IncrementalPackageFragmentProvider.IncrementalPackageFragment
|
||||
|
||||
fun isContainedByCompiledPartOfOurModule(descriptor: DeclarationDescriptor, outDirectory: File?): Boolean {
|
||||
if (outDirectory == null) return false
|
||||
|
||||
val packageFragment = DescriptorUtils.getParentOfType(descriptor, PackageFragmentDescriptor::class.java, false)
|
||||
|
||||
if (packageFragment is IncrementalPackageFragmentProvider.IncrementalPackageFragment) return true
|
||||
|
||||
if (outDirectory == null || packageFragment !is LazyJavaPackageFragment) return false
|
||||
if (packageFragment !is LazyJavaPackageFragment) return false
|
||||
|
||||
val source = getSourceElement(descriptor)
|
||||
|
||||
@@ -87,4 +81,4 @@ fun getSourceElement(descriptor: DeclarationDescriptor): SourceElement =
|
||||
}
|
||||
|
||||
private val DeclarationDescriptor.toSourceElement: SourceElement
|
||||
get() = if (this is DeclarationDescriptorWithSource) source else SourceElement.NO_SOURCE
|
||||
get() = if (this is DeclarationDescriptorWithSource) source else SourceElement.NO_SOURCE
|
||||
|
||||
+5
-4
@@ -18,7 +18,9 @@ package org.jetbrains.kotlin.annotation
|
||||
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.vfs.StandardFileSystems
|
||||
import com.intellij.psi.*
|
||||
import com.intellij.psi.JavaPsiFacade
|
||||
import com.intellij.psi.PsiJavaFile
|
||||
import com.intellij.psi.PsiManager
|
||||
import com.intellij.psi.impl.PsiModificationTrackerImpl
|
||||
import com.intellij.psi.search.GlobalSearchScope
|
||||
import org.jetbrains.kotlin.analyzer.AnalysisResult
|
||||
@@ -34,7 +36,6 @@ import org.jetbrains.kotlin.fileClasses.NoResolveFileClassesProvider
|
||||
import org.jetbrains.kotlin.incremental.components.SourceRetentionAnnotationHandler
|
||||
import org.jetbrains.kotlin.java.model.elements.JeTypeElement
|
||||
import org.jetbrains.kotlin.load.java.JvmAbi
|
||||
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCompilationComponents
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.resolve.BindingTrace
|
||||
import org.jetbrains.kotlin.resolve.jvm.extensions.AnalysisCompletedHandlerExtension
|
||||
@@ -161,7 +162,7 @@ abstract class AbstractAnnotationProcessingExtension(
|
||||
|
||||
private fun KotlinProcessingEnvironment.createTypeMapper(): KotlinTypeMapper {
|
||||
return KotlinTypeMapper(bindingContext, ClassBuilderMode.full(false), NoResolveFileClassesProvider,
|
||||
null, IncompatibleClassTracker.DoNothing, JvmAbi.DEFAULT_MODULE_NAME, false)
|
||||
IncompatibleClassTracker.DoNothing, JvmAbi.DEFAULT_MODULE_NAME, false)
|
||||
}
|
||||
|
||||
private fun KotlinProcessingEnvironment.doAnnotationProcessing(files: Collection<KtFile>): ProcessingResult {
|
||||
@@ -319,4 +320,4 @@ abstract class AbstractAnnotationProcessingExtension(
|
||||
protected abstract fun loadAnnotationProcessors(): List<Processor>
|
||||
}
|
||||
|
||||
private class ProcessingResult(val errorCount: Int, val warningCount: Int, val wasAnythingGenerated: Boolean)
|
||||
private class ProcessingResult(val errorCount: Int, val warningCount: Int, val wasAnythingGenerated: Boolean)
|
||||
|
||||
@@ -75,7 +75,7 @@ class KotlinUClass(
|
||||
|
||||
override val internalName by lz {
|
||||
val descriptor = resolveToDescriptor() ?: return@lz null
|
||||
val typeMapper = KotlinTypeMapper(BindingContext.EMPTY, ClassBuilderMode.LIGHT_CLASSES, NoResolveFileClassesProvider, null,
|
||||
val typeMapper = KotlinTypeMapper(BindingContext.EMPTY, ClassBuilderMode.LIGHT_CLASSES, NoResolveFileClassesProvider,
|
||||
IncompatibleClassTracker.DoNothing, JvmAbi.DEFAULT_MODULE_NAME, false)
|
||||
typeMapper.mapClass(descriptor).internalName
|
||||
}
|
||||
@@ -130,4 +130,4 @@ class KotlinUClass(
|
||||
val bindingContext = psi.analyze(BodyResolveMode.PARTIAL)
|
||||
return bindingContext[BindingContext.DECLARATION_TO_DESCRIPTOR, psi] as? ClassDescriptor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ abstract class KotlinAbstractUFunction : KotlinAbstractUElement(), UFunction, Ps
|
||||
return@lz null
|
||||
}
|
||||
|
||||
val typeMapper = KotlinTypeMapper(BindingContext.EMPTY, ClassBuilderMode.LIGHT_CLASSES, NoResolveFileClassesProvider, null,
|
||||
val typeMapper = KotlinTypeMapper(BindingContext.EMPTY, ClassBuilderMode.LIGHT_CLASSES, NoResolveFileClassesProvider,
|
||||
IncompatibleClassTracker.DoNothing, JvmAbi.DEFAULT_MODULE_NAME, false)
|
||||
typeMapper.mapAsmMethod(descriptor).descriptor
|
||||
}
|
||||
@@ -260,4 +260,4 @@ open class KotlinObjectLiteralConstructorUFunction(
|
||||
get() = parent.visibility
|
||||
|
||||
override fun getSuperFunctions(context: UastContext) = emptyList<UFunction>()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user