Remove deprecated declarations from project code, cleanup usages

This commit is contained in:
Alexander Udalov
2017-03-21 12:39:30 +03:00
parent 6a049c9ab5
commit 579238c3be
16 changed files with 18 additions and 59 deletions
@@ -323,7 +323,7 @@ public class ClosureCodegen extends MemberCodegen<KtElement> {
Type[] myParameterTypes = bridge.getArgumentTypes();
List<ParameterDescriptor> calleeParameters = CollectionsKt.plus(
org.jetbrains.kotlin.utils.CollectionsKt.<ParameterDescriptor>singletonOrEmptyList(funDescriptor.getExtensionReceiverParameter()),
CollectionsKt.listOfNotNull(funDescriptor.getExtensionReceiverParameter()),
funDescriptor.getValueParameters()
);
@@ -63,7 +63,7 @@ class KotlinBinaryClassCache : Disposable {
}
val aClass = ApplicationManager.getApplication().runReadAction(Computable {
//noinspection deprecation
@Suppress("DEPRECATION")
VirtualFileKotlinClass.create(file, fileContent)
})
@@ -95,7 +95,6 @@ fun ModuleContext(module: ModuleDescriptor, project: Project): ModuleContext =
fun GlobalContext.withProject(project: Project): ProjectContext = ProjectContextImpl(project, this)
fun ProjectContext.withModule(module: ModuleDescriptor): ModuleContext = ModuleContextImpl(module, this)
@JvmOverloads
fun ContextForNewModule(
projectContext: ProjectContext,
moduleName: Name,
@@ -21,13 +21,13 @@ import com.intellij.lang.ASTNode;
import com.intellij.lang.FileASTNode;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.*;
import com.intellij.psi.stubs.StubElement;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.util.FileContentUtilCore;
import com.intellij.util.IncorrectOperationException;
import kotlin.collections.ArraysKt;
import kotlin.collections.CollectionsKt;
import kotlin.jvm.functions.Function1;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -39,7 +39,6 @@ import org.jetbrains.kotlin.parsing.KotlinParserDefinition;
import org.jetbrains.kotlin.psi.stubs.KotlinFileStub;
import org.jetbrains.kotlin.psi.stubs.elements.KtPlaceHolderStubElementType;
import org.jetbrains.kotlin.psi.stubs.elements.KtStubElementTypes;
import org.jetbrains.kotlin.utils.CollectionsKt;
import java.util.Arrays;
import java.util.Collections;
@@ -279,7 +278,7 @@ public class KtFile extends PsiFileBase implements KtDeclarationContainer, KtAnn
PsiElement result = super.setName(name);
boolean willBeScript = name.endsWith(KotlinParserDefinition.STD_SCRIPT_EXT);
if (isScript() != willBeScript) {
FileContentUtilCore.reparseFiles(CollectionsKt.<VirtualFile>singletonOrEmptyList(getVirtualFile()));
FileContentUtilCore.reparseFiles(CollectionsKt.listOfNotNull(getVirtualFile()));
}
return result;
}
@@ -37,8 +37,6 @@ import org.jetbrains.kotlin.types.expressions.typeInfoFactory.noTypeInfo
import org.jetbrains.kotlin.types.typeUtil.makeNotNullable
import org.jetbrains.kotlin.util.slicedMap.ReadOnlySlice
operator fun <K, V: Any> BindingContext.get(slice: ReadOnlySlice<K, V>, key: K): V? = get(slice, key)
fun KtReturnExpression.getTargetFunctionDescriptor(context: BindingContext): FunctionDescriptor? {
val targetLabel = getTargetLabel()
if (targetLabel != null) return context[LABEL_TARGET, targetLabel]?.let { context[FUNCTION, it] }
@@ -95,7 +95,7 @@ open class KotlinScriptDefinitionFromAnnotatedTemplate(
}
fun makeScriptContents() = BasicScriptContents(file, getAnnotations = {
val classLoader = (template as Any)::class.java.classLoader
val classLoader = template::class.java.classLoader
try {
getAnnotationEntries(file, project)
.mapNotNull { psiAnn ->
@@ -102,13 +102,8 @@ class LoggingStorageManager(
return CallData(outerInstance, containingField, enclosingEntity, arguments, result)
}
private fun enclosingEntity(_class: Class<out Any>): GenericDeclaration? {
val result = _class.enclosingConstructor
?: _class.enclosingMethod
?: _class.enclosingClass
return result as GenericDeclaration?
}
private fun enclosingEntity(klass: Class<out Any>): GenericDeclaration? =
klass.enclosingConstructor ?: klass.enclosingMethod ?: klass.enclosingClass
private fun Class<*>.getAllDeclaredFields(): List<Field> {
val result = arrayListOf<Field>()