Compiler&plugin deprecations cleanup: *array -> *arrayOf, copyToArray -> toTypedArray.
This commit is contained in:
+1
-1
@@ -32,7 +32,7 @@ import org.jetbrains.kotlin.load.java.descriptors.SamAdapterDescriptor
|
||||
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils
|
||||
import org.jetbrains.kotlin.diagnostics.DiagnosticSink
|
||||
|
||||
private val EXTERNAL_SOURCES_KINDS = array(
|
||||
private val EXTERNAL_SOURCES_KINDS = arrayOf(
|
||||
JvmDeclarationOriginKind.DELEGATION_TO_TRAIT_IMPL,
|
||||
JvmDeclarationOriginKind.DELEGATION,
|
||||
JvmDeclarationOriginKind.BRIDGE)
|
||||
|
||||
@@ -40,8 +40,8 @@ public object PluginCliParser {
|
||||
val classLoader = PluginURLClassLoader(
|
||||
arguments.pluginClasspaths
|
||||
?.map { File(it).toURI().toURL() }
|
||||
?.copyToArray()
|
||||
?: array<URL>(),
|
||||
?.toTypedArray()
|
||||
?: arrayOf<URL>(),
|
||||
javaClass.getClassLoader()
|
||||
)
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ class QualifierReceiver (
|
||||
val classObjectTypeScope = (classifier as? ClassDescriptor)?.classObjectType?.getMemberScope()?.let {
|
||||
FilteringScope(it) { it !is ClassDescriptor }
|
||||
}
|
||||
val scopes = listOf(classObjectTypeScope, getNestedClassesAndPackageMembersScope()).filterNotNull().copyToArray()
|
||||
val scopes = listOf(classObjectTypeScope, getNestedClassesAndPackageMembersScope()).filterNotNull().toTypedArray()
|
||||
return ChainedScope(descriptor, "Member scope for " + name + " as package or class or object", *scopes)
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ class QualifierReceiver (
|
||||
}
|
||||
}
|
||||
|
||||
return ChainedScope(descriptor, "Static scope for " + name + " as package or class or object", *scopes.copyToArray())
|
||||
return ChainedScope(descriptor, "Static scope for " + name + " as package or class or object", *scopes.toTypedArray())
|
||||
}
|
||||
|
||||
override fun getType(): JetType = throw IllegalStateException("No type corresponds to QualifierReceiver '$this'")
|
||||
|
||||
+1
-1
@@ -79,7 +79,7 @@ public abstract class AbstractJvmRuntimeDescriptorLoaderTest : TestCaseWithTmpdi
|
||||
|
||||
compileFile(file, text, jdkKind)
|
||||
|
||||
val classLoader = URLClassLoader(array(tmpdir.toURI().toURL()), ForTestCompileRuntime.runtimeJarClassLoader())
|
||||
val classLoader = URLClassLoader(arrayOf(tmpdir.toURI().toURL()), ForTestCompileRuntime.runtimeJarClassLoader())
|
||||
|
||||
val actual = createReflectedPackageView(classLoader)
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ public abstract class AbstractLocalClassProtoTest : TestCaseWithTmpdir() {
|
||||
val classNameSuffix = InTextDirectivesUtils.findStringWithPrefixes(source.readText(), "// CLASS_NAME_SUFFIX: ")
|
||||
?: error("CLASS_NAME_SUFFIX directive not found in test data")
|
||||
|
||||
val classLoader = URLClassLoader(array(tmpdir.toURI().toURL()), ForTestCompileRuntime.runtimeJarClassLoader())
|
||||
val classLoader = URLClassLoader(arrayOf(tmpdir.toURI().toURL()), ForTestCompileRuntime.runtimeJarClassLoader())
|
||||
|
||||
val classFile = tmpdir.listFiles().singleOrNull { it.getPath().endsWith("$classNameSuffix.class") }
|
||||
?: error("Local class with suffix `$classNameSuffix` is not found in: ${tmpdir.listFiles().toList()}")
|
||||
|
||||
+1
-1
@@ -72,7 +72,7 @@ public class ReflectJavaClass(
|
||||
private fun isEnumValuesOrValueOf(method: Method): Boolean {
|
||||
return when (method.getName()) {
|
||||
"values" -> method.getParameterTypes().isEmpty()
|
||||
"valueOf" -> Arrays.equals(method.getParameterTypes(), array(javaClass<String>()))
|
||||
"valueOf" -> Arrays.equals(method.getParameterTypes(), arrayOf(javaClass<String>()))
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ abstract class KCallableContainerImpl {
|
||||
val classLoader = jClass.classLoader
|
||||
val parameterTypes = signature.getParameterTypeList().map { jvmType ->
|
||||
loadJvmType(jvmType, nameResolver, classLoader)
|
||||
}.copyToArray()
|
||||
}.toTypedArray()
|
||||
|
||||
return try {
|
||||
if (declared) jClass.getDeclaredMethod(name, *parameterTypes)
|
||||
|
||||
@@ -138,7 +138,7 @@ object REFLECTION_EVAL : Eval {
|
||||
}
|
||||
|
||||
override fun newMultiDimensionalArray(arrayType: Type, dimensionSizes: List<Int>): Value {
|
||||
return ObjectValue(ArrayHelper.newMultiArray(findClass(arrayType.getElementType()), *dimensionSizes.copyToArray()), arrayType)
|
||||
return ObjectValue(ArrayHelper.newMultiArray(findClass(arrayType.getElementType()), *dimensionSizes.toTypedArray()), arrayType)
|
||||
}
|
||||
|
||||
override fun getArrayLength(array: Value): Value {
|
||||
@@ -236,7 +236,7 @@ object REFLECTION_EVAL : Eval {
|
||||
assertTrue(methodDesc.isStatic)
|
||||
val method = findClass(methodDesc).findMethod(methodDesc)
|
||||
assertNotNull("Method not found: $methodDesc", method)
|
||||
val args = mapArguments(arguments, methodDesc.parameterTypes).copyToArray()
|
||||
val args = mapArguments(arguments, methodDesc.parameterTypes).toTypedArray()
|
||||
val result = mayThrow {method!!.invoke(null, *args)}
|
||||
return objectToValue(result, methodDesc.returnType)
|
||||
}
|
||||
@@ -279,7 +279,7 @@ object REFLECTION_EVAL : Eval {
|
||||
val _class = findClass((instance as NewObjectValue).asmType)
|
||||
val ctor = _class.findConstructor(methodDesc)
|
||||
assertNotNull("Constructor not found: $methodDesc", ctor)
|
||||
val args = mapArguments(arguments, methodDesc.parameterTypes).copyToArray()
|
||||
val args = mapArguments(arguments, methodDesc.parameterTypes).toTypedArray()
|
||||
val result = mayThrow {ctor!!.newInstance(*args)}
|
||||
instance.value = result
|
||||
return objectToValue(result, instance.asmType)
|
||||
@@ -292,7 +292,7 @@ object REFLECTION_EVAL : Eval {
|
||||
val obj = instance.obj().checkNull()
|
||||
val method = obj.javaClass.findMethod(methodDesc)
|
||||
assertNotNull("Method not found: $methodDesc", method)
|
||||
val args = mapArguments(arguments, methodDesc.parameterTypes).copyToArray()
|
||||
val args = mapArguments(arguments, methodDesc.parameterTypes).toTypedArray()
|
||||
val result = mayThrow {method!!.invoke(obj, *args)}
|
||||
return objectToValue(result, methodDesc.returnType)
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ public class JetShortNamesCache(private val project: com.intellij.openapi.projec
|
||||
// Quick check for classes from getAllClassNames()
|
||||
val classOrObjects = org.jetbrains.kotlin.idea.stubindex.JetClassShortNameIndex.getInstance().get(name, project, scope)
|
||||
if (classOrObjects.isEmpty()) {
|
||||
return result.copyToArray()
|
||||
return result.toTypedArray()
|
||||
}
|
||||
|
||||
for (classOrObject in classOrObjects) {
|
||||
@@ -82,7 +82,7 @@ public class JetShortNamesCache(private val project: com.intellij.openapi.projec
|
||||
}
|
||||
}
|
||||
|
||||
return result.copyToArray()
|
||||
return result.toTypedArray()
|
||||
}
|
||||
|
||||
override fun getAllClassNames(dest: HashSet<String>) {
|
||||
@@ -90,29 +90,29 @@ public class JetShortNamesCache(private val project: com.intellij.openapi.projec
|
||||
}
|
||||
|
||||
override fun getMethodsByName(org.jetbrains.annotations.NonNls name: String, scope: com.intellij.psi.search.GlobalSearchScope): Array<PsiMethod>
|
||||
= array()
|
||||
= emptyArray()
|
||||
|
||||
override fun getMethodsByNameIfNotMoreThan(org.jetbrains.annotations.NonNls name: String, scope: com.intellij.psi.search.GlobalSearchScope, maxCount: Int): Array<PsiMethod>
|
||||
= array()
|
||||
= emptyArray()
|
||||
|
||||
override fun getFieldsByNameIfNotMoreThan(org.jetbrains.annotations.NonNls s: String, scope: com.intellij.psi.search.GlobalSearchScope, i: Int): Array<PsiField>
|
||||
= array()
|
||||
= emptyArray()
|
||||
|
||||
override fun processMethodsWithName(org.jetbrains.annotations.NonNls name: String, scope: com.intellij.psi.search.GlobalSearchScope, processor: com.intellij.util.Processor<PsiMethod>): Boolean
|
||||
= com.intellij.util.containers.ContainerUtil.process(getMethodsByName(name, scope), processor)
|
||||
|
||||
override fun getAllMethodNames(): Array<String>
|
||||
= JetFunctionShortNameIndex.getInstance().getAllKeys(project).copyToArray()
|
||||
= JetFunctionShortNameIndex.getInstance().getAllKeys(project).toTypedArray()
|
||||
|
||||
override fun getAllMethodNames(set: HashSet<String>) {
|
||||
set.addAll(JetFunctionShortNameIndex.getInstance().getAllKeys(project))
|
||||
}
|
||||
|
||||
override fun getFieldsByName(org.jetbrains.annotations.NonNls name: String, scope: com.intellij.psi.search.GlobalSearchScope): Array<PsiField>
|
||||
= array()
|
||||
= emptyArray()
|
||||
|
||||
override fun getAllFieldNames(): Array<String>
|
||||
= array()
|
||||
= emptyArray()
|
||||
|
||||
override fun getAllFieldNames(set: HashSet<String>) {
|
||||
}
|
||||
|
||||
@@ -194,11 +194,11 @@ private object NotUnderContentRootModuleInfo : IdeaModuleInfo() {
|
||||
}
|
||||
|
||||
private data class LibraryWithoutSourceScope(project: Project, private val library: Library) :
|
||||
LibraryScopeBase(project, library.getFiles(OrderRootType.CLASSES), array<VirtualFile>()) {
|
||||
LibraryScopeBase(project, library.getFiles(OrderRootType.CLASSES), arrayOf<VirtualFile>()) {
|
||||
}
|
||||
|
||||
//TODO: (module refactoring) android sdk has modified scope
|
||||
private data class SdkScope(project: Project, private val sdk: Sdk) :
|
||||
LibraryScopeBase(project, sdk.getRootProvider().getFiles(OrderRootType.CLASSES), array<VirtualFile>())
|
||||
LibraryScopeBase(project, sdk.getRootProvider().getFiles(OrderRootType.CLASSES), arrayOf<VirtualFile>())
|
||||
|
||||
private fun IdeaModuleInfo.isLibraryClasses() = this is SdkInfo || this is LibraryInfo
|
||||
|
||||
+1
-1
@@ -179,7 +179,7 @@ private class PerFileAnalysisCache(val file: JetFile, val resolveSession: Resolv
|
||||
}
|
||||
|
||||
private object KotlinResolveDataProvider {
|
||||
private val topmostElementTypes = array<Class<out PsiElement?>?>(
|
||||
private val topmostElementTypes = arrayOf<Class<out PsiElement?>?>(
|
||||
javaClass<JetNamedFunction>(),
|
||||
javaClass<JetClassInitializer>(),
|
||||
javaClass<JetProperty>(),
|
||||
|
||||
@@ -238,13 +238,13 @@ public open class JetPsiChecker : Annotator, HighlightRangeExtension {
|
||||
}
|
||||
}
|
||||
|
||||
private fun getBeforeAnalysisVisitors(holder: AnnotationHolder) = array(
|
||||
private fun getBeforeAnalysisVisitors(holder: AnnotationHolder) = arrayOf(
|
||||
SoftKeywordsHighlightingVisitor(holder),
|
||||
LabelsHighlightingVisitor(holder),
|
||||
KDocHighlightingVisitor(holder)
|
||||
)
|
||||
|
||||
private fun getAfterAnalysisVisitor(holder: AnnotationHolder, bindingContext: BindingContext) = array(
|
||||
private fun getAfterAnalysisVisitor(holder: AnnotationHolder, bindingContext: BindingContext) = arrayOf(
|
||||
PropertiesHighlightingVisitor(holder, bindingContext),
|
||||
FunctionsHighlightingVisitor(holder, bindingContext),
|
||||
VariablesHighlightingVisitor(holder, bindingContext),
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ class KotlinSuppressableWarningProblemGroup(
|
||||
if (element == null)
|
||||
return SuppressIntentionAction.EMPTY_ARRAY
|
||||
|
||||
return createSuppressWarningActions(element, diagnosticFactory).copyToArray()
|
||||
return createSuppressWarningActions(element, diagnosticFactory).toTypedArray()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ public class JetForLoopInReference(element: JetForExpression) : JetMultiReferenc
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val LOOP_RANGE_KEYS = array(
|
||||
private val LOOP_RANGE_KEYS = arrayOf(
|
||||
BindingContext.LOOP_RANGE_ITERATOR_RESOLVED_CALL,
|
||||
BindingContext.LOOP_RANGE_NEXT_RESOLVED_CALL,
|
||||
BindingContext.LOOP_RANGE_HAS_NEXT_RESOLVED_CALL
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ public class JetReferenceContributor() : PsiReferenceContributor() {
|
||||
registerReferenceProvider(PlatformPatterns.psiElement(elementClass), object: PsiReferenceProvider() {
|
||||
override fun getReferencesByElement(element: PsiElement, context: ProcessingContext): Array<PsiReference> {
|
||||
@suppress("UNCHECKED_CAST")
|
||||
return array(factory(element as E))
|
||||
return arrayOf(factory(element as E))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -96,10 +96,10 @@ public class FindImplicitNothingAction : AnAction() {
|
||||
|
||||
SwingUtilities.invokeLater {
|
||||
if (found.isNotEmpty()) {
|
||||
val usages = found.map { UsageInfo2UsageAdapter(UsageInfo(it)) }.copyToArray()
|
||||
val usages = found.map { UsageInfo2UsageAdapter(UsageInfo(it)) }.toTypedArray()
|
||||
val presentation = UsageViewPresentation()
|
||||
presentation.setTabName("Implicit Nothing's")
|
||||
UsageViewManager.getInstance(project).showUsages(array<UsageTarget>(), usages, presentation)
|
||||
UsageViewManager.getInstance(project).showUsages(arrayOf<UsageTarget>(), usages, presentation)
|
||||
}
|
||||
else {
|
||||
Messages.showInfoMessage(project, "Not found in ${files.size()} file(s)", "Not Found")
|
||||
|
||||
@@ -66,7 +66,7 @@ import java.util.ArrayList
|
||||
public class KotlinCopyPasteReferenceProcessor() : CopyPastePostProcessor<KotlinReferenceTransferableData>() {
|
||||
private val LOG = Logger.getInstance(javaClass<KotlinCopyPasteReferenceProcessor>())
|
||||
|
||||
private val IGNORE_REFERENCES_INSIDE: Array<Class<out JetElement>> = array(
|
||||
private val IGNORE_REFERENCES_INSIDE: Array<Class<out JetElement>> = arrayOf(
|
||||
javaClass<JetImportList>(),
|
||||
javaClass<JetPackageDirective>()
|
||||
)
|
||||
@@ -112,7 +112,7 @@ public class KotlinCopyPasteReferenceProcessor() : CopyPastePostProcessor<Kotlin
|
||||
|
||||
if (collectedData.isEmpty()) return listOf()
|
||||
|
||||
return listOf(KotlinReferenceTransferableData(collectedData.copyToArray()))
|
||||
return listOf(KotlinReferenceTransferableData(collectedData.toTypedArray()))
|
||||
}
|
||||
|
||||
public fun collectReferenceData(
|
||||
@@ -334,7 +334,7 @@ public class KotlinCopyPasteReferenceProcessor() : CopyPastePostProcessor<Kotlin
|
||||
return referencesToRestore
|
||||
}
|
||||
|
||||
val dialog = RestoreReferencesDialog(project, fqNames.copyToArray())
|
||||
val dialog = RestoreReferencesDialog(project, fqNames.toTypedArray())
|
||||
dialog.show()
|
||||
|
||||
val selectedFqNames = dialog.getSelectedElements()!!.toSet()
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ import com.intellij.openapi.components.Storage
|
||||
|
||||
State(
|
||||
name = "KotlinCompilerWorkspaceSettings",
|
||||
storages = array(
|
||||
storages = arrayOf(
|
||||
Storage(file = StoragePathMacros.WORKSPACE_FILE)
|
||||
)
|
||||
)
|
||||
|
||||
+2
-2
@@ -102,7 +102,7 @@ public class ConvertJavaCopyPastePostProcessor : CopyPastePostProcessor<TextBloc
|
||||
}
|
||||
}
|
||||
|
||||
KotlinCopyPasteReferenceProcessor().processReferenceData(project, targetFile, bounds.start, referenceData.copyToArray())
|
||||
KotlinCopyPasteReferenceProcessor().processReferenceData(project, targetFile, bounds.start, referenceData.toTypedArray())
|
||||
|
||||
return rangeMarker.range
|
||||
}
|
||||
@@ -221,7 +221,7 @@ public class ConvertJavaCopyPastePostProcessor : CopyPastePostProcessor<TextBloc
|
||||
|
||||
val dummyFile = JetPsiFactory(targetFile.getProject()).createAnalyzableFile("dummy.kt", fileText, targetFile)
|
||||
|
||||
return KotlinCopyPasteReferenceProcessor().collectReferenceData(dummyFile, intArray(blockStart!!), intArray(blockEnd!!))
|
||||
return KotlinCopyPasteReferenceProcessor().collectReferenceData(dummyFile, intArrayOf(blockStart!!), intArrayOf(blockEnd!!))
|
||||
}
|
||||
|
||||
private fun generateDummyFunctionName(convertedCode: String): String {
|
||||
|
||||
@@ -29,7 +29,7 @@ import com.intellij.xdebugger.settings.XDebuggerSettings
|
||||
|
||||
import com.intellij.xdebugger.XDebuggerUtil
|
||||
|
||||
State(name = "KotlinDebuggerSettings", storages = array(Storage(file = StoragePathMacros.APP_CONFIG + "/kotlin_debug.xml")))
|
||||
State(name = "KotlinDebuggerSettings", storages = arrayOf(Storage(file = StoragePathMacros.APP_CONFIG + "/kotlin_debug.xml")))
|
||||
public class KotlinDebuggerSettings : XDebuggerSettings<KotlinDebuggerSettings>("kotlin_debugger"), Getter<KotlinDebuggerSettings> {
|
||||
public var DEBUG_RENDER_DELEGATED_PROPERTIES: Boolean = true
|
||||
public var DEBUG_DISABLE_KOTLIN_INTERNAL_CLASSES: Boolean = true
|
||||
|
||||
@@ -25,7 +25,7 @@ private val KOTLIN_STDLIB_FILTER = "kotlin.*"
|
||||
public fun addKotlinStdlibDebugFilterIfNeeded() {
|
||||
if (!KotlinDebuggerSettings.getInstance().DEBUG_IS_FILTER_FOR_STDLIB_ALREADY_ADDED) {
|
||||
val settings = DebuggerSettings.getInstance()!!
|
||||
val newFilters = (settings.getSteppingFilters() + ClassFilter(KOTLIN_STDLIB_FILTER)).copyToArray()
|
||||
val newFilters = (settings.getSteppingFilters() + ClassFilter(KOTLIN_STDLIB_FILTER)).toTypedArray()
|
||||
|
||||
settings.setSteppingFilters(newFilters)
|
||||
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ class DelegatingFindMemberUsagesHandler(
|
||||
KotlinFindMemberUsagesHandler.getInstance(element, elementsToSearch, factory)
|
||||
|
||||
is PsiMethod ->
|
||||
JavaFindUsagesHandler(element, elementsToSearch.copyToArray(), factory.javaHandlerFactory)
|
||||
JavaFindUsagesHandler(element, elementsToSearch.toTypedArray(), factory.javaHandlerFactory)
|
||||
|
||||
else -> null
|
||||
}
|
||||
|
||||
@@ -27,11 +27,11 @@ public class KotlinTemplatesFactory : ProjectTemplatesFactory() {
|
||||
public val KOTLIN_GROUP_NAME: String = "Kotlin"
|
||||
}
|
||||
|
||||
override fun getGroups() = array(KOTLIN_GROUP_NAME)
|
||||
override fun getGroups() = arrayOf(KOTLIN_GROUP_NAME)
|
||||
override fun getGroupIcon(group: String) = JetIcons.SMALL_LOGO
|
||||
|
||||
override fun createTemplates(group: String, context: WizardContext?) =
|
||||
array(
|
||||
arrayOf(
|
||||
BuilderBasedTemplate(KotlinModuleBuilder(TargetPlatform.JVM, "Kotlin - JVM", "Kotlin module for JVM target")),
|
||||
BuilderBasedTemplate(KotlinModuleBuilder(TargetPlatform.JS, "Kotlin - JavaScript", "Kotlin module for JavaScript target"))
|
||||
)
|
||||
|
||||
+1
-1
@@ -41,6 +41,6 @@ class KotlinOverrideTreeStructure(project: Project, val element: PsiElement) : H
|
||||
return javaTreeStructures
|
||||
.stream()
|
||||
.map (::buildChildrenByTreeStructure)
|
||||
.reduce { a, b -> ContainerUtil.union(a.toSet(), b.toSet()).copyToArray() }
|
||||
.reduce { a, b -> ContainerUtil.union(a.toSet(), b.toSet()).toTypedArray() }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ public fun navigateToOverriddenMethod(e: MouseEvent?, method: PsiMethod) {
|
||||
var overridingJavaMethods = processor.getCollection().filter { it !is KotlinLightMethodForTraitFakeOverride }
|
||||
if (overridingJavaMethods.isEmpty()) return
|
||||
|
||||
val showMethodNames = !PsiUtil.allMethodsHaveSameSignature(overridingJavaMethods.copyToArray())
|
||||
val showMethodNames = !PsiUtil.allMethodsHaveSameSignature(overridingJavaMethods.toTypedArray())
|
||||
|
||||
val renderer = MethodCellRenderer(showMethodNames)
|
||||
overridingJavaMethods = overridingJavaMethods.sortBy(renderer.getComparator())
|
||||
@@ -114,7 +114,7 @@ public fun navigateToOverriddenMethod(e: MouseEvent?, method: PsiMethod) {
|
||||
val methodsUpdater = OverridingMethodsUpdater(method, renderer)
|
||||
PsiElementListNavigator.openTargets(
|
||||
e,
|
||||
overridingJavaMethods.copyToArray(),
|
||||
overridingJavaMethods.toTypedArray(),
|
||||
methodsUpdater.getCaption(overridingJavaMethods.size()),
|
||||
"Overriding declarations of " + method.getName(),
|
||||
renderer,
|
||||
|
||||
@@ -109,7 +109,7 @@ fun navigateToPropertyOverriddenDeclarations(e: MouseEvent?, property: JetProper
|
||||
.filterIsInstance<NavigatablePsiElement>()
|
||||
|
||||
PsiElementListNavigator.openTargets(e,
|
||||
navigatingOverrides.copyToArray(),
|
||||
navigatingOverrides.toTypedArray(),
|
||||
JetBundle.message("navigation.title.overriding.property", property.getName()),
|
||||
JetBundle.message("navigation.findUsages.title.overriding.property", property.getName()), renderer)
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ public class SuperDeclarationMarkerNavigationHandler : GutterIconNavigationHandl
|
||||
|
||||
PsiElementListNavigator.openTargets(
|
||||
e,
|
||||
superDeclarations.copyToArray(),
|
||||
superDeclarations.toTypedArray(),
|
||||
JetBundle.message("navigation.title.super.declaration", elementName),
|
||||
JetBundle.message("navigation.findUsages.title.super.declaration", elementName),
|
||||
JetFunctionPsiElementCellRenderer())
|
||||
|
||||
@@ -86,7 +86,7 @@ public class ReflectionNotFoundInspection : AbstractKotlinInspection() {
|
||||
expression.getDoubleColonTokenReference(),
|
||||
JetBundle.message("reflection.not.found"),
|
||||
ProblemHighlightType.GENERIC_ERROR_OR_WARNING,
|
||||
*(createQuickFix().singletonOrEmptyList().copyToArray())
|
||||
*(createQuickFix().singletonOrEmptyList().toTypedArray())
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ public class UnusedSymbolInspection : AbstractKotlinInspection() {
|
||||
|
||||
override fun applyFix(project: Project, descriptor: ProblemDescriptor?) {
|
||||
if (!FileModificationService.getInstance().prepareFileForWrite(declaration.getContainingFile())) return
|
||||
SafeDeleteHandler.invoke(project, array(declaration), false)
|
||||
SafeDeleteHandler.invoke(project, arrayOf(declaration), false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ public abstract class CallableRefactoring<T: CallableDescriptor>(
|
||||
"refactor")
|
||||
val title = IdeBundle.message("title.warning")!!
|
||||
val icon = Messages.getQuestionIcon()!!
|
||||
return Messages.showDialog(message, title, options.copyToArray(), 0, icon)
|
||||
return Messages.showDialog(message, title, options.toTypedArray(), 0, icon)
|
||||
}
|
||||
|
||||
protected fun checkModifiable(element: PsiElement): Boolean {
|
||||
|
||||
@@ -98,7 +98,7 @@ public class JetChangeInfo(
|
||||
|
||||
public fun getNewParametersCount(): Int = newParameters.size()
|
||||
|
||||
override fun getNewParameters(): Array<JetParameterInfo> = newParameters.copyToArray()
|
||||
override fun getNewParameters(): Array<JetParameterInfo> = newParameters.toTypedArray()
|
||||
|
||||
fun getNonReceiverParametersCount(): Int = newParameters.size() - (if (receiverParameterInfo != null) 1 else 0)
|
||||
|
||||
@@ -255,7 +255,7 @@ public class JetChangeInfo(
|
||||
}
|
||||
|
||||
ParameterInfoImpl(javaOldIndex, info.getName(), type, info.defaultValueForCall?.getText() ?: "")
|
||||
}.copyToArray()
|
||||
}.toTypedArray()
|
||||
|
||||
val returnType = if (isPrimaryMethodUpdated) currentPsiMethod.getReturnType() else PsiType.VOID
|
||||
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ import com.intellij.usageView.UsageViewBundle
|
||||
import com.intellij.usageView.UsageViewDescriptor
|
||||
|
||||
public class JetUsagesViewDescriptor(private val element: PsiElement, private val elementsHeader: String) : UsageViewDescriptor {
|
||||
override fun getElements(): Array<PsiElement> = array(element)
|
||||
override fun getElements(): Array<PsiElement> = arrayOf(element)
|
||||
|
||||
override fun getProcessedElementsHeader(): String = elementsHeader
|
||||
|
||||
|
||||
+1
-1
@@ -202,7 +202,7 @@ abstract class OutputValueBoxer(val outputValues: List<OutputValue>) {
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val selectors = array("first", "second", "third")
|
||||
private val selectors = arrayOf("first", "second", "third")
|
||||
}
|
||||
|
||||
override val returnType: JetType by Delegates.lazy {
|
||||
|
||||
+2
-2
@@ -77,14 +77,14 @@ public class KotlinIntroduceParameterDialog private constructor(
|
||||
editor,
|
||||
introduceParameterDescriptor,
|
||||
lambdaExtractionDescriptor,
|
||||
lambdaExtractionDescriptor.suggestedNames.copyToArray(),
|
||||
lambdaExtractionDescriptor.suggestedNames.toTypedArray(),
|
||||
listOf(lambdaExtractionDescriptor.returnType),
|
||||
helper
|
||||
)
|
||||
|
||||
private val typeNameSuggestions = typeSuggestions
|
||||
.map { IdeDescriptorRenderers.SOURCE_CODE_SHORT_NAMES_IN_TYPES.renderType(it) }
|
||||
.copyToArray()
|
||||
.toTypedArray()
|
||||
|
||||
private val nameField = NameSuggestionsField(nameSuggestions, project, JetFileType.INSTANCE)
|
||||
private val typeField = NameSuggestionsField(typeNameSuggestions, project, JetFileType.INSTANCE)
|
||||
|
||||
+1
-1
@@ -311,7 +311,7 @@ public open class KotlinIntroduceParameterHandler(
|
||||
KotlinIntroduceParameterDialog(project,
|
||||
editor,
|
||||
introduceParameterDescriptor,
|
||||
suggestedNames.copyToArray(),
|
||||
suggestedNames.toTypedArray(),
|
||||
listOf(replacementType) + replacementType.supertypes(),
|
||||
helper).show()
|
||||
}
|
||||
|
||||
+1
-1
@@ -94,7 +94,7 @@ public class KotlinInplacePropertyIntroducer(
|
||||
if (availableTargets.size() > 1) {
|
||||
addPanelControl(
|
||||
ControlWrapper {
|
||||
val propertyKindComboBox = with(JComboBox(availableTargets.map { it.name.capitalize() }.copyToArray())) {
|
||||
val propertyKindComboBox = with(JComboBox(availableTargets.map { it.name.capitalize() }.toTypedArray())) {
|
||||
addPopupMenuListener(
|
||||
object : PopupMenuListenerAdapter() {
|
||||
override fun popupMenuWillBecomeInvisible(e: PopupMenuEvent?) {
|
||||
|
||||
+3
-3
@@ -120,15 +120,15 @@ public class RenameKotlinPropertyProcessor : RenamePsiElementProcessor() {
|
||||
}
|
||||
|
||||
super.renameElement(element, PropertyCodegen.setterName(Name.identifier(newName!!)),
|
||||
refKindUsages[UsageKind.SETTER_USAGE]?.copyToArray() ?: array<UsageInfo>(),
|
||||
refKindUsages[UsageKind.SETTER_USAGE]?.toTypedArray() ?: arrayOf<UsageInfo>(),
|
||||
null)
|
||||
|
||||
super.renameElement(element, PropertyCodegen.getterName(Name.identifier(newName)),
|
||||
refKindUsages[UsageKind.GETTER_USAGE]?.copyToArray() ?: array<UsageInfo>(),
|
||||
refKindUsages[UsageKind.GETTER_USAGE]?.toTypedArray() ?: arrayOf<UsageInfo>(),
|
||||
null)
|
||||
|
||||
super.renameElement(element, newName,
|
||||
refKindUsages[UsageKind.SIMPLE_PROPERTY_USAGE]?.copyToArray() ?: array<UsageInfo>(),
|
||||
refKindUsages[UsageKind.SIMPLE_PROPERTY_USAGE]?.toTypedArray() ?: arrayOf<UsageInfo>(),
|
||||
null)
|
||||
|
||||
listener?.elementRenamed(element)
|
||||
|
||||
+1
-1
@@ -277,7 +277,7 @@ public class KotlinSafeDeleteProcessor : JavaSafeDeleteProcessor() {
|
||||
}
|
||||
}
|
||||
|
||||
return result.copyToArray()
|
||||
return result.toTypedArray()
|
||||
}
|
||||
|
||||
override fun prepareForDeletion(element: PsiElement) {
|
||||
|
||||
@@ -23,9 +23,9 @@ import com.intellij.diagnostic.AttachmentFactory
|
||||
public fun attachmentByPsiFileAsArray(file: PsiFile?): Array<Attachment> {
|
||||
val attachment = attachmentByPsiFile(file)
|
||||
if (attachment == null) {
|
||||
return array()
|
||||
return arrayOf()
|
||||
}
|
||||
return array(attachment)
|
||||
return arrayOf(attachment)
|
||||
}
|
||||
|
||||
public fun attachmentByPsiFile(file: PsiFile?): Attachment? {
|
||||
|
||||
+1
-1
@@ -249,7 +249,7 @@ public abstract class AbstractJetExtractionTest() : JetLightCodeInsightFixtureTe
|
||||
val extractionOptions = InTextDirectivesUtils.findListWithPrefixes(fileText, "// OPTIONS: ").let {
|
||||
if (it.isNotEmpty()) {
|
||||
@suppress("CAST_NEVER_SUCCEEDS")
|
||||
val args = it.map { it.toBoolean() }.copyToArray() as Array<Any?>
|
||||
val args = it.map { it.toBoolean() }.toTypedArray() as Array<Any?>
|
||||
javaClass<ExtractionOptions>().getConstructors().first { it.getParameterTypes().size() == args.size() }.newInstance(*args) as ExtractionOptions
|
||||
} else ExtractionOptions.DEFAULT
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ enum class MoveAction {
|
||||
val targetClassName = config.getString("targetClass")
|
||||
val visibility = config.getNullableString("visibility")
|
||||
|
||||
val options = MockMoveMembersOptions(targetClassName, array(member))
|
||||
val options = MockMoveMembersOptions(targetClassName, arrayOf(member))
|
||||
if (visibility != null) {
|
||||
options.setMemberVisibility(visibility)
|
||||
}
|
||||
@@ -145,7 +145,7 @@ enum class MoveAction {
|
||||
|
||||
MoveClassesOrPackagesProcessor(
|
||||
mainFile.getProject(),
|
||||
array(classToMove),
|
||||
arrayOf(classToMove),
|
||||
MultipleRootsMoveDestination(PackageWrapper(mainFile.getManager(), targetPackage)),
|
||||
/* searchInComments = */ false,
|
||||
/* searchInNonJavaFiles = */ true,
|
||||
@@ -162,7 +162,7 @@ enum class MoveAction {
|
||||
|
||||
MoveClassesOrPackagesProcessor(
|
||||
project,
|
||||
array(JavaPsiFacade.getInstance(project).findPackage(sourcePackage)!!),
|
||||
arrayOf(JavaPsiFacade.getInstance(project).findPackage(sourcePackage)!!),
|
||||
MultipleRootsMoveDestination(PackageWrapper(mainFile.getManager(), targetPackage)),
|
||||
/* searchInComments = */ false,
|
||||
/* searchInNonJavaFiles = */ true,
|
||||
@@ -180,7 +180,7 @@ enum class MoveAction {
|
||||
|
||||
MoveClassToInnerProcessor(
|
||||
project,
|
||||
array(classToMove),
|
||||
arrayOf(classToMove),
|
||||
JavaPsiFacade.getInstance(project).findClass(targetClass, project.allScope())!!,
|
||||
/* searchInComments = */ false,
|
||||
/* searchInNonJavaFiles = */ true,
|
||||
@@ -218,7 +218,7 @@ enum class MoveAction {
|
||||
ActionRunner.runInsideWriteAction { VfsUtil.createDirectoryIfMissing(rootDir, targetPackage.replace('.', '/')) }
|
||||
MoveFilesOrDirectoriesProcessor(
|
||||
project,
|
||||
array(mainFile),
|
||||
arrayOf(mainFile),
|
||||
JavaPsiFacade.getInstance(project).findPackage(targetPackage)!!.getDirectories()[0],
|
||||
/* searchInComments = */ false,
|
||||
/* searchInNonJavaFiles = */ true,
|
||||
@@ -231,7 +231,7 @@ enum class MoveAction {
|
||||
|
||||
MoveHandler.doMove(
|
||||
project,
|
||||
array(mainFile),
|
||||
arrayOf(mainFile),
|
||||
PsiManager.getInstance(project).findFile(rootDir.findFileByRelativePath(targetFile)!!)!!,
|
||||
/* dataContext = */ null,
|
||||
/* callback = */ null
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@ public abstract class AbstractKotlinFileStructureTest : JetLightCodeInsightFixtu
|
||||
|
||||
popup.setup()
|
||||
|
||||
val printInfo = PrintInfo(array("text"), array("location"))
|
||||
val printInfo = PrintInfo(arrayOf("text"), arrayOf("location"))
|
||||
val popupText = StructureViewUtil.print(popup.getTree(), false, printInfo, null)
|
||||
JetTestUtils.assertEqualsToFile(File("${FileUtil.getNameWithoutExtension(path)}.after"), popupText)
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ public object IdeaReferenceSearcher: ReferenceSearcher {
|
||||
if (searchKotlin) {
|
||||
fileTypes.add(JetLanguage.INSTANCE.getAssociatedFileType())
|
||||
}
|
||||
val searchScope = GlobalSearchScope.getScopeRestrictedByFileTypes(GlobalSearchScope.projectScope(element.getProject()), *fileTypes.copyToArray())
|
||||
val searchScope = GlobalSearchScope.getScopeRestrictedByFileTypes(GlobalSearchScope.projectScope(element.getProject()), *fileTypes.toTypedArray())
|
||||
return ReferencesSearch.search(element, searchScope).findAll()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -248,7 +248,7 @@ public class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR
|
||||
|
||||
val representativeTarget = chunk.representativeTarget()
|
||||
|
||||
fun concatenate(strings: Array<String>?, cp: List<String>) = arrayOf(*(strings ?: arrayOf<String>()), *cp.toTypedArray())
|
||||
fun concatenate(strings: Array<String>?, cp: List<String>) = arrayOf(*(strings ?: emptyArray()), *cp.toTypedArray())
|
||||
|
||||
for (argumentProvider in ServiceLoader.load(javaClass<KotlinJpsCompilerArgumentsProvider>())) {
|
||||
// appending to pluginOptions
|
||||
|
||||
@@ -348,7 +348,7 @@ public abstract class AbstractIncrementalJpsTest : JpsBuildTestCase() {
|
||||
val jdk = addJdk("my jdk")
|
||||
val moduleDependencies = readModuleDependencies()
|
||||
if (moduleDependencies == null) {
|
||||
addModule("module", array(getAbsolutePath("src")), null, null, jdk)
|
||||
addModule("module", arrayOf(getAbsolutePath("src")), null, null, jdk)
|
||||
|
||||
FileUtil.copyDir(testDataDir, File(workDir, "src"), { it.getName().endsWith(".kt") || it.getName().endsWith(".java") })
|
||||
|
||||
@@ -356,7 +356,7 @@ public abstract class AbstractIncrementalJpsTest : JpsBuildTestCase() {
|
||||
}
|
||||
else {
|
||||
val nameToModule = moduleDependencies.keySet()
|
||||
.keysToMap { addModule(it, array(getAbsolutePath(it + "/src")), null, null, jdk)!! }
|
||||
.keysToMap { addModule(it, arrayOf(getAbsolutePath(it + "/src")), null, null, jdk)!! }
|
||||
|
||||
for ((moduleName, dependencies) in moduleDependencies) {
|
||||
val module = nameToModule[moduleName]!!
|
||||
|
||||
@@ -31,7 +31,7 @@ import org.jetbrains.kotlin.resolve.diagnostics.SuppressDiagnosticsByAnnotations
|
||||
import org.jetbrains.kotlin.resolve.diagnostics.FUNCTION_NO_BODY_ERRORS
|
||||
import org.jetbrains.kotlin.resolve.diagnostics.PROPERTY_NOT_INITIALIZED_ERRORS
|
||||
|
||||
private val NATIVE_ANNOTATIONS = array(NATIVE.fqName, NATIVE_INVOKE.fqName, NATIVE_GETTER.fqName, NATIVE_SETTER.fqName)
|
||||
private val NATIVE_ANNOTATIONS = arrayOf(NATIVE.fqName, NATIVE_INVOKE.fqName, NATIVE_GETTER.fqName, NATIVE_SETTER.fqName)
|
||||
|
||||
public class SuppressUnusedParameterForJsNative : SuppressDiagnosticsByAnnotations(listOf(Errors.UNUSED_PARAMETER), *NATIVE_ANNOTATIONS)
|
||||
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ public object AndroidConst {
|
||||
|
||||
val ID_DECLARATION_PREFIX = "@+id/"
|
||||
val ID_USAGE_PREFIX = "@id/"
|
||||
val XML_ID_PREFIXES = array(ID_DECLARATION_PREFIX, ID_USAGE_PREFIX)
|
||||
val XML_ID_PREFIXES = arrayOf(ID_DECLARATION_PREFIX, ID_USAGE_PREFIX)
|
||||
|
||||
val CLEAR_FUNCTION_NAME = "clearFindViewByIdCache"
|
||||
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ public abstract class AndroidResourceManager(val project: Project) {
|
||||
|
||||
fun VirtualFile.getAllChildren(): List<VirtualFile> {
|
||||
val allChildren = arrayListOf<VirtualFile>()
|
||||
val currentChildren = getChildren() ?: array()
|
||||
val currentChildren = getChildren() ?: emptyArray()
|
||||
for (child in currentChildren) {
|
||||
if (child.isDirectory()) {
|
||||
allChildren.addAll(child.getAllChildren())
|
||||
|
||||
+2
-2
@@ -60,7 +60,7 @@ class AndroidFindMemberUsagesHandler(
|
||||
|
||||
val psiElements = parser?.resourceManager?.propertyToXmlAttributes(property)
|
||||
val valueElements = psiElements?.map { (it as? XmlAttribute)?.getValueElement() as? PsiElement }?.filterNotNull()
|
||||
if (valueElements != null && valueElements.isNotEmpty()) return valueElements.copyToArray()
|
||||
if (valueElements != null && valueElements.isNotEmpty()) return valueElements.toTypedArray()
|
||||
|
||||
return super.getPrimaryElements()
|
||||
}
|
||||
@@ -89,7 +89,7 @@ class AndroidFindMemberUsagesHandler(
|
||||
}
|
||||
}
|
||||
|
||||
if (res.isNotEmpty()) return res.copyToArray()
|
||||
if (res.isNotEmpty()) return res.toTypedArray()
|
||||
|
||||
return super.getSecondaryElements()
|
||||
}
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ public class AndroidGotoDeclarationHandler : GotoDeclarationHandler {
|
||||
val parser = ModuleServiceManager.getService(moduleInfo.module, javaClass<AndroidUIXmlProcessor>())
|
||||
val psiElements = parser.resourceManager.propertyToXmlAttributes(property)
|
||||
val valueElements = psiElements.map { (it as? XmlAttribute)?.getValueElement() as? PsiElement }.filterNotNull()
|
||||
if (valueElements.isNotEmpty()) return valueElements.copyToArray()
|
||||
if (valueElements.isNotEmpty()) return valueElements.toTypedArray()
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user