Remove deprecated usages of ContainerUtil

This commit is contained in:
Alexander Udalov
2020-08-13 18:29:18 +02:00
parent 2428c180c2
commit 0ef4b22cf3
11 changed files with 32 additions and 35 deletions
@@ -16,13 +16,13 @@
package org.jetbrains.kotlin.load.java.structure.impl.classFiles
import com.intellij.util.containers.ContainerUtil
import com.intellij.util.containers.StringInterner
import org.jetbrains.kotlin.builtins.PrimitiveType
import org.jetbrains.kotlin.load.java.structure.JavaClassifierType
import org.jetbrains.kotlin.load.java.structure.JavaType
import org.jetbrains.kotlin.load.java.structure.JavaTypeParameter
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.utils.SmartList
import org.jetbrains.kotlin.utils.addToStdlib.flattenTo
import org.jetbrains.kotlin.utils.compact
import org.jetbrains.org.objectweb.asm.Type
@@ -44,7 +44,7 @@ class BinaryClassSignatureParser {
return emptyList()
}
val typeParameters = ContainerUtil.newArrayList<JavaTypeParameter>()
val typeParameters = arrayListOf<JavaTypeParameter>()
signature.next()
while (signature.current() != '>') {
typeParameters.add(parseTypeParameter(signature, context))
@@ -65,7 +65,7 @@ class BinaryClassSignatureParser {
val parameterName = name.toString()
// postpone list allocation till a second bound is seen; ignore sole Object bound
val bounds: MutableList<JavaClassifierType> = ContainerUtil.newSmartList()
val bounds: MutableList<JavaClassifierType> = SmartList()
while (signature.current() == ':') {
signature.next()
val bound = parseClassifierRefSignature(signature, context) ?: continue
@@ -110,7 +110,7 @@ class BinaryClassSignatureParser {
): JavaClassifierType {
val canonicalName = StringBuilder()
val argumentGroups = ContainerUtil.newSmartList<List<JavaType>>()
val argumentGroups = SmartList<List<JavaType>>()
signature.next()
while (signature.current() != ';' && signature.current() != CharacterIterator.DONE) {
@@ -18,13 +18,13 @@ package org.jetbrains.kotlin.load.java.structure.impl.classFiles
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.psi.search.SearchScope
import com.intellij.util.containers.ContainerUtil
import gnu.trove.THashMap
import org.jetbrains.kotlin.builtins.PrimitiveType
import org.jetbrains.kotlin.load.java.structure.*
import org.jetbrains.kotlin.load.java.structure.impl.VirtualFileBoundJavaClass
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.utils.SmartList
import org.jetbrains.kotlin.utils.addIfNotNull
import org.jetbrains.org.objectweb.asm.*
import java.text.CharacterIterator
@@ -41,7 +41,7 @@ class BinaryJavaClass(
) : ClassVisitor(ASM_API_VERSION_FOR_CLASS_READING), VirtualFileBoundJavaClass, BinaryJavaModifierListOwner, MapBasedJavaAnnotationOwner {
private lateinit var myInternalName: String
override val annotations: MutableCollection<JavaAnnotation> = ContainerUtil.newSmartList()
override val annotations: MutableCollection<JavaAnnotation> = SmartList()
override lateinit var typeParameters: List<JavaTypeParameter>
override lateinit var supertypes: Collection<JavaClassifierType>
override val methods = arrayListOf<JavaMethod>()
@@ -150,7 +150,7 @@ class BinaryJavaClass(
.parseTypeParametersDeclaration(iterator, context)
.also(context::addTypeParameters)
val supertypes = ContainerUtil.newSmartList<JavaClassifierType>()
val supertypes = SmartList<JavaClassifierType>()
supertypes.addIfNotNull(signatureParser.parseClassifierRefSignature(iterator, context))
while (iterator.current() != CharacterIterator.DONE) {
supertypes.addIfNotNull(signatureParser.parseClassifierRefSignature(iterator, context))
@@ -17,10 +17,10 @@
package org.jetbrains.kotlin.load.java.structure.impl.classFiles
import com.intellij.util.cls.ClsFormatException
import com.intellij.util.containers.ContainerUtil
import org.jetbrains.kotlin.load.java.structure.*
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.name.SpecialNames
import org.jetbrains.kotlin.utils.SmartList
import org.jetbrains.kotlin.utils.compact
import org.jetbrains.org.objectweb.asm.MethodVisitor
import org.jetbrains.org.objectweb.asm.Opcodes
@@ -37,7 +37,7 @@ abstract class BinaryJavaMethodBase(
) : JavaMember, MapBasedJavaAnnotationOwner, BinaryJavaModifierListOwner {
override val annotationsByFqName by buildLazyValueForMap()
override val annotations: Collection<JavaAnnotation> = ContainerUtil.newSmartList()
override val annotations: Collection<JavaAnnotation> = SmartList()
companion object {
private class MethodInfo(
@@ -80,13 +80,10 @@ abstract class BinaryJavaMethodBase(
}
val parameterTypes = info.valueParameterTypes
val parameterList = ContainerUtil.newArrayList<BinaryJavaValueParameter>()
val paramCount = parameterTypes.size
for (i in 0 until paramCount) {
val type = parameterTypes[i]
val parameterList = parameterTypes.mapIndexed { i, type ->
val isEllipsisParam = isVarargs && i == paramCount - 1
parameterList.add(BinaryJavaValueParameter(type, isEllipsisParam))
BinaryJavaValueParameter(type, isEllipsisParam)
}
val member: BinaryJavaMethodBase =
@@ -95,7 +92,7 @@ abstract class BinaryJavaMethodBase(
else
BinaryJavaMethod(
access, containingClass,
parameterList.compact(),
parameterList,
info.typeParameters,
Name.identifier(name), info.returnType
)
@@ -142,7 +139,7 @@ abstract class BinaryJavaMethodBase(
paramTypes = emptyList()
}
else {
paramTypes = ContainerUtil.newArrayList()
paramTypes = mutableListOf()
while (iterator.current() != ')' && iterator.current() != CharacterIterator.DONE) {
paramTypes.add(signatureParser.parseTypeString(iterator, context))
}
@@ -16,10 +16,10 @@
package org.jetbrains.kotlin.load.java.structure.impl.classFiles
import com.intellij.util.containers.ContainerUtil
import org.jetbrains.kotlin.load.java.structure.*
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.utils.SmartList
import org.jetbrains.org.objectweb.asm.ClassReader
import org.jetbrains.org.objectweb.asm.ClassVisitor
@@ -31,7 +31,7 @@ class BinaryJavaField(
override val type: JavaType,
override val initializerValue: Any?
) : JavaField, MapBasedJavaAnnotationOwner, BinaryJavaModifierListOwner {
override val annotations: MutableCollection<JavaAnnotation> = ContainerUtil.newSmartList()
override val annotations: MutableCollection<JavaAnnotation> = SmartList()
override val annotationsByFqName by buildLazyValueForMap()
override val hasConstantNotNullInitializer: Boolean
@@ -53,7 +53,7 @@ class BinaryJavaValueParameter(
override val type: JavaType,
override val isVararg: Boolean
) : JavaValueParameter, MapBasedJavaAnnotationOwner {
override val annotations: MutableCollection<JavaAnnotation> = ContainerUtil.newSmartList()
override val annotations: MutableCollection<JavaAnnotation> = SmartList()
override val annotationsByFqName by buildLazyValueForMap()
override var name: Name? = null
@@ -16,10 +16,10 @@
package org.jetbrains.kotlin.load.java.structure.impl.classFiles
import com.intellij.util.containers.ContainerUtil
import org.jetbrains.kotlin.builtins.PrimitiveType
import org.jetbrains.kotlin.load.java.structure.*
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.utils.SmartList
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
// They are only used for java class files, but potentially may be used in other cases
@@ -47,7 +47,7 @@ internal class PlainJavaClassifierType(
internal fun addAnnotation(annotation: JavaAnnotation) {
if (_annotations.isEmpty()) {
_annotations = ContainerUtil.newSmartList()
_annotations = SmartList()
}
(_annotations as MutableList).add(annotation)