Skip to content

Commit

Permalink
193: update APIs and fix deprecations 2
Browse files Browse the repository at this point in the history
  • Loading branch information
gregsh committed Oct 10, 2019
1 parent 8e0fa07 commit d9578ff
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 19 deletions.
4 changes: 2 additions & 2 deletions src/lang/clojure-colors.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ import com.intellij.openapi.project.Project
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.psi.TokenType
import com.intellij.psi.tree.IElementType
import com.intellij.util.containers.ContainerUtil
import org.intellij.clojure.parser.ClojureLexer
import org.intellij.clojure.psi.ClojureTypes.*
import java.util.concurrent.ConcurrentHashMap

object ClojureColors {
@JvmField val LINE_COMMENT = createTextAttributesKey("C_LINE_COMMENT", DefaultLanguageHighlighterColors.LINE_COMMENT)
Expand Down Expand Up @@ -81,7 +81,7 @@ object ClojureColors {
@JvmField val JAVA_INSTANCE_FIELD = createTextAttributesKey("C_JAVA_INSTANCE_FIELD", DefaultLanguageHighlighterColors.INSTANCE_FIELD)
@JvmField val JAVA_INSTANCE_METHOD = createTextAttributesKey("C_JAVA_INSTANCE_METHOD", DefaultLanguageHighlighterColors.INSTANCE_METHOD)

@JvmField val NS_COLORS: Map<String, TextAttributes> = ContainerUtil.newConcurrentMap()
@JvmField val NS_COLORS: Map<String, TextAttributes> = ConcurrentHashMap()
}

class ClojureSyntaxHighlighterFactory : SyntaxHighlighterFactory() {
Expand Down
5 changes: 2 additions & 3 deletions src/lang/clojure-editor-psi.kt
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ import com.intellij.util.ProcessingContext
import com.intellij.util.SingleAlarm
import com.intellij.util.SmartList
import com.intellij.util.concurrency.AppExecutorUtil
import com.intellij.util.containers.ContainerUtil
import com.intellij.util.containers.JBIterable
import com.intellij.util.indexing.FileBasedIndex
import org.intellij.clojure.ClojureConstants
Expand Down Expand Up @@ -228,7 +227,7 @@ class ClojureCompletionContributor : CompletionContributor() {
.substring(originalFile.text))

if (thisForm is CKeyword || thisForm == null) {
val visited = ContainerUtil.newTroveSet<String>(qualifiedResult.prefixMatcher.prefix)
val visited = hashSetOf(qualifiedResult.prefixMatcher.prefix)
val prefixNamespace = (thisForm as? CKeyword)?.namespace
val consumer: (String, String, VirtualFile) -> Unit = consumer@ { name, ns, file ->
if (!showAll && !noNsPrefix && ns != prefixNamespace) return@consumer
Expand Down Expand Up @@ -809,7 +808,7 @@ class ClojureParamInlayHintsHandler : InlayParameterHintsProvider {

override fun getHintInfo(element: PsiElement): HintInfo? = HintInfo.OptionInfo(OPTION)
override fun getDefaultBlackList(): Set<String> = emptySet()
override fun getSupportedOptions(): List<Option> = ContainerUtil.newSmartList(OPTION)
override fun getSupportedOptions(): List<Option> = SmartList(OPTION)
override fun isBlackListSupported(): Boolean = false

}
Expand Down
21 changes: 9 additions & 12 deletions src/lang/clojure-psi-java.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,7 @@ import com.intellij.psi.meta.PsiPresentableMetaData
import com.intellij.psi.scope.PsiScopeProcessor
import com.intellij.psi.search.FilenameIndex
import com.intellij.psi.search.GlobalSearchScope
import com.intellij.util.ArrayUtil
import com.intellij.util.ConcurrencyUtil
import com.intellij.util.IncorrectOperationException
import com.intellij.util.ObjectUtils
import com.intellij.util.*
import com.intellij.util.containers.ContainerUtil
import com.intellij.util.containers.JBIterable
import com.intellij.util.containers.JBTreeTraverser
Expand Down Expand Up @@ -468,7 +465,7 @@ abstract class JavaHelper {
override fun visitField(access: Int, name: String?, desc: String?, signature: String?, value: Any?): FieldVisitor? {
if (name == null) return null
val sig = ObjectUtils.chooseNotNull(signature, desc)
val types = processSignature(ContainerUtil.newSmartList(), sig, "${info.name}.$name}")
val types = processSignature(SmartList(), sig, "${info.name}.$name}")
val field = FieldInfo(name, info, access, if (types.isEmpty()) sig else types[0], sig)
info.fields.add(field)
return super.visitField(access, name, desc, signature, value)
Expand Down Expand Up @@ -807,10 +804,10 @@ abstract class JavaHelper {

private class ClassInfo(val name: String, val url: String) {
var superClass: String = CommonClassNames.JAVA_LANG_OBJECT
val interfaces: MutableList<String> = ContainerUtil.newSmartList()
val annotations: MutableList<String> = ContainerUtil.newSmartList()
val methods: MutableList<MethodInfo> = ContainerUtil.newSmartList()
val fields: MutableList<FieldInfo> = ContainerUtil.newSmartList()
val interfaces: MutableList<String> = SmartList()
val annotations: MutableList<String> = SmartList()
val methods: MutableList<MethodInfo> = SmartList()
val fields: MutableList<FieldInfo> = SmartList()

override fun toString() = "Class {$name}"
}
Expand All @@ -820,16 +817,16 @@ abstract class JavaHelper {
private class MethodInfo(name: String, declaringClass: ClassInfo, val modifiers: Int, val signature: String) :
MemberInfo(name, declaringClass) {
val scope = if ("<init>" == name) Scope.INIT else if (Modifier.isStatic(modifiers)) Scope.STATIC else Scope.INSTANCE
val annotations: MutableList<String> = ContainerUtil.newSmartList()
val types: MutableList<String> = ContainerUtil.newSmartList()
val annotations: MutableList<String> = SmartList()
val types: MutableList<String> = SmartList()

override fun toString() = "Method {$name(), $types, @$annotations}"
}

private class FieldInfo(name: String, declaringClass: ClassInfo, val modifiers: Int, val type: String, val signature: String) :
MemberInfo(name, declaringClass) {
val scope = if (Modifier.isStatic(modifiers)) Scope.STATIC else Scope.INSTANCE
val annotations: MutableList<String> = ContainerUtil.newSmartList()
val annotations: MutableList<String> = SmartList()

override fun toString() = "Field {$name, $type, @$annotations}"
}
Expand Down
4 changes: 2 additions & 2 deletions src/tools/tools-deps.kt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ import com.intellij.openapi.vfs.LocalFileSystem
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.psi.search.FilenameIndex
import com.intellij.psi.search.ProjectScope
import com.intellij.util.containers.ContainerUtil
import com.intellij.util.io.SafeFileOutputStream
import org.intellij.clojure.lang.ClojureLanguage
import org.intellij.clojure.lang.usages.CljLib
Expand All @@ -51,6 +50,7 @@ import org.intellij.clojure.util.*
import java.io.File
import java.io.PrintWriter
import java.util.*
import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.atomic.AtomicBoolean

/**
Expand Down Expand Up @@ -80,7 +80,7 @@ private class ClojureProjectDeps(val project: Project) {
}

val cacheFile = File(PathManager.getSystemPath(), "clojure/deps-${project.locationHash}.txt")
val mapping: MutableMap<String, List<Dependency>> = ContainerUtil.newConcurrentMap()
val mapping: MutableMap<String, List<Dependency>> = ConcurrentHashMap()
val allDependencies: Set<VirtualFile> get() = mapping.values.jbIt()
.flatten { it }
.transform(::resolveDependency)
Expand Down

0 comments on commit d9578ff

Please sign in to comment.