Get rid of 'class object' usages in code and builtins
Replace some comments and library usages as well
This commit is contained in:
+2
-2
@@ -48,7 +48,7 @@ public class ReferenceVariantsHelper(
|
||||
public val receivers: Collection<ReceiverValue>,
|
||||
public val callType: CallType
|
||||
) {
|
||||
class object {
|
||||
companion object {
|
||||
val Empty = ReceiversData(listOf(), CallType.NORMAL)
|
||||
}
|
||||
}
|
||||
@@ -216,7 +216,7 @@ public class ReferenceVariantsHelper(
|
||||
return resolutionScope.getDescriptorsFiltered(DescriptorKindFilter.PACKAGES, nameFilter).filter(visibilityFilter)
|
||||
}
|
||||
|
||||
class object {
|
||||
companion object {
|
||||
public fun getExplicitReceiverData(expression: JetSimpleNameExpression): Pair<JetExpression, CallType>? {
|
||||
val receiverExpression = expression.getReceiverExpression() ?: return null
|
||||
val parent = expression.getParent()
|
||||
|
||||
@@ -469,7 +469,7 @@ class PartialBodyResolveFilter(
|
||||
NEED_COMPLETION
|
||||
}
|
||||
|
||||
class object {
|
||||
companion object {
|
||||
private fun JetElement.blocks(): Collection<JetBlockExpression> {
|
||||
val result = ArrayList<JetBlockExpression>(1)
|
||||
this.accept(object : JetVisitorVoid() {
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ package org.jetbrains.kotlin.idea.actions.internal
|
||||
import com.intellij.ide.util.PropertiesComponent
|
||||
|
||||
public class KotlinInternalMode {
|
||||
public class object Instance {
|
||||
public companion object Instance {
|
||||
val INTERNAL_MODE_PROPERTY = "kotlin.internal.mode.enabled"
|
||||
|
||||
public var enabled: Boolean
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.jetbrains.kotlin.idea.stubindex.JetFunctionShortNameIndex
|
||||
|
||||
// used in Upsource, what's why in idea-analysis module
|
||||
public class JetShortNamesCache(private val project: com.intellij.openapi.project.Project) : com.intellij.psi.search.PsiShortNamesCache() {
|
||||
class object {
|
||||
companion object {
|
||||
public fun getKotlinInstance(project: com.intellij.openapi.project.Project): org.jetbrains.kotlin.idea.caches.JetShortNamesCache
|
||||
= com.intellij.openapi.extensions.Extensions.getArea(project).getExtensionPoint<com.intellij.psi.search.PsiShortNamesCache>(com.intellij.psi.search.PsiShortNamesCache.EP_NAME).getExtensions()
|
||||
.firstIsInstance<JetShortNamesCache>()
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@ import kotlin.platform.platformStatic
|
||||
private val LOG = Logger.getInstance(javaClass<KotlinCacheService>())
|
||||
|
||||
public class KotlinCacheService(val project: Project) {
|
||||
class object {
|
||||
companion object {
|
||||
platformStatic public fun getInstance(project: Project): KotlinCacheService = ServiceManager.getService(project, javaClass<KotlinCacheService>())!!
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ import com.intellij.codeInsight.ExternalAnnotationsListener
|
||||
import com.intellij.psi.PsiModifierListOwner
|
||||
|
||||
class LibraryModificationTracker(project: Project) : SimpleModificationTracker() {
|
||||
class object {
|
||||
companion object {
|
||||
platformStatic fun getInstance(project: Project) = ServiceManager.getService(project, javaClass<LibraryModificationTracker>())!!
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ private class ExceptionTrackerWithProcessCanceledReport() : ExceptionTracker() {
|
||||
}
|
||||
|
||||
|
||||
class object {
|
||||
companion object {
|
||||
val LOG = Logger.getInstance(javaClass<ExceptionTrackerWithProcessCanceledReport>())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ import com.intellij.openapi.util.SimpleModificationTracker
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
class ModuleTypeCacheManager private (project: Project) {
|
||||
class object {
|
||||
companion object {
|
||||
platformStatic fun getInstance(project: Project) = ServiceManager.getService(project, javaClass<ModuleTypeCacheManager>())
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -94,7 +94,7 @@ private fun getLibraryName(module: ModuleDescriptor): String? {
|
||||
|
||||
|
||||
class JsMetaFileVirtualFileHolder private(val myProject: Project) {
|
||||
class object {
|
||||
companion object {
|
||||
public val MODULE_DESCRIPTOR_KEY: Key<ModuleDescriptorImpl> = Key.create("MODULE_DESCRIPTOR")
|
||||
public val PACKAGE_FQNAME_KEY: Key<FqName> = Key.create("PACKAGE_FQNAME_KEY")
|
||||
private val JS_META_FILE_HOLDER_KEY: Key<JsMetaFileVirtualFileHolder> = Key.create("JS_META_FILE_HOLDER_KEY")
|
||||
|
||||
+1
-1
@@ -87,7 +87,7 @@ public open class KotlinClsStubBuilder : ClsStubBuilder() {
|
||||
return ClsStubBuilderComponents(classDataFinder, annotationLoader)
|
||||
}
|
||||
|
||||
class object {
|
||||
companion object {
|
||||
val LOG = Logger.getInstance(javaClass<KotlinClsStubBuilder>())
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -113,7 +113,7 @@ public class DeserializerForDecompiler(val packageDirectory: VirtualFile, val di
|
||||
return MutablePackageFragmentDescriptor(moduleDescriptor, fqName)
|
||||
}
|
||||
|
||||
class object {
|
||||
companion object {
|
||||
private val LOG = Logger.getInstance(javaClass<DeserializerForDecompiler>())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -222,7 +222,7 @@ public open class JetPsiChecker : Annotator, HighlightRangeExtension {
|
||||
}
|
||||
}
|
||||
|
||||
class object {
|
||||
companion object {
|
||||
var namesHighlightingEnabled = true
|
||||
[TestOnly] set
|
||||
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.analyze
|
||||
|
||||
public class OperatorToFunctionIntention : JetSelfTargetingIntention<JetExpression>("operator.to.function", javaClass()) {
|
||||
class object {
|
||||
companion object {
|
||||
private fun isApplicablePrefix(element: JetPrefixExpression): Boolean {
|
||||
return when (element.getOperationReference().getReferencedNameElementType()) {
|
||||
JetTokens.PLUS, JetTokens.MINUS, JetTokens.PLUSPLUS, JetTokens.MINUSMINUS, JetTokens.EXCL -> true
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ public class JetForLoopInReference(element: JetForExpression) : JetMultiReferenc
|
||||
return LOOP_RANGE_KEYS.map { key -> context.get(key, loopRange)?.getCandidateDescriptor() }.filterNotNull()
|
||||
}
|
||||
|
||||
class object {
|
||||
companion object {
|
||||
private val LOOP_RANGE_KEYS = array(
|
||||
BindingContext.LOOP_RANGE_ITERATOR_RESOLVED_CALL,
|
||||
BindingContext.LOOP_RANGE_NEXT_RESOLVED_CALL,
|
||||
|
||||
+1
-1
@@ -57,7 +57,7 @@ public data class UsagesSearchLocation(
|
||||
val inStrings: Boolean = false,
|
||||
val inPlainText: Boolean = true
|
||||
) {
|
||||
class object {
|
||||
companion object {
|
||||
public val DEFAULT: UsagesSearchLocation = UsagesSearchLocation()
|
||||
public val EVERYWHERE: UsagesSearchLocation = UsagesSearchLocation(true, true, true, true)
|
||||
}
|
||||
|
||||
+1
-1
@@ -78,7 +78,7 @@ public class SubpackagesIndexService(private val project: Project) {
|
||||
}
|
||||
}
|
||||
|
||||
class object {
|
||||
companion object {
|
||||
public fun getInstance(project: Project): SubpackagesIndex {
|
||||
return ServiceManager.getService(project, javaClass<SubpackagesIndexService>())!!.cachedValue.getValue()!!
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public abstract class ImportInsertHelper {
|
||||
|
||||
public abstract fun importDescriptor(file: JetFile, descriptor: DeclarationDescriptor): ImportDescriptorResult
|
||||
|
||||
class object {
|
||||
companion object {
|
||||
[platformStatic]
|
||||
public fun getInstance(project: Project): ImportInsertHelper
|
||||
= ServiceManager.getService<ImportInsertHelper>(project, javaClass<ImportInsertHelper>())
|
||||
|
||||
@@ -46,12 +46,12 @@ public class ShortenReferences(val options: (JetElement) -> Options = { Options.
|
||||
val removeThisLabels: Boolean = false,
|
||||
val removeThis: Boolean = false
|
||||
) {
|
||||
class object {
|
||||
companion object {
|
||||
val DEFAULT = Options()
|
||||
}
|
||||
}
|
||||
|
||||
class object {
|
||||
companion object {
|
||||
val DEFAULT = ShortenReferences()
|
||||
|
||||
private fun DeclarationDescriptor.asString()
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ import com.intellij.psi.PsiElement
|
||||
import org.jetbrains.kotlin.psi.JetPsiFactory
|
||||
|
||||
public trait SimpleNameReferenceExtension {
|
||||
class object {
|
||||
companion object {
|
||||
public val EP_NAME: ExtensionPointName<SimpleNameReferenceExtension> = ExtensionPointName.create("org.jetbrains.kotlin.simpleNameReferenceExtension")!!
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ public class CompilerSettings {
|
||||
public var copyJsLibraryFiles: Boolean = true
|
||||
public var outputDirectoryForJsLibraryFiles: String = DEFAULT_OUTPUT_DIRECTORY
|
||||
|
||||
class object {
|
||||
companion object {
|
||||
private val DEFAULT_ADDITIONAL_ARGUMENTS = "-version"
|
||||
private val DEFAULT_OUTPUT_DIRECTORY = "lib"
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ public class JetAddImportAction(
|
||||
JBPopupFactory.getInstance().createListPopup(getImportSelectionPopup()).showInBestPositionFor(editor)
|
||||
}
|
||||
|
||||
class object {
|
||||
companion object {
|
||||
|
||||
protected fun addImport(element: PsiElement, project: Project, selectedVariant: Variant) {
|
||||
PsiDocumentManager.getInstance(project).commitAllDocuments()
|
||||
|
||||
@@ -73,7 +73,7 @@ public class KotlinReferenceData(
|
||||
}
|
||||
}
|
||||
|
||||
class object {
|
||||
companion object {
|
||||
public val dataFlavor: DataFlavor? by Delegates.lazy {
|
||||
try {
|
||||
DataFlavor(DataFlavor.javaJVMLocalObjectMimeType + ";class=" + javaClass<KotlinReferenceData>().getName(), "KotlinReferenceData")
|
||||
|
||||
@@ -52,7 +52,7 @@ public class DeclarationDescriptorLookupObject(
|
||||
return descriptorsEqualWithSubstitution(descriptor, lookupObject.descriptor)
|
||||
}
|
||||
|
||||
class object {
|
||||
companion object {
|
||||
private val LOG = Logger.getInstance("#" + javaClass<DeclarationDescriptorLookupObject>().getName())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.jetbrains.kotlin.lexer.JetTokens
|
||||
import org.jetbrains.kotlin.psi.JetFunctionLiteral
|
||||
|
||||
public class KotlinCompletionCharFilter() : CharFilter() {
|
||||
class object {
|
||||
companion object {
|
||||
public val ACCEPT_OPENING_BRACE: Key<Boolean> = Key("KotlinCompletionCharFilter.ACCEPT_OPENNING_BRACE")
|
||||
|
||||
public val JUST_TYPING_PREFIX: Key<String> = Key("KotlinCompletionCharFilter.JUST_TYPING_PREFIX")
|
||||
|
||||
@@ -30,7 +30,7 @@ public class LeafElementFilter(private val elementType: IElementType) : ElementF
|
||||
override fun isClassAcceptable(hintClass: Class<*>)
|
||||
= LEAF_CLASS_FILTER.isClassAcceptable(hintClass)
|
||||
|
||||
class object {
|
||||
companion object {
|
||||
private val LEAF_CLASS_FILTER = ClassFilter(javaClass<LeafPsiElement>())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -255,7 +255,7 @@ public class LookupElementFactory(
|
||||
}
|
||||
}
|
||||
|
||||
class object {
|
||||
companion object {
|
||||
public fun getDefaultInsertHandler(descriptor: DeclarationDescriptor): InsertHandler<LookupElement> {
|
||||
return when (descriptor) {
|
||||
is FunctionDescriptor -> {
|
||||
|
||||
+1
-1
@@ -217,7 +217,7 @@ public class KotlinFunctionInsertHandler(val caretPosition : CaretPosition, val
|
||||
return caretPosition == CaretPosition.IN_BRACKETS
|
||||
}
|
||||
|
||||
class object {
|
||||
companion object {
|
||||
public val NO_PARAMETERS_HANDLER: KotlinFunctionInsertHandler = KotlinFunctionInsertHandler(CaretPosition.AFTER_BRACKETS, null)
|
||||
public val WITH_PARAMETERS_HANDLER: KotlinFunctionInsertHandler = KotlinFunctionInsertHandler(CaretPosition.IN_BRACKETS, null)
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ class WithTailInsertHandler(val tailText: String,
|
||||
}
|
||||
}
|
||||
|
||||
class object {
|
||||
companion object {
|
||||
fun commaTail() = WithTailInsertHandler(",", spaceBefore = false, spaceAfter = true /*TODO: use code style option*/)
|
||||
fun rparenthTail() = WithTailInsertHandler(")", spaceBefore = false, spaceAfter = false)
|
||||
fun elseTail() = WithTailInsertHandler("else", spaceBefore = true, spaceAfter = true)
|
||||
|
||||
@@ -473,7 +473,7 @@ class SmartCompletion(
|
||||
}
|
||||
}
|
||||
|
||||
class object {
|
||||
companion object {
|
||||
public val OLD_ARGUMENTS_REPLACEMENT_OFFSET: OffsetKey = OffsetKey.create("nonFunctionReplacementOffset")
|
||||
public val MULTIPLE_ARGUMENTS_REPLACEMENT_OFFSET: OffsetKey = OffsetKey.create("multipleArgumentsReplacementOffset")
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ fun LookupElement.addTailAndNameSimilarity(matchedExpectedInfos: Collection<Expe
|
||||
}
|
||||
|
||||
class ExpectedInfoClassification private(val substitutor: TypeSubstitutor?, val makeNotNullable: Boolean) {
|
||||
class object {
|
||||
companion object {
|
||||
val notMatches = ExpectedInfoClassification(null, false)
|
||||
fun matches(substitutor: TypeSubstitutor) = ExpectedInfoClassification(substitutor, false)
|
||||
fun matchesIfNotNullable(substitutor: TypeSubstitutor) = ExpectedInfoClassification(substitutor, true)
|
||||
|
||||
+1
-1
@@ -180,7 +180,7 @@ public class ConvertJavaCopyPastePostProcessor() : CopyPastePostProcessor<TextBl
|
||||
return dialog.isOK()
|
||||
}
|
||||
|
||||
class object {
|
||||
companion object {
|
||||
private val LOG = Logger.getInstance("#org.jetbrains.kotlin.idea.conversion.copy.ConvertJavaCopyPastePostProcessor")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ class CopiedCode(val fileName: String, val fileText: String, val startOffsets: I
|
||||
public override fun getOffsets(offsets: IntArray?, index: Int) = index
|
||||
public override fun setOffsets(offsets: IntArray?, index: Int) = index
|
||||
|
||||
class object {
|
||||
companion object {
|
||||
val DATA_FLAVOR: DataFlavor = DataFlavor(javaClass<ConvertJavaCopyPastePostProcessor>(), "class: ConvertJavaCopyPastePostProcessor")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ public class KotlinCoverageExtension(): JavaCoverageEngineExtension() {
|
||||
return false
|
||||
}
|
||||
|
||||
class object {
|
||||
companion object {
|
||||
private val LOG = Logger.getInstance(javaClass<KotlinCoverageExtension>())
|
||||
|
||||
fun collectGeneratedClassQualifiedNames(outputRoot: VirtualFile?, file: JetFile): List<String>? {
|
||||
|
||||
@@ -273,7 +273,7 @@ public class JetPositionManager(private val myDebugProcess: DebugProcess) : Mult
|
||||
myTypeMappers.put(key, value)
|
||||
}
|
||||
|
||||
class object {
|
||||
companion object {
|
||||
public fun createTypeMapper(file: JetFile): JetTypeMapper {
|
||||
val project = file.getProject()
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ public class KotlinDebuggerSettings : XDebuggerSettings<KotlinDebuggerSettings>(
|
||||
public var DEBUG_DISABLE_KOTLIN_INTERNAL_CLASSES: Boolean = true
|
||||
public var DEBUG_IS_FILTER_FOR_STDLIB_ALREADY_ADDED: Boolean = false
|
||||
|
||||
class object {
|
||||
companion object {
|
||||
public fun getInstance(): KotlinDebuggerSettings {
|
||||
return XDebuggerUtil.getInstance()?.getDebuggerSettings(javaClass<KotlinDebuggerSettings>())!!
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ class KotlinEditorTextProvider : EditorTextProvider {
|
||||
return Pair(expression, expressionRange)
|
||||
}
|
||||
|
||||
class object {
|
||||
companion object {
|
||||
|
||||
fun <T> getElementInfo(expr: JetExpression, f: (PsiElement) -> T): T {
|
||||
var expressionText = f(expr)
|
||||
|
||||
@@ -95,7 +95,7 @@ class KotlinCodeFragmentFactory: CodeFragmentFactory() {
|
||||
|
||||
override fun getEvaluatorBuilder() = KotlinEvaluationBuilder
|
||||
|
||||
class object {
|
||||
companion object {
|
||||
fun getContextElement(elementAt: PsiElement?): PsiElement? {
|
||||
if (elementAt == null) return null
|
||||
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ class KotlinEvaluateExpressionCache(val project: Project) {
|
||||
MultiMap.create(), PsiModificationTracker.MODIFICATION_COUNT)
|
||||
}, false)
|
||||
|
||||
class object {
|
||||
companion object {
|
||||
private val LOG = Logger.getLogger(javaClass<KotlinEvaluateExpressionCache>())!!
|
||||
|
||||
fun getInstance(project: Project) = ServiceManager.getService(project, javaClass<KotlinEvaluateExpressionCache>())!!
|
||||
|
||||
@@ -157,7 +157,7 @@ class KotlinEvaluator(val codeFragment: JetCodeFragment,
|
||||
return null
|
||||
}
|
||||
|
||||
class object {
|
||||
companion object {
|
||||
private fun extractAndCompile(codeFragment: JetCodeFragment, sourcePosition: SourcePosition, context: EvaluationContextImpl): CompiledDataDescriptor {
|
||||
codeFragment.checkForErrors()
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ public abstract class KotlinRuntimeTypeEvaluator(
|
||||
throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.surrounded.expression.null"))
|
||||
}
|
||||
|
||||
class object {
|
||||
companion object {
|
||||
private fun getCastableRuntimeType(project: Project, value: Value): JetType? {
|
||||
val myValue = value.asValue()
|
||||
var psiClass = myValue.asmType.getClassDescriptor(project)
|
||||
|
||||
@@ -36,7 +36,7 @@ import com.intellij.psi.tree.TokenSet
|
||||
import com.intellij.psi.PsiWhiteSpace
|
||||
|
||||
public class KotlinEnterHandler: EnterHandlerDelegateAdapter() {
|
||||
class object {
|
||||
companion object {
|
||||
private val LOG = Logger.getInstance(javaClass<KotlinEnterHandler>())
|
||||
private val FORCE_INDENT_IN_LAMBDA_AFTER = TokenSet.create(JetTokens.ARROW, JetTokens.LBRACE)
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ import org.jetbrains.kotlin.lexer.JetTokens
|
||||
import com.intellij.codeInsight.editorActions.ExtendWordSelectionHandlerBase
|
||||
|
||||
public class KotlinListSelectioner : ExtendWordSelectionHandlerBase() {
|
||||
class object {
|
||||
companion object {
|
||||
fun canSelect(e: PsiElement)
|
||||
= e is JetParameterList || e is JetValueArgumentList || e is JetTypeParameterList || e is JetTypeArgumentList
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ import org.jetbrains.kotlin.idea.JetIcons
|
||||
import org.jetbrains.kotlin.idea.project.TargetPlatform
|
||||
|
||||
public class KotlinTemplatesFactory : ProjectTemplatesFactory() {
|
||||
class object {
|
||||
companion object {
|
||||
public val KOTLIN_GROUP_NAME: String = "Kotlin"
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ import javax.swing.JComponent
|
||||
import javax.swing.JPanel
|
||||
|
||||
public class UnusedSymbolInspection : AbstractKotlinInspection() {
|
||||
class object {
|
||||
companion object {
|
||||
private val javaInspection = UnusedDeclarationInspection()
|
||||
|
||||
public fun isEntryPoint(declaration: JetNamedDeclaration): Boolean {
|
||||
|
||||
@@ -64,7 +64,7 @@ import org.jetbrains.kotlin.idea.util.ShortenReferences
|
||||
public class ConvertFunctionToPropertyIntention : JetSelfTargetingIntention<JetNamedFunction>(
|
||||
"convert.function.to.property.intention", javaClass()
|
||||
) {
|
||||
class object {
|
||||
companion object {
|
||||
private var JetNamedFunction.typeFqNameToAdd: String? by UserDataProperty(Key.create("TYPE_FQ_NAME_TO_ADD"))
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ public class ConvertToBlockBodyAction : PsiElementBaseIntentionAction() {
|
||||
convert(findDeclaration(element)!!)
|
||||
}
|
||||
|
||||
class object {
|
||||
companion object {
|
||||
fun convert(declaration: JetDeclarationWithBody): JetDeclarationWithBody {
|
||||
val body = declaration.getBodyExpression()!!
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ public class InsertExplicitTypeArguments : JetSelfTargetingIntention<JetCallExpr
|
||||
ShortenReferences.DEFAULT.process(element.getTypeArgumentList()!!)
|
||||
}
|
||||
|
||||
class object {
|
||||
companion object {
|
||||
fun createTypeArguments(element: JetCallExpression): JetTypeArgumentList? {
|
||||
val context = element.analyze()
|
||||
val resolvedCall = element.getResolvedCall(context)
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ import org.jetbrains.kotlin.psi.JetStringTemplateEntryWithExpression
|
||||
public class RemoveCurlyBracesFromTemplateIntention : JetSelfTargetingIntention<JetBlockStringTemplateEntry>(
|
||||
"remove.unnecessary.curly.brackets.from.string.template", javaClass()) {
|
||||
|
||||
class object {
|
||||
companion object {
|
||||
val INSTANCE = RemoveCurlyBracesFromTemplateIntention()
|
||||
val pattern = Pattern.compile("[a-zA-Z0-9_].*")
|
||||
}
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ public class ReplaceItWithExplicitFunctionLiteralParamIntention() : PsiElementBa
|
||||
return JetBundle.message("replace.it.with.explicit.function.literal.param.family")
|
||||
}
|
||||
|
||||
class object {
|
||||
companion object {
|
||||
fun isAutoCreatedIt(simpleNameExpression: JetSimpleNameExpression): Boolean {
|
||||
if (simpleNameExpression.getReferencedName() != "it") {
|
||||
return false
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.jetbrains.kotlin.types.expressions.OperatorConventions
|
||||
public class SwapBinaryExpression : JetSelfTargetingIntention<JetBinaryExpression>(
|
||||
"swap.binary.expression", javaClass()
|
||||
) {
|
||||
class object {
|
||||
companion object {
|
||||
val SUPPORTED_OPERATIONS = setOf(PLUS, MUL, OROR, ANDAND, EQEQ, EXCLEQ, EQEQEQ, EXCLEQEQEQ, GT, LT, GTEQ, LTEQ)
|
||||
|
||||
val SUPPORTED_OPERATION_NAMES = SUPPORTED_OPERATIONS.map { OperatorConventions.BINARY_OPERATION_NAMES[it]?.asString() }.toSet().filterNotNull() +
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ import com.intellij.util.WaitForProgressToShow
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
|
||||
public class CreateIncrementalCompilationBackup: AnAction("Create backup for debugging Kotlin incremental compilation") {
|
||||
class object {
|
||||
companion object {
|
||||
val BACKUP_DIR_NAME = ".backup"
|
||||
val PATCHES_TO_CREATE = 5
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ public class AddInitKeywordFix(element: JetClassInitializer) : JetIntentionActio
|
||||
addInitKeyword(file, element)
|
||||
}
|
||||
|
||||
class object Factory : JetSingleIntentionActionFactory() {
|
||||
companion object Factory : JetSingleIntentionActionFactory() {
|
||||
fun addInitKeyword(file: JetFile, element: JetClassInitializer) {
|
||||
if (element.hasInitKeyword()) return
|
||||
|
||||
@@ -79,7 +79,7 @@ public class AddInitKeywordFixInWholeProjectFix(elem: JetClassInitializer) : Jet
|
||||
}
|
||||
}
|
||||
|
||||
class object Factory : JetSingleIntentionActionFactory() {
|
||||
companion object Factory : JetSingleIntentionActionFactory() {
|
||||
override fun createAction(diagnostic: Diagnostic) =
|
||||
diagnostic.getPsiElement().getNonStrictParentOfType<JetClassInitializer>()?.let {
|
||||
AddInitKeywordFixInWholeProjectFix(it)
|
||||
|
||||
@@ -164,7 +164,7 @@ public class AutoImportFix(element: JetSimpleNameExpression) : JetHintAction<Jet
|
||||
PsiShortNamesCache.getInstance(jetFile.getProject())
|
||||
}
|
||||
|
||||
class object {
|
||||
companion object {
|
||||
private val ERRORS = setOf(Errors.UNRESOLVED_REFERENCE, Errors.UNRESOLVED_REFERENCE_WRONG_RECEIVER)
|
||||
|
||||
public fun createFactory(): JetSingleIntentionActionFactory {
|
||||
|
||||
@@ -33,7 +33,7 @@ public class ClassObjectToCompanionObjectFix(private val elem: JetObjectDeclarat
|
||||
classKeywordToCompanionModifier(elem)
|
||||
}
|
||||
|
||||
class object Factory : JetSingleIntentionActionFactory() {
|
||||
companion object Factory : JetSingleIntentionActionFactory() {
|
||||
override fun createAction(diagnostic: Diagnostic) =
|
||||
(diagnostic.getPsiElement() as? JetObjectDeclaration)?.let { ClassObjectToCompanionObjectFix(it) }
|
||||
|
||||
@@ -66,7 +66,7 @@ public class ClassObjectToCompanionObjectInWholeProjectFix(private val elem: Jet
|
||||
}
|
||||
}
|
||||
|
||||
class object Factory : JetSingleIntentionActionFactory() {
|
||||
companion object Factory : JetSingleIntentionActionFactory() {
|
||||
override fun createAction(diagnostic: Diagnostic) =
|
||||
(diagnostic.getPsiElement() as? JetObjectDeclaration)?.let { ClassObjectToCompanionObjectInWholeProjectFix(it) }
|
||||
}
|
||||
|
||||
+3
-3
@@ -183,7 +183,7 @@ abstract class OutputValueBoxer(val outputValues: List<OutputValue>) {
|
||||
assert(outputValues.size() <= 3, "At most 3 output values are supported")
|
||||
}
|
||||
|
||||
class object {
|
||||
companion object {
|
||||
private val selectors = array("first", "second", "third")
|
||||
}
|
||||
|
||||
@@ -330,7 +330,7 @@ enum class ExtractionTarget(val name: String) {
|
||||
|
||||
abstract fun isAvailable(descriptor: ExtractableCodeDescriptor): Boolean
|
||||
|
||||
class object {
|
||||
companion object {
|
||||
fun checkNotTrait(descriptor: ExtractableCodeDescriptor): Boolean {
|
||||
val parent = descriptor.extractionData.targetSibling.getStrictParentOfType<JetDeclaration>()
|
||||
return !(parent is JetClass && parent.isTrait())
|
||||
@@ -367,7 +367,7 @@ data class ExtractionGeneratorOptions(
|
||||
val allowDummyName: Boolean = false,
|
||||
val allowExpressionBody: Boolean = true
|
||||
) {
|
||||
class object {
|
||||
companion object {
|
||||
val DEFAULT = ExtractionGeneratorOptions()
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ data class ExtractionOptions(
|
||||
val extractAsProperty: Boolean = false,
|
||||
val allowSpecialClassNames: Boolean = false
|
||||
) {
|
||||
class object {
|
||||
companion object {
|
||||
val DEFAULT = ExtractionOptions()
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ public open class ExtractionEngineHelper {
|
||||
continuation(ExtractionGeneratorConfiguration(descriptorWithConflicts.descriptor, ExtractionGeneratorOptions.DEFAULT))
|
||||
}
|
||||
|
||||
class object {
|
||||
companion object {
|
||||
public val DEFAULT: ExtractionEngineHelper = ExtractionEngineHelper()
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -96,7 +96,7 @@ public class MoveKotlinTopLevelDeclarationsProcessor(
|
||||
val project: Project,
|
||||
val options: MoveKotlinTopLevelDeclarationsOptions,
|
||||
val mover: Mover = Mover.Default) : BaseRefactoringProcessor(project) {
|
||||
class object {
|
||||
companion object {
|
||||
private val LOG: Logger = Logger.getInstance(javaClass<MoveKotlinTopLevelDeclarationsProcessor>())
|
||||
|
||||
private val REFACTORING_NAME: String = JetRefactoringBundle.message("refactoring.move.top.level.declarations")
|
||||
|
||||
@@ -132,7 +132,7 @@ public class JetPsiUnifier(
|
||||
parameters: Collection<UnifierParameter> = Collections.emptySet(),
|
||||
val allowWeakMatches: Boolean = false
|
||||
) {
|
||||
class object {
|
||||
companion object {
|
||||
val DEFAULT = JetPsiUnifier()
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ import com.intellij.psi.PsiElement
|
||||
import com.intellij.find.findUsages.FindUsagesHandler
|
||||
|
||||
public trait KotlinFindUsagesHandlerDecorator {
|
||||
class object {
|
||||
companion object {
|
||||
public val EP_NAME: ExtensionPointName<KotlinFindUsagesHandlerDecorator> = ExtensionPointName.create("org.jetbrains.kotlin.findUsagesHandlerDecorator")!!
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fun main(args: Array<String>) {
|
||||
// class object usages
|
||||
// companion object usages
|
||||
Foo.f()
|
||||
val x = Foo
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fun main(args: Array<String>) {
|
||||
// class object usages
|
||||
// companion object usages
|
||||
Foo.f()
|
||||
val x = Foo
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fun main(args: Array<String>) {
|
||||
// class object usages
|
||||
// companion object usages
|
||||
Foo.f()
|
||||
val x = Foo
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fun main(args: Array<String>) {
|
||||
// class object usages
|
||||
// companion object usages
|
||||
Foo.f()
|
||||
val x = Foo
|
||||
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ import org.junit.Assert
|
||||
import junit.framework.AssertionFailedError
|
||||
|
||||
public abstract class AbstractReferenceResolveInLibrarySourcesTest : JetLightCodeInsightFixtureTestCase() {
|
||||
class object {
|
||||
companion object {
|
||||
private val REF_CARET_MARKER = "<ref-caret>"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user