Eliminate a set of warnings, mostly nullability ones
This commit is contained in:
committed by
Mikhail Glukhikh
parent
82fc221470
commit
3623f581b8
-2
@@ -63,10 +63,8 @@ class GenericReplCompilingEvaluator(val compiler: ReplCompiler,
|
|||||||
is ReplEvalResult.ValueResult,
|
is ReplEvalResult.ValueResult,
|
||||||
is ReplEvalResult.UnitResult ->
|
is ReplEvalResult.UnitResult ->
|
||||||
result
|
result
|
||||||
else -> throw IllegalStateException("Unknown evaluator result type $compiled")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else -> throw IllegalStateException("Unknown compiler result type $compiled")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -325,7 +325,7 @@ object KotlinCompilerClient {
|
|||||||
if (err != null) {
|
if (err != null) {
|
||||||
reportingTargets.report(DaemonReportCategory.INFO,
|
reportingTargets.report(DaemonReportCategory.INFO,
|
||||||
(if (attempts >= DAEMON_CONNECT_CYCLE_ATTEMPTS || !autostart) "no more retries on: " else "retrying($attempts) on: ")
|
(if (attempts >= DAEMON_CONNECT_CYCLE_ATTEMPTS || !autostart) "no more retries on: " else "retrying($attempts) on: ")
|
||||||
+ err?.toString())
|
+ err.toString())
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attempts++ > DAEMON_CONNECT_CYCLE_ATTEMPTS || !autostart) {
|
if (attempts++ > DAEMON_CONNECT_CYCLE_ATTEMPTS || !autostart) {
|
||||||
|
|||||||
+1
-2
@@ -51,8 +51,7 @@ class ExternalFunChecker : SimpleDeclarationChecker {
|
|||||||
if (DescriptorUtils.isInterface(descriptor.containingDeclaration)) {
|
if (DescriptorUtils.isInterface(descriptor.containingDeclaration)) {
|
||||||
diagnosticHolder.report(ErrorsJvm.EXTERNAL_DECLARATION_IN_INTERFACE.on(declaration))
|
diagnosticHolder.report(ErrorsJvm.EXTERNAL_DECLARATION_IN_INTERFACE.on(declaration))
|
||||||
}
|
}
|
||||||
else if (descriptor is CallableMemberDescriptor &&
|
else if (descriptor.modality == Modality.ABSTRACT) {
|
||||||
descriptor.modality == Modality.ABSTRACT) {
|
|
||||||
if (declaration is KtPropertyAccessor) {
|
if (declaration is KtPropertyAccessor) {
|
||||||
diagnosticHolder.report(ErrorsJvm.EXTERNAL_DECLARATION_CANNOT_BE_ABSTRACT.on(declaration.property))
|
diagnosticHolder.report(ErrorsJvm.EXTERNAL_DECLARATION_CANNOT_BE_ABSTRACT.on(declaration.property))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ abstract class KtCodeFragment(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun getContextContainingFile(): KtFile? {
|
fun getContextContainingFile(): KtFile? {
|
||||||
return (getOriginalContext() as? KtElement)?.containingKtFile
|
return getOriginalContext()?.containingKtFile
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getOriginalContext(): KtElement? {
|
fun getOriginalContext(): KtElement? {
|
||||||
|
|||||||
+1
-1
@@ -40,7 +40,7 @@ class KtEnumEntrySuperclassReferenceExpression :
|
|||||||
get() = calcReferencedElement()!!
|
get() = calcReferencedElement()!!
|
||||||
|
|
||||||
private fun calcReferencedElement(): KtClass? {
|
private fun calcReferencedElement(): KtClass? {
|
||||||
val owner = this.getStrictParentOfType<KtEnumEntry>() as? KtEnumEntry
|
val owner = this.getStrictParentOfType<KtEnumEntry>()
|
||||||
return owner?.parent?.parent as? KtClass
|
return owner?.parent?.parent as? KtClass
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ object ConstModifierChecker : SimpleDeclarationChecker {
|
|||||||
return Errors.CONST_VAL_WITH_DELEGATE.on(declaration.delegate!!).nonApplicable()
|
return Errors.CONST_VAL_WITH_DELEGATE.on(declaration.delegate!!).nonApplicable()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (descriptor is PropertyDescriptor && !descriptor.getter!!.isDefault) {
|
if (!descriptor.getter!!.isDefault) {
|
||||||
return Errors.CONST_VAL_WITH_GETTER.on(declaration.getter!!).nonApplicable()
|
return Errors.CONST_VAL_WITH_GETTER.on(declaration.getter!!).nonApplicable()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ object LabelResolver {
|
|||||||
|
|
||||||
if (parent is KtValueArgument) {
|
if (parent is KtValueArgument) {
|
||||||
// f ({}) or f(p = {}) or f (fun () {})
|
// f ({}) or f(p = {}) or f (fun () {})
|
||||||
|
// NB: parent of KtElement is really nullable!!!
|
||||||
val argList = parent.parent ?: return null
|
val argList = parent.parent ?: return null
|
||||||
val call = argList.parent
|
val call = argList.parent
|
||||||
if (call is KtCallExpression) {
|
if (call is KtCallExpression) {
|
||||||
|
|||||||
-1
@@ -272,7 +272,6 @@ class IncrementalJvmCompilerRunner(
|
|||||||
// there is no point in updating annotation file since all files will be compiled anyway
|
// there is no point in updating annotation file since all files will be compiled anyway
|
||||||
kaptAnnotationsFileUpdater = null
|
kaptAnnotationsFileUpdater = null
|
||||||
}
|
}
|
||||||
else -> throw IllegalStateException("Unknown CompilationMode ${compilationMode::class.java}")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val currentBuildInfo = BuildInfo(startTS = System.currentTimeMillis())
|
val currentBuildInfo = BuildInfo(startTS = System.currentTimeMillis())
|
||||||
|
|||||||
+1
-1
@@ -195,7 +195,7 @@ private fun Scope.createTemporaryVariable(symbol: IrVariableSymbol, initializer:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun getDefaultParameterExpressionBody(irFunction: IrFunction, valueParameter: ValueParameterDescriptor):IrExpressionBody {
|
private fun getDefaultParameterExpressionBody(irFunction: IrFunction, valueParameter: ValueParameterDescriptor):IrExpressionBody {
|
||||||
return irFunction.getDefault(valueParameter) as? IrExpressionBody ?: TODO("FIXME!!!")
|
return irFunction.getDefault(valueParameter) ?: TODO("FIXME!!!")
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun maskParameterDescriptor(function: IrFunction, number: Int) =
|
private fun maskParameterDescriptor(function: IrFunction, number: Int) =
|
||||||
|
|||||||
+2
-3
@@ -23,7 +23,6 @@ import org.jetbrains.kotlin.codegen.AsmUtil.comparisonOperandType
|
|||||||
import org.jetbrains.kotlin.codegen.AsmUtil.isPrimitive
|
import org.jetbrains.kotlin.codegen.AsmUtil.isPrimitive
|
||||||
import org.jetbrains.kotlin.codegen.OwnerKind
|
import org.jetbrains.kotlin.codegen.OwnerKind
|
||||||
import org.jetbrains.kotlin.codegen.StackValue
|
import org.jetbrains.kotlin.codegen.StackValue
|
||||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
|
||||||
import org.jetbrains.kotlin.ir.expressions.IrCall
|
import org.jetbrains.kotlin.ir.expressions.IrCall
|
||||||
import org.jetbrains.kotlin.ir.expressions.IrMemberAccessExpression
|
import org.jetbrains.kotlin.ir.expressions.IrMemberAccessExpression
|
||||||
import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin
|
import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin
|
||||||
@@ -68,10 +67,10 @@ class IrCompareTo : IntrinsicMethod() {
|
|||||||
val rightType = argTypes[1]
|
val rightType = argTypes[1]
|
||||||
val parameterType = comparisonOperandType(leftType, rightType)
|
val parameterType = comparisonOperandType(leftType, rightType)
|
||||||
|
|
||||||
val newSignature = context.state.typeMapper.mapSignatureSkipGeneric(compareCall.descriptor as FunctionDescriptor, OwnerKind.IMPLEMENTATION)
|
val newSignature = context.state.typeMapper.mapSignatureSkipGeneric(compareCall.descriptor, OwnerKind.IMPLEMENTATION)
|
||||||
return object : IrIntrinsicFunction(compareCall, newSignature, context, listOf(parameterType, parameterType)) {
|
return object : IrIntrinsicFunction(compareCall, newSignature, context, listOf(parameterType, parameterType)) {
|
||||||
override fun invoke(v: InstructionAdapter, codegen: ExpressionCodegen, data: BlockInfo): StackValue {
|
override fun invoke(v: InstructionAdapter, codegen: ExpressionCodegen, data: BlockInfo): StackValue {
|
||||||
val isPrimitiveIntrinsic = codegen.intrinsics.intrinsics.getIntrinsic(compareCall.descriptor as FunctionDescriptor) != null
|
val isPrimitiveIntrinsic = codegen.intrinsics.intrinsics.getIntrinsic(compareCall.descriptor) != null
|
||||||
val operationType: Type
|
val operationType: Type
|
||||||
val leftValue: StackValue
|
val leftValue: StackValue
|
||||||
val rightValue: StackValue
|
val rightValue: StackValue
|
||||||
|
|||||||
+1
-1
@@ -81,7 +81,7 @@ class ContextAnnotator(val state: GenerationState) : ClassLowerWithContext() {
|
|||||||
|
|
||||||
override fun lowerBefore(irClass: IrClass, data: IrClassContext) {
|
override fun lowerBefore(irClass: IrClass, data: IrClassContext) {
|
||||||
val descriptor = irClass.descriptor
|
val descriptor = irClass.descriptor
|
||||||
val newContext: CodegenContext<*> = if (descriptor is FileClassDescriptor || descriptor !is ClassDescriptor) {
|
val newContext: CodegenContext<*> = if (descriptor is FileClassDescriptor) {
|
||||||
StubCodegenContext(descriptor, data.parent?.codegenContext, data)
|
StubCodegenContext(descriptor, data.parent?.codegenContext, data)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -59,6 +59,6 @@ class IrFieldImpl(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun <D> transformChildren(transformer: IrElementTransformer<D>, data: D) {
|
override fun <D> transformChildren(transformer: IrElementTransformer<D>, data: D) {
|
||||||
initializer = initializer?.transform(transformer, data) as? IrExpressionBody
|
initializer = initializer?.transform(transformer, data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-2
@@ -114,7 +114,7 @@ class KtLightMethodImpl private constructor(
|
|||||||
if (calculatingReturnType.get() == true) {
|
if (calculatingReturnType.get() == true) {
|
||||||
return KotlinJavaPsiFacade.getInstance(project).emptyModifierList
|
return KotlinJavaPsiFacade.getInstance(project).emptyModifierList
|
||||||
}
|
}
|
||||||
return super.getModifierList()!!
|
return super.getModifierList()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getParameterList() = paramsList
|
override fun getParameterList() = paramsList
|
||||||
@@ -235,7 +235,7 @@ fun KtLightMethod.isTraitFakeOverride(): Boolean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val parentOfMethodOrigin = PsiTreeUtil.getParentOfType(methodOrigin, KtClassOrObject::class.java)
|
val parentOfMethodOrigin = PsiTreeUtil.getParentOfType(methodOrigin, KtClassOrObject::class.java)
|
||||||
val thisClassDeclaration = (this.containingClass as KtLightClass).kotlinOrigin
|
val thisClassDeclaration = this.containingClass.kotlinOrigin
|
||||||
|
|
||||||
// Method was generated from declaration in some other trait
|
// Method was generated from declaration in some other trait
|
||||||
return (parentOfMethodOrigin != null && thisClassDeclaration !== parentOfMethodOrigin && KtPsiUtil.isTrait(parentOfMethodOrigin))
|
return (parentOfMethodOrigin != null && thisClassDeclaration !== parentOfMethodOrigin && KtPsiUtil.isTrait(parentOfMethodOrigin))
|
||||||
|
|||||||
@@ -670,7 +670,7 @@ class CompilerDaemonTest : KotlinIntegrationTestBase() {
|
|||||||
|
|
||||||
fun testDaemonReplLocalEvalNoParams() {
|
fun testDaemonReplLocalEvalNoParams() {
|
||||||
withDaemon { daemon ->
|
withDaemon { daemon ->
|
||||||
val repl = KotlinRemoteReplCompilerClient(daemon!!, null, CompileService.TargetPlatform.JVM,
|
val repl = KotlinRemoteReplCompilerClient(daemon, null, CompileService.TargetPlatform.JVM,
|
||||||
emptyArray(),
|
emptyArray(),
|
||||||
TestMessageCollector(),
|
TestMessageCollector(),
|
||||||
classpathFromClassloader(),
|
classpathFromClassloader(),
|
||||||
@@ -685,7 +685,7 @@ class CompilerDaemonTest : KotlinIntegrationTestBase() {
|
|||||||
|
|
||||||
fun testDaemonReplLocalEvalStandardTemplate() {
|
fun testDaemonReplLocalEvalStandardTemplate() {
|
||||||
withDaemon { daemon ->
|
withDaemon { daemon ->
|
||||||
val repl = KotlinRemoteReplCompilerClient(daemon!!, null, CompileService.TargetPlatform.JVM, emptyArray(),
|
val repl = KotlinRemoteReplCompilerClient(daemon, null, CompileService.TargetPlatform.JVM, emptyArray(),
|
||||||
TestMessageCollector(),
|
TestMessageCollector(),
|
||||||
classpathFromClassloader(),
|
classpathFromClassloader(),
|
||||||
"kotlin.script.templates.standard.ScriptTemplateWithArgs")
|
"kotlin.script.templates.standard.ScriptTemplateWithArgs")
|
||||||
|
|||||||
@@ -278,8 +278,6 @@ fun CallTypeAndReceiver<*, *>.receiverTypesWithIndex(
|
|||||||
is CallTypeAndReceiver.ANNOTATION,
|
is CallTypeAndReceiver.ANNOTATION,
|
||||||
is CallTypeAndReceiver.UNKNOWN ->
|
is CallTypeAndReceiver.UNKNOWN ->
|
||||||
return null
|
return null
|
||||||
|
|
||||||
else -> throw RuntimeException() //TODO: see KT-9394
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val resolutionScope = contextElement.getResolutionScope(bindingContext, resolutionFacade)
|
val resolutionScope = contextElement.getResolutionScope(bindingContext, resolutionFacade)
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ fun ClassDescriptor.findCallableMemberBySignature(
|
|||||||
if (it.containingDeclaration != this) return@firstOrNull false
|
if (it.containingDeclaration != this) return@firstOrNull false
|
||||||
val overridability = OverridingUtil.DEFAULT.isOverridableBy(it as CallableDescriptor, signature, null).result
|
val overridability = OverridingUtil.DEFAULT.isOverridableBy(it as CallableDescriptor, signature, null).result
|
||||||
overridability == OVERRIDABLE || (allowOverridabilityConflicts && overridability == CONFLICT)
|
overridability == OVERRIDABLE || (allowOverridabilityConflicts && overridability == CONFLICT)
|
||||||
} as? CallableMemberDescriptor
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun TypeConstructor.supertypesWithAny(): Collection<KotlinType> {
|
fun TypeConstructor.supertypesWithAny(): Collection<KotlinType> {
|
||||||
|
|||||||
+1
-1
@@ -128,7 +128,7 @@ private fun JavaDescriptorResolver.resolveConstructor(constructor: JavaConstruct
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun JavaDescriptorResolver.resolveField(field: JavaField): PropertyDescriptor? {
|
private fun JavaDescriptorResolver.resolveField(field: JavaField): PropertyDescriptor? {
|
||||||
return getContainingScope(field)?.getContributedVariables(field.name, NoLookupLocation.FROM_IDE)?.findByJavaElement(field) as? PropertyDescriptor
|
return getContainingScope(field)?.getContributedVariables(field.name, NoLookupLocation.FROM_IDE)?.findByJavaElement(field)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun JavaDescriptorResolver.getContainingScope(member: JavaMember): MemberScope? {
|
private fun JavaDescriptorResolver.getContainingScope(member: JavaMember): MemberScope? {
|
||||||
|
|||||||
+1
-1
@@ -64,7 +64,7 @@ abstract class BaseKotlinCompilerSettings<T : Freezable> protected constructor()
|
|||||||
override fun getState() = XmlSerializer.serialize(_settings, SKIP_DEFAULT_VALUES)
|
override fun getState() = XmlSerializer.serialize(_settings, SKIP_DEFAULT_VALUES)
|
||||||
|
|
||||||
override fun loadState(state: Element) {
|
override fun loadState(state: Element) {
|
||||||
_settings = XmlSerializer.deserialize(state, _settings.javaClass) ?: createSettings()
|
_settings = XmlSerializer.deserialize(state, _settings.javaClass)
|
||||||
}
|
}
|
||||||
|
|
||||||
public override fun clone(): Any = super.clone()
|
public override fun clone(): Any = super.clone()
|
||||||
|
|||||||
+1
-1
@@ -139,7 +139,7 @@ class ExpressionsOfTypeProcessor(
|
|||||||
if (runReadAction { searchScope is GlobalSearchScope && !FileTypeIndex.containsFileOfType(KotlinFileType.INSTANCE, searchScope) }) return
|
if (runReadAction { searchScope is GlobalSearchScope && !FileTypeIndex.containsFileOfType(KotlinFileType.INSTANCE, searchScope) }) return
|
||||||
|
|
||||||
// for class from library always use plain search because we cannot search usages in compiled code (we could though)
|
// for class from library always use plain search because we cannot search usages in compiled code (we could though)
|
||||||
if (classToSearch == null || !runReadAction { classToSearch.isValid && ProjectRootsUtil.isInProjectSource(classToSearch) }) {
|
if (!runReadAction { classToSearch.isValid && ProjectRootsUtil.isInProjectSource(classToSearch) }) {
|
||||||
possibleMatchesInScopeHandler(searchScope)
|
possibleMatchesInScopeHandler(searchScope)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -254,14 +254,14 @@ object KeywordCompletion {
|
|||||||
is KtDeclarationWithInitializer -> {
|
is KtDeclarationWithInitializer -> {
|
||||||
val initializer = parent.initializer
|
val initializer = parent.initializer
|
||||||
if (prevParent == initializer) {
|
if (prevParent == initializer) {
|
||||||
return buildFilterWithContext("val v = ", initializer!!, position)
|
return buildFilterWithContext("val v = ", initializer, position)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
is KtParameter -> {
|
is KtParameter -> {
|
||||||
val default = parent.defaultValue
|
val default = parent.defaultValue
|
||||||
if (prevParent == default) {
|
if (prevParent == default) {
|
||||||
return buildFilterWithContext("val v = ", default!!, position)
|
return buildFilterWithContext("val v = ", default, position)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -568,7 +568,6 @@ class ExpectedInfos(
|
|||||||
}
|
}
|
||||||
|
|
||||||
is PropertyGetterDescriptor -> {
|
is PropertyGetterDescriptor -> {
|
||||||
if (descriptor !is PropertyGetterDescriptor) return null
|
|
||||||
val property = descriptor.correspondingProperty
|
val property = descriptor.correspondingProperty
|
||||||
ExpectedInfo.createForReturnValue(returnTypeToUse(property, hasExplicitReturnType), property)
|
ExpectedInfo.createForReturnValue(returnTypeToUse(property, hasExplicitReturnType), property)
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -40,7 +40,7 @@ val KOTLIN_PLUGIN_CLASSPATH_MARKER = "${KotlinWithGradleConfigurator.GROUP_ID}:$
|
|||||||
|
|
||||||
abstract class KotlinGradleInspectionVisitor : BaseInspectionVisitor() {
|
abstract class KotlinGradleInspectionVisitor : BaseInspectionVisitor() {
|
||||||
override fun visitFile(file: GroovyFileBase) {
|
override fun visitFile(file: GroovyFileBase) {
|
||||||
if (file == null || !FileUtilRt.extensionEquals(file.name, GradleConstants.EXTENSION)) return
|
if (!FileUtilRt.extensionEquals(file.name, GradleConstants.EXTENSION)) return
|
||||||
|
|
||||||
val fileIndex = ProjectRootManager.getInstance(file.project).fileIndex
|
val fileIndex = ProjectRootManager.getInstance(file.project).fileIndex
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -30,7 +30,7 @@ object KotlinStdJSProjectDescriptor : KotlinLightProjectDescriptor() {
|
|||||||
override fun getSdk(): Sdk? = null
|
override fun getSdk(): Sdk? = null
|
||||||
|
|
||||||
override fun configureModule(module: Module, model: ModifiableRootModel) {
|
override fun configureModule(module: Module, model: ModifiableRootModel) {
|
||||||
val configuration = JSLibraryStdDescription(module.project).createNewLibraryForTests() ?: error("Configuration should exist")
|
val configuration = JSLibraryStdDescription(module.project).createNewLibraryForTests()
|
||||||
|
|
||||||
val editor = NewLibraryEditor(configuration.libraryType, configuration.properties)
|
val editor = NewLibraryEditor(configuration.libraryType, configuration.properties)
|
||||||
configuration.addRoots(editor)
|
configuration.addRoots(editor)
|
||||||
|
|||||||
@@ -69,7 +69,6 @@ fun Module.configureAs(kind: ModuleKind) {
|
|||||||
this.configureAs(KotlinStdJSProjectDescriptor)
|
this.configureAs(KotlinStdJSProjectDescriptor)
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> throw IllegalArgumentException("Unknown kind=$kind")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -62,7 +62,7 @@ class ConvertFunctionTypeReceiverToParameterIntention : SelfTargetingRangeIntent
|
|||||||
|
|
||||||
class FunctionDefinitionInfo(element: KtFunction) : AbstractProcessableUsageInfo<KtFunction, ConversionData>(element) {
|
class FunctionDefinitionInfo(element: KtFunction) : AbstractProcessableUsageInfo<KtFunction, ConversionData>(element) {
|
||||||
override fun process(data: ConversionData, elementsToShorten: MutableList<KtElement>) {
|
override fun process(data: ConversionData, elementsToShorten: MutableList<KtElement>) {
|
||||||
val function = element as? KtFunction ?: return
|
val function = element ?: return
|
||||||
val functionParameter = function.valueParameters.getOrNull(data.functionParameterIndex) ?: return
|
val functionParameter = function.valueParameters.getOrNull(data.functionParameterIndex) ?: return
|
||||||
val functionType = functionParameter.typeReference?.typeElement as? KtFunctionType ?: return
|
val functionType = functionParameter.typeReference?.typeElement as? KtFunctionType ?: return
|
||||||
val functionTypeParameterList = functionType.parameterList ?: return
|
val functionTypeParameterList = functionType.parameterList ?: return
|
||||||
|
|||||||
+1
-1
@@ -196,7 +196,7 @@ class DeprecatedCallableAddReplaceWithIntention : SelfTargetingRangeIntention<Kt
|
|||||||
val body = bodyExpression ?: return null
|
val body = bodyExpression ?: return null
|
||||||
if (!hasBlockBody()) return body
|
if (!hasBlockBody()) return body
|
||||||
val block = body as? KtBlockExpression ?: return null
|
val block = body as? KtBlockExpression ?: return null
|
||||||
val statement = block.statements.singleOrNull() as? KtExpression ?: return null
|
val statement = block.statements.singleOrNull() ?: return null
|
||||||
val returnsUnit = (analyze()[BindingContext.DECLARATION_TO_DESCRIPTOR, this] as? FunctionDescriptor)?.returnType?.isUnit() ?: return null
|
val returnsUnit = (analyze()[BindingContext.DECLARATION_TO_DESCRIPTOR, this] as? FunctionDescriptor)?.returnType?.isUnit() ?: return null
|
||||||
return when (statement) {
|
return when (statement) {
|
||||||
is KtReturnExpression -> statement.returnedExpression
|
is KtReturnExpression -> statement.returnedExpression
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ class ChangeSuspendInHierarchyFix(
|
|||||||
|
|
||||||
return DFS.dfs(
|
return DFS.dfs(
|
||||||
listOf(this),
|
listOf(this),
|
||||||
{ (it as? FunctionDescriptor)?.getOverridables() ?: emptyList() },
|
{ it?.getOverridables() ?: emptyList() },
|
||||||
object : DFS.CollectingNodeHandler<FunctionDescriptor, FunctionDescriptor, ArrayList<FunctionDescriptor>>(ArrayList()) {
|
object : DFS.CollectingNodeHandler<FunctionDescriptor, FunctionDescriptor, ArrayList<FunctionDescriptor>>(ArrayList()) {
|
||||||
override fun afterChildren(current: FunctionDescriptor) {
|
override fun afterChildren(current: FunctionDescriptor) {
|
||||||
if (current.getOverridables().isEmpty()) {
|
if (current.getOverridables().isEmpty()) {
|
||||||
@@ -173,7 +173,7 @@ class ChangeSuspendInHierarchyFix(
|
|||||||
containingClassDescriptor.defaultType,
|
containingClassDescriptor.defaultType,
|
||||||
currentClassDescriptor.defaultType
|
currentClassDescriptor.defaultType
|
||||||
) ?: return@filter false
|
) ?: return@filter false
|
||||||
val signatureInCurrentClass = it.substitute(substitutor) as? FunctionDescriptor ?: return@filter false
|
val signatureInCurrentClass = it.substitute(substitutor) ?: return@filter false
|
||||||
OverridingUtil.DEFAULT.isOverridableBy(signatureInCurrentClass, currentDescriptor, null).result ==
|
OverridingUtil.DEFAULT.isOverridableBy(signatureInCurrentClass, currentDescriptor, null).result ==
|
||||||
OverridingUtil.OverrideCompatibilityInfo.Result.CONFLICT
|
OverridingUtil.OverrideCompatibilityInfo.Result.CONFLICT
|
||||||
}
|
}
|
||||||
|
|||||||
-2
@@ -586,7 +586,6 @@ class CallableBuilder(val config: CallableBuilderConfiguration) {
|
|||||||
if (returnTypeRefs.isNotEmpty()) {
|
if (returnTypeRefs.isNotEmpty()) {
|
||||||
val returnType = typeCandidates[callableInfo.returnTypeInfo]!!.getTypeByRenderedType(
|
val returnType = typeCandidates[callableInfo.returnTypeInfo]!!.getTypeByRenderedType(
|
||||||
returnTypeRefs.map { it.text }
|
returnTypeRefs.map { it.text }
|
||||||
?: throw AssertionError("Expression for return type shouldn't be empty: declaration = ${declaration.text}")
|
|
||||||
)
|
)
|
||||||
if (returnType != null) {
|
if (returnType != null) {
|
||||||
// user selected a given type
|
// user selected a given type
|
||||||
@@ -603,7 +602,6 @@ class CallableBuilder(val config: CallableBuilderConfiguration) {
|
|||||||
if (parameterTypeRef != null) {
|
if (parameterTypeRef != null) {
|
||||||
val parameterType = parameterTypeExpressions[i].typeCandidates.getTypeByRenderedType(
|
val parameterType = parameterTypeExpressions[i].typeCandidates.getTypeByRenderedType(
|
||||||
listOf(parameterTypeRef.text)
|
listOf(parameterTypeRef.text)
|
||||||
?: throw AssertionError("Expression for parameter type shouldn't be empty: declaration = ${declaration.text}")
|
|
||||||
)
|
)
|
||||||
if (parameterType != null) {
|
if (parameterType != null) {
|
||||||
replaceWithLongerName(listOf(parameterTypeRef), parameterType)
|
replaceWithLongerName(listOf(parameterTypeRef), parameterType)
|
||||||
|
|||||||
-1
@@ -102,7 +102,6 @@ abstract class TypeInfo(val variance: Variance) {
|
|||||||
val classDeclaration = receiverClassDescriptor?.let { DescriptorToSourceUtils.getSourceFromDescriptor(it) }
|
val classDeclaration = receiverClassDescriptor?.let { DescriptorToSourceUtils.getSourceFromDescriptor(it) }
|
||||||
if (!config.isExtension && classDeclaration != null) classDeclaration else config.currentFile
|
if (!config.isExtension && classDeclaration != null) classDeclaration else config.currentFile
|
||||||
}
|
}
|
||||||
else -> throw IllegalArgumentException("Unexpected placement: $placement")
|
|
||||||
}
|
}
|
||||||
return when (containingElement) {
|
return when (containingElement) {
|
||||||
is KtClassOrObject -> (containingElement.resolveToDescriptor() as? ClassDescriptorWithResolutionScopes)?.scopeForMemberDeclarationResolution
|
is KtClassOrObject -> (containingElement.resolveToDescriptor() as? ClassDescriptorWithResolutionScopes)?.scopeForMemberDeclarationResolution
|
||||||
|
|||||||
+1
-1
@@ -334,7 +334,7 @@ class KotlinFunctionCallUsage(
|
|||||||
if (receiverValue is ExpressionReceiver && !receiverValue.expression.isValid) {
|
if (receiverValue is ExpressionReceiver && !receiverValue.expression.isValid) {
|
||||||
receiverValue = receiverValue.wrapInvalidated(element)
|
receiverValue = receiverValue.wrapInvalidated(element)
|
||||||
}
|
}
|
||||||
ArgumentInfo(param, index, resolvedArgument, receiverValue as? ReceiverValue)
|
ArgumentInfo(param, index, resolvedArgument, receiverValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
val lastParameterIndex = newParameters.lastIndex
|
val lastParameterIndex = newParameters.lastIndex
|
||||||
|
|||||||
+1
-1
@@ -182,7 +182,7 @@ data class ExtractionData(
|
|||||||
fun getPossibleTypes(expression: KtExpression, resolvedCall: ResolvedCall<*>?, context: BindingContext): Set<KotlinType> {
|
fun getPossibleTypes(expression: KtExpression, resolvedCall: ResolvedCall<*>?, context: BindingContext): Set<KotlinType> {
|
||||||
val dataFlowInfo = context.getDataFlowInfoAfter(expression)
|
val dataFlowInfo = context.getDataFlowInfoAfter(expression)
|
||||||
|
|
||||||
(resolvedCall?.getImplicitReceiverValue() as? ImplicitReceiver)?.let {
|
resolvedCall?.getImplicitReceiverValue()?.let {
|
||||||
return dataFlowInfo.getCollectedTypes(DataFlowValueFactory.createDataFlowValueForStableReceiver(it))
|
return dataFlowInfo.getCollectedTypes(DataFlowValueFactory.createDataFlowValueForStableReceiver(it))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -282,7 +282,7 @@ open class KotlinIntroduceParameterHandler(
|
|||||||
is KtExpression -> matchedElement
|
is KtExpression -> matchedElement
|
||||||
is KtStringTemplateEntryWithExpression -> matchedElement.expression
|
is KtStringTemplateEntryWithExpression -> matchedElement.expression
|
||||||
else -> null
|
else -> null
|
||||||
} as? KtExpression
|
}
|
||||||
matchedExpr?.toRange()
|
matchedExpr?.toRange()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -211,7 +211,7 @@ object KotlinIntroduceVariableHandler : RefactoringActionHandler {
|
|||||||
actualExpression = reference!!
|
actualExpression = reference!!
|
||||||
diff = actualExpression.textRange.startOffset - emptyBody.textRange.startOffset
|
diff = actualExpression.textRange.startOffset - emptyBody.textRange.startOffset
|
||||||
actualExpressionText = actualExpression.text
|
actualExpressionText = actualExpression.text
|
||||||
emptyBody = anchor!!.replace(emptyBody) as KtBlockExpression
|
emptyBody = anchor.replace(emptyBody) as KtBlockExpression
|
||||||
elem = findElementByOffsetAndText(diff, actualExpressionText, emptyBody)
|
elem = findElementByOffsetAndText(diff, actualExpressionText, emptyBody)
|
||||||
if (elem != null) {
|
if (elem != null) {
|
||||||
reference = elem as KtExpression
|
reference = elem as KtExpression
|
||||||
@@ -335,7 +335,7 @@ object KotlinIntroduceVariableHandler : RefactoringActionHandler {
|
|||||||
is KtExpression -> candidate
|
is KtExpression -> candidate
|
||||||
is KtStringTemplateEntryWithExpression -> candidate.expression
|
is KtStringTemplateEntryWithExpression -> candidate.expression
|
||||||
else -> throw AssertionError("Unexpected candidate element: " + candidate.text)
|
else -> throw AssertionError("Unexpected candidate element: " + candidate.text)
|
||||||
} as? KtExpression
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -953,7 +953,7 @@ fun checkSuperMethodsWithPopup(
|
|||||||
.setResizable(false)
|
.setResizable(false)
|
||||||
.setRequestFocus(true)
|
.setRequestFocus(true)
|
||||||
.setItemChoosenCallback {
|
.setItemChoosenCallback {
|
||||||
val value = list.selectedValue as? String ?: return@setItemChoosenCallback
|
val value = list.selectedValue ?: return@setItemChoosenCallback
|
||||||
val chosenElements = if (value == renameBase) deepestSuperMethods + declaration else listOf(declaration)
|
val chosenElements = if (value == renameBase) deepestSuperMethods + declaration else listOf(declaration)
|
||||||
action(chosenElements)
|
action(chosenElements)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,8 +100,6 @@ fun extractClassMembers(
|
|||||||
.mapTo(result) { KotlinMemberInfo(it as KtNamedDeclaration, isCompanionMember = isCompanion) }
|
.mapTo(result) { KotlinMemberInfo(it as KtNamedDeclaration, isCompanionMember = isCompanion) }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aClass !is KtClassOrObject) return emptyList()
|
|
||||||
|
|
||||||
val result = ArrayList<KotlinMemberInfo>()
|
val result = ArrayList<KotlinMemberInfo>()
|
||||||
|
|
||||||
if (collectSuperTypeEntries) {
|
if (collectSuperTypeEntries) {
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ fun invokeMoveFilesOrDirectoriesRefactoring(
|
|||||||
|
|
||||||
project.executeCommand(MoveHandler.REFACTORING_NAME) {
|
project.executeCommand(MoveHandler.REFACTORING_NAME) {
|
||||||
val selectedDir = (if (moveDialog != null) moveDialog.targetDirectory else initialTargetDirectory) ?: return@executeCommand
|
val selectedDir = (if (moveDialog != null) moveDialog.targetDirectory else initialTargetDirectory) ?: return@executeCommand
|
||||||
val updatePackageDirective = (moveDialog as? KotlinAwareMoveFilesOrDirectoriesDialog)?.updatePackageDirective
|
val updatePackageDirective = moveDialog?.updatePackageDirective
|
||||||
|
|
||||||
try {
|
try {
|
||||||
val choice = if (elements.size > 1 || elements[0] is PsiDirectory) intArrayOf(-1) else null
|
val choice = if (elements.size > 1 || elements[0] is PsiDirectory) intArrayOf(-1) else null
|
||||||
|
|||||||
@@ -76,7 +76,6 @@ fun markElements(
|
|||||||
?: resolvedCall.extensionReceiver
|
?: resolvedCall.extensionReceiver
|
||||||
?: resolvedCall.dispatchReceiver
|
?: resolvedCall.dispatchReceiver
|
||||||
?: return
|
?: return
|
||||||
if (receiver !is ReceiverValue) return
|
|
||||||
|
|
||||||
val implicitThis = receiver.type.constructor.declarationDescriptor as? ClassDescriptor ?: return
|
val implicitThis = receiver.type.constructor.declarationDescriptor as? ClassDescriptor ?: return
|
||||||
if (implicitThis.isCompanionObject
|
if (implicitThis.isCompanionObject
|
||||||
|
|||||||
+1
-1
@@ -24,7 +24,7 @@ import org.jetbrains.kotlin.psi.KtSimpleNameExpression
|
|||||||
|
|
||||||
class RenameImportAliasByReferenceHandler : AbstractReferenceSubstitutionRenameHandler(VariableInplaceRenameHandler()) {
|
class RenameImportAliasByReferenceHandler : AbstractReferenceSubstitutionRenameHandler(VariableInplaceRenameHandler()) {
|
||||||
override fun getElementToRename(dataContext: DataContext): PsiElement? {
|
override fun getElementToRename(dataContext: DataContext): PsiElement? {
|
||||||
val refExpr = getReferenceExpression(dataContext) as? KtSimpleNameExpression ?: return null
|
val refExpr = getReferenceExpression(dataContext) ?: return null
|
||||||
return refExpr.mainReference.getImportAlias()
|
return refExpr.mainReference.getImportAlias()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -47,7 +47,7 @@ class KotlinOverridingMethodsWithGenericsSearcher : QueryExecutor<PsiMethod, Ove
|
|||||||
// we do additional search for such methods.
|
// we do additional search for such methods.
|
||||||
if (!callDescriptor.valueParameters.any { it.type.constructor.declarationDescriptor is TypeParameterDescriptor }) return true
|
if (!callDescriptor.valueParameters.any { it.type.constructor.declarationDescriptor is TypeParameterDescriptor }) return true
|
||||||
|
|
||||||
val parentClass = runReadAction { method.containingClass }!!
|
val parentClass = runReadAction { method.containingClass }
|
||||||
|
|
||||||
return ClassInheritorsSearch.search(parentClass, p.scope, true).forEach(Processor { inheritor: PsiClass ->
|
return ClassInheritorsSearch.search(parentClass, p.scope, true).forEach(Processor { inheritor: PsiClass ->
|
||||||
val found = runReadAction {
|
val found = runReadAction {
|
||||||
|
|||||||
@@ -153,13 +153,10 @@ abstract class AbstractConfigureKotlinTest : PlatformTestCase() {
|
|||||||
collector.showNotification()
|
collector.showNotification()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getPathToJar(runtimeState: FileState, jarFromDist: String, jarFromTemp: String): String {
|
private fun getPathToJar(runtimeState: FileState, jarFromDist: String, jarFromTemp: String) = when (runtimeState) {
|
||||||
when (runtimeState) {
|
KotlinWithLibraryConfigurator.FileState.EXISTS -> jarFromDist
|
||||||
KotlinWithLibraryConfigurator.FileState.EXISTS -> return jarFromDist
|
KotlinWithLibraryConfigurator.FileState.COPY -> jarFromTemp
|
||||||
KotlinWithLibraryConfigurator.FileState.COPY -> return jarFromTemp
|
KotlinWithLibraryConfigurator.FileState.DO_NOT_COPY -> jarFromDist
|
||||||
KotlinWithLibraryConfigurator.FileState.DO_NOT_COPY -> return jarFromDist
|
|
||||||
}
|
|
||||||
return jarFromDist
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun configure(module: Module, jarState: FileState, configurator: KotlinProjectConfigurator) {
|
protected fun configure(module: Module, jarState: FileState, configurator: KotlinProjectConfigurator) {
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ class InplaceRenameTest : LightPlatformCodeInsightTestCase() {
|
|||||||
val element = file.findElementForRename<KtNameReferenceExpression>(editor.caretModel.offset)!!
|
val element = file.findElementForRename<KtNameReferenceExpression>(editor.caretModel.offset)!!
|
||||||
assertNotNull(element)
|
assertNotNull(element)
|
||||||
|
|
||||||
val dataContext = SimpleDataContext.getSimpleContext(CommonDataKeys.PSI_ELEMENT.name, element!!,
|
val dataContext = SimpleDataContext.getSimpleContext(CommonDataKeys.PSI_ELEMENT.name, element,
|
||||||
getCurrentEditorDataContext())
|
getCurrentEditorDataContext())
|
||||||
val handler = RenameKotlinImplicitLambdaParameter()
|
val handler = RenameKotlinImplicitLambdaParameter()
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -157,7 +157,7 @@ class KotlinChangeSignatureTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
val message = when {
|
val message = when {
|
||||||
e is BaseRefactoringProcessor.ConflictsInTestsException -> StringUtil.join(e.messages.sorted(), "\n")
|
e is BaseRefactoringProcessor.ConflictsInTestsException -> StringUtil.join(e.messages.sorted(), "\n")
|
||||||
e is CommonRefactoringUtil.RefactoringErrorHintException -> e.message
|
e is CommonRefactoringUtil.RefactoringErrorHintException -> e.message
|
||||||
e is RuntimeException && e.message!!.startsWith("Refactoring cannot be performed") -> e.message
|
e.message!!.startsWith("Refactoring cannot be performed") -> e.message
|
||||||
else -> throw e
|
else -> throw e
|
||||||
}
|
}
|
||||||
val conflictsFile = File(testDataPath + getTestName(false) + "Messages.txt")
|
val conflictsFile = File(testDataPath + getTestName(false) + "Messages.txt")
|
||||||
|
|||||||
@@ -235,7 +235,7 @@ class ForConverter(
|
|||||||
// check if it's iteration through list indices
|
// check if it's iteration through list indices
|
||||||
if (collectionSize is PsiMethodCallExpression && collectionSize.argumentList.expressions.isEmpty()) {
|
if (collectionSize is PsiMethodCallExpression && collectionSize.argumentList.expressions.isEmpty()) {
|
||||||
val methodExpr = collectionSize.methodExpression
|
val methodExpr = collectionSize.methodExpression
|
||||||
if (methodExpr is PsiReferenceExpression && methodExpr.referenceName == "size") {
|
if (methodExpr.referenceName == "size") {
|
||||||
val qualifier = methodExpr.qualifierExpression
|
val qualifier = methodExpr.qualifierExpression
|
||||||
if (qualifier is PsiReferenceExpression /* we don't convert to .indices if qualifier is method call or something because of possible side effects */) {
|
if (qualifier is PsiReferenceExpression /* we don't convert to .indices if qualifier is method call or something because of possible side effects */) {
|
||||||
val collectionType = PsiElementFactory.SERVICE.getInstance(project).createTypeByFQClassName(CommonClassNames.JAVA_UTIL_COLLECTION)
|
val collectionType = PsiElementFactory.SERVICE.getInstance(project).createTypeByFQClassName(CommonClassNames.JAVA_UTIL_COLLECTION)
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ private fun Converter.convertTypeParameter(typeParameter: PsiTypeParameter): Typ
|
|||||||
|
|
||||||
fun Converter.convertTypeParameterList(typeParameterList: PsiTypeParameterList?): TypeParameterList {
|
fun Converter.convertTypeParameterList(typeParameterList: PsiTypeParameterList?): TypeParameterList {
|
||||||
return if (typeParameterList != null)
|
return if (typeParameterList != null)
|
||||||
TypeParameterList(typeParameterList.typeParameters!!.toList().map { convertTypeParameter(it) }).assignPrototype(typeParameterList)
|
TypeParameterList(typeParameterList.typeParameters.toList().map { convertTypeParameter(it) }).assignPrototype(typeParameterList)
|
||||||
else
|
else
|
||||||
TypeParameterList.Empty
|
TypeParameterList.Empty
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1094,8 +1094,6 @@ open class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
|||||||
touch(file)
|
touch(file)
|
||||||
Operation.DELETE ->
|
Operation.DELETE ->
|
||||||
assertTrue("Can not delete file \"" + file.absolutePath + "\"", file.delete())
|
assertTrue("Can not delete file \"" + file.absolutePath + "\"", file.delete())
|
||||||
else ->
|
|
||||||
fail("Unknown operation")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -28,7 +28,7 @@ import org.jetbrains.kotlin.jps.JpsKotlinCompilerSettings
|
|||||||
internal class Kotlin2JsCompilerArgumentsSerializer : JpsProjectExtensionSerializer(KOTLIN_COMPILER_SETTINGS_FILE,
|
internal class Kotlin2JsCompilerArgumentsSerializer : JpsProjectExtensionSerializer(KOTLIN_COMPILER_SETTINGS_FILE,
|
||||||
KOTLIN_TO_JS_COMPILER_ARGUMENTS_SECTION) {
|
KOTLIN_TO_JS_COMPILER_ARGUMENTS_SECTION) {
|
||||||
override fun loadExtension(project: JpsProject, componentTag: Element) {
|
override fun loadExtension(project: JpsProject, componentTag: Element) {
|
||||||
val settings = XmlSerializer.deserialize(componentTag, K2JSCompilerArguments::class.java) ?: K2JSCompilerArguments()
|
val settings = XmlSerializer.deserialize(componentTag, K2JSCompilerArguments::class.java)
|
||||||
JpsKotlinCompilerSettings.setK2JsCompilerArguments(project, settings)
|
JpsKotlinCompilerSettings.setK2JsCompilerArguments(project, settings)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -30,7 +30,7 @@ internal class Kotlin2JvmCompilerArgumentsSerializer : JpsProjectExtensionSerial
|
|||||||
KOTLIN_TO_JVM_COMPILER_ARGUMENTS_SECTION) {
|
KOTLIN_TO_JVM_COMPILER_ARGUMENTS_SECTION) {
|
||||||
|
|
||||||
override fun loadExtension(project: JpsProject, componentTag: Element) {
|
override fun loadExtension(project: JpsProject, componentTag: Element) {
|
||||||
val settings = XmlSerializer.deserialize(componentTag, K2JVMCompilerArguments::class.java) ?: K2JVMCompilerArguments()
|
val settings = XmlSerializer.deserialize(componentTag, K2JVMCompilerArguments::class.java)
|
||||||
JpsKotlinCompilerSettings.setK2JvmCompilerArguments(project, settings)
|
JpsKotlinCompilerSettings.setK2JvmCompilerArguments(project, settings)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
-1
@@ -31,7 +31,6 @@ internal class KotlinCommonCompilerArgumentsSerializer : JpsProjectExtensionSeri
|
|||||||
|
|
||||||
override fun loadExtension(project: JpsProject, componentTag: Element) {
|
override fun loadExtension(project: JpsProject, componentTag: Element) {
|
||||||
val settings = XmlSerializer.deserialize(componentTag, CommonCompilerArguments.DummyImpl::class.java)
|
val settings = XmlSerializer.deserialize(componentTag, CommonCompilerArguments.DummyImpl::class.java)
|
||||||
?: CommonCompilerArguments.DummyImpl()
|
|
||||||
if (VersionComparatorUtil.compare(settings.languageVersion, settings.apiVersion) < 0) {
|
if (VersionComparatorUtil.compare(settings.languageVersion, settings.apiVersion) < 0) {
|
||||||
settings.apiVersion = settings.languageVersion
|
settings.apiVersion = settings.languageVersion
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ internal class KotlinCompilerSettingsSerializer : JpsProjectExtensionSerializer(
|
|||||||
KOTLIN_COMPILER_SETTINGS_SECTION) {
|
KOTLIN_COMPILER_SETTINGS_SECTION) {
|
||||||
|
|
||||||
override fun loadExtension(project: JpsProject, componentTag: Element) {
|
override fun loadExtension(project: JpsProject, componentTag: Element) {
|
||||||
val settings = XmlSerializer.deserialize(componentTag, CompilerSettings::class.java) ?: CompilerSettings()
|
val settings = XmlSerializer.deserialize(componentTag, CompilerSettings::class.java)
|
||||||
JpsKotlinCompilerSettings.setCompilerSettings(project, settings)
|
JpsKotlinCompilerSettings.setCompilerSettings(project, settings)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -397,9 +397,7 @@ abstract class BasicBoxTest(
|
|||||||
FileUtil.writeToFile(File(incrementalDir, "$i.$METADATA_EXTENSION"), packagePart.proto)
|
FileUtil.writeToFile(File(incrementalDir, "$i.$METADATA_EXTENSION"), packagePart.proto)
|
||||||
}
|
}
|
||||||
|
|
||||||
incrementalService.headerMetadata?.let {
|
FileUtil.writeToFile(File(incrementalDir, HEADER_FILE), incrementalService.headerMetadata)
|
||||||
FileUtil.writeToFile(File(incrementalDir, HEADER_FILE), it)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
processJsProgram(translationResult.program, units.filterIsInstance<TranslationUnit.SourceFile>().map { it.file })
|
processJsProgram(translationResult.program, units.filterIsInstance<TranslationUnit.SourceFile>().map { it.file })
|
||||||
|
|||||||
+1
-2
@@ -21,7 +21,6 @@ import com.intellij.openapi.roots.ProjectRootManager
|
|||||||
import com.intellij.openapi.util.SimpleModificationTracker
|
import com.intellij.openapi.util.SimpleModificationTracker
|
||||||
import com.intellij.openapi.vfs.VirtualFile
|
import com.intellij.openapi.vfs.VirtualFile
|
||||||
import com.intellij.openapi.vfs.VirtualFileManager
|
import com.intellij.openapi.vfs.VirtualFileManager
|
||||||
import com.intellij.psi.PsiDirectory
|
|
||||||
import com.intellij.psi.PsiElement
|
import com.intellij.psi.PsiElement
|
||||||
import com.intellij.psi.PsiFile
|
import com.intellij.psi.PsiFile
|
||||||
import com.intellij.psi.impl.PsiTreeChangeEventImpl
|
import com.intellij.psi.impl.PsiTreeChangeEventImpl
|
||||||
@@ -83,7 +82,7 @@ class AndroidPsiTreeChangePreprocessor : PsiTreeChangePreprocessor, SimpleModifi
|
|||||||
|
|
||||||
val projectFileIndex = ProjectRootManager.getInstance(xmlFile.project).fileIndex
|
val projectFileIndex = ProjectRootManager.getInstance(xmlFile.project).fileIndex
|
||||||
val module = projectFileIndex.getModuleForFile(xmlFile.virtualFile)
|
val module = projectFileIndex.getModuleForFile(xmlFile.virtualFile)
|
||||||
?: (element.parent as? PsiDirectory)?.let { projectFileIndex.getModuleForFile(it.virtualFile) }
|
?: element.parent?.let { projectFileIndex.getModuleForFile(it.virtualFile) }
|
||||||
|
|
||||||
if (module != null && !module.isDisposed) {
|
if (module != null && !module.isDisposed) {
|
||||||
val resourceManager = AndroidLayoutXmlFileManager.getInstance(module) ?: return false
|
val resourceManager = AndroidLayoutXmlFileManager.getInstance(module) ?: return false
|
||||||
|
|||||||
@@ -59,13 +59,11 @@ class KotlinUastLanguagePlugin : UastLanguagePlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun convertElement(element: PsiElement, parent: UElement?, requiredType: Class<out UElement>?): UElement? {
|
override fun convertElement(element: PsiElement, parent: UElement?, requiredType: Class<out UElement>?): UElement? {
|
||||||
if (element !is PsiElement) return null
|
|
||||||
return convertDeclaration(element, parent.toCallback(), requiredType)
|
return convertDeclaration(element, parent.toCallback(), requiredType)
|
||||||
?: KotlinConverter.convertPsiElement(element, parent.toCallback(), requiredType)
|
?: KotlinConverter.convertPsiElement(element, parent.toCallback(), requiredType)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun convertElementWithParent(element: PsiElement, requiredType: Class<out UElement>?): UElement? {
|
override fun convertElementWithParent(element: PsiElement, requiredType: Class<out UElement>?): UElement? {
|
||||||
if (element !is PsiElement) return null
|
|
||||||
if (element is PsiFile) return convertDeclaration(element, null, requiredType)
|
if (element is PsiFile) return convertDeclaration(element, null, requiredType)
|
||||||
if (element is KtLightClassForFacade) return convertDeclaration(element, null, requiredType)
|
if (element is KtLightClassForFacade) return convertDeclaration(element, null, requiredType)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user