Replace 'class object' with default object in project code

This commit is contained in:
Pavel V. Talanov
2015-03-10 15:33:19 +03:00
parent dc7bb32a3b
commit 9ecf95532e
118 changed files with 130 additions and 130 deletions
@@ -76,7 +76,7 @@ class PlatformStaticGenerator(
)
}
class object {
default object {
[platformStatic]
public fun createStaticFunctionDescriptor(descriptor: FunctionDescriptor): FunctionDescriptor {
val memberDescriptor = if (descriptor is PropertyAccessorDescriptor) descriptor.getCorrespondingProperty() else descriptor
@@ -27,7 +27,7 @@ import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.resolve.*
public trait ExpressionCodegenExtension {
class object : ProjectExtensionDescriptor<ExpressionCodegenExtension>("org.jetbrains.kotlin.expressionCodegenExtension", javaClass<ExpressionCodegenExtension>())
default object : ProjectExtensionDescriptor<ExpressionCodegenExtension>("org.jetbrains.kotlin.expressionCodegenExtension", javaClass<ExpressionCodegenExtension>())
public class Context(
public val typeMapper: JetTypeMapper,
@@ -34,7 +34,7 @@ import org.jetbrains.kotlin.resolve.DescriptorUtils
public class ReifiedTypeInliner(private val parametersMapping: ReifiedTypeParameterMappings?) {
class object {
default object {
public val NEW_ARRAY_MARKER_METHOD_NAME: String = "reifyNewArray"
public val CHECKCAST_MARKER_METHOD_NAME: String = "reifyCheckcast"
public val INSTANCEOF_MARKER_METHOD_NAME: String = "reifyInstanceof"
@@ -23,7 +23,7 @@ import org.jetbrains.kotlin.name.Name
abstract class JavaAnnotationArgumentImpl(
override val name: Name?
) : JavaAnnotationArgument {
class object Factory {
default object Factory {
fun create(argument: PsiAnnotationMemberValue, name: Name?): JavaAnnotationArgument {
val value = JavaPsiFacade.getInstance(argument.getProject()).getConstantEvaluationHelper().computeConstantExpression(argument)
if (value is Enum<*>) {
@@ -47,7 +47,7 @@ public class VirtualFileKotlinClass private(
override fun hashCode() = file.hashCode()
override fun toString() = "${javaClass.getSimpleName()}: $file"
class object Factory {
default object Factory {
private val LOG = Logger.getInstance(javaClass<VirtualFileKotlinClass>())
deprecated("Use KotlinBinaryClassCache")
@@ -47,7 +47,7 @@ public class JvmDeclarationOrigin(
public val element: PsiElement?,
public val descriptor: DeclarationDescriptor?
) {
class object {
default object {
public val NO_ORIGIN: JvmDeclarationOrigin = JvmDeclarationOrigin(OTHER, null, null)
}
}
@@ -39,7 +39,7 @@ public data open class AnalysisResult protected (
private class Error(bindingContext: BindingContext, val exception: Throwable) : AnalysisResult(bindingContext, ErrorUtils.getErrorModule())
class object {
default object {
public val EMPTY: AnalysisResult = success(BindingContext.EMPTY, ErrorUtils.getErrorModule())
platformStatic public fun success(bindingContext: BindingContext, module: ModuleDescriptor): AnalysisResult {
@@ -75,7 +75,7 @@ public class ReadValueInstruction private (
override fun createCopy(): InstructionImpl =
ReadValueInstruction(element, lexicalScope, target, receiverValues, outputValue)
class object Factory {
default object Factory {
public fun create (
element: JetElement,
lexicalScope: LexicalScope,
@@ -79,7 +79,7 @@ public class CallInstruction private(
override fun toString() =
renderInstruction("call", "${render(element)}, ${resolvedCall.getResultingDescriptor()!!.getName()}")
class object Factory {
default object Factory {
fun create (
element: JetElement,
lexicalScope: LexicalScope,
@@ -115,7 +115,7 @@ public class MagicInstruction(
override fun toString() = renderInstruction("magic[$kind]", render(element))
class object Factory {
default object Factory {
fun create(
element: JetElement,
valueElement: JetElement?,
@@ -165,7 +165,7 @@ class MergeInstruction private(
override fun toString() = renderInstruction("merge", render(element))
class object Factory {
default object Factory {
fun create(
element: JetElement,
lexicalScope: LexicalScope,
@@ -21,7 +21,7 @@ import org.jetbrains.kotlin.analyzer.ModuleInfo
import org.jetbrains.kotlin.psi.JetFile
public trait ExternalDeclarationsProvider {
class object : ProjectExtensionDescriptor<ExternalDeclarationsProvider>(
default object : ProjectExtensionDescriptor<ExternalDeclarationsProvider>(
"org.jetbrains.kotlin.externalDeclarationsProvider",
javaClass<ExternalDeclarationsProvider>()
)
@@ -29,7 +29,7 @@ import kotlin.platform.*
* Parses the contents of a Markdown link in KDoc. Uses the standard Kotlin lexer.
*/
class KDocLinkParser(): PsiParser {
class object {
default object {
platformStatic public fun parseMarkdownLink(root: IElementType, chameleon: ASTNode): ASTNode {
val parentElement = chameleon.getTreeParent().getPsi()
val project = parentElement.getProject()
@@ -147,7 +147,7 @@ public abstract class JetCodeFragment(
}
}
class object {
default object {
public val IMPORT_SEPARATOR: String = ","
public val RUNTIME_TYPE_EVALUATOR: Key<Function1<JetExpression, JetType?>> = Key.create("RUNTIME_TYPE_EVALUATOR")
}
@@ -50,7 +50,7 @@ abstract class JetSimpleNameExpressionImpl(node: ASTNode) : JetExpressionImpl(no
override fun getReferencedName() = getReferencedNameImpl()
//NOTE: an unfortunate way to share an implementation between stubbed and not stubbed tree
class object Helper {
default object Helper {
fun JetSimpleNameExpression.getReferencedNameElementTypeImpl(): IElementType {
return this.getReferencedNameElement().getNode()!!.getElementType()!!
@@ -73,7 +73,7 @@ public open class KotlinStubBaseImpl<T : JetElementImplStub<*>>(parent: StubElem
return methodName
}
class object {
default object {
private val LOGGER: Logger = Logger.getInstance(javaClass<KotlinStubBaseImpl<JetElementImplStub<*>>>())
private val BASE_STUB_INTERFACES = listOf(javaClass<KotlinStubWithFqName<*>>(), javaClass<KotlinClassOrObjectStub<*>>(), javaClass<NamedStub<*>>())
@@ -25,7 +25,7 @@ public trait CodeAnalyzerInitializer {
public fun initialize(trace: BindingTrace, module: ModuleDescriptor, codeAnalyzer: KotlinCodeAnalyzer?)
public fun createTrace(): BindingTrace
class object {
default object {
public fun getInstance(project: Project): CodeAnalyzerInitializer =
ServiceManager.getService<CodeAnalyzerInitializer>(project, javaClass<CodeAnalyzerInitializer>())!!
}
@@ -28,7 +28,7 @@ public class CompositeBindingContext private (
private val delegates: List<BindingContext>
) : BindingContext {
class object {
default object {
public fun create(delegates: List<BindingContext>): BindingContext {
if (delegates.isEmpty()) return BindingContext.EMPTY
if (delegates.size() == 1) return delegates.first()
@@ -25,7 +25,7 @@ public open class StatementFilter {
public open val filter: ((JetElement) -> Boolean)?
get() = null
class object {
default object {
public val NONE: StatementFilter = StatementFilter()
}
}
@@ -306,7 +306,7 @@ public class TypeResolver(
return classifierDescriptor
}
class object {
default object {
[platformStatic]
public fun resolveProjectionKind(projectionKind: JetProjectionKind): Variance {
return when (projectionKind) {
@@ -79,7 +79,7 @@ class VarianceChecker(private val trace: BindingTrace) {
val occurrencePosition: Variance
)
class object {
default object {
platformStatic fun recordPrivateToThisIfNeeded(trace: BindingTrace, descriptor: CallableMemberDescriptor) {
if (isIrrelevant(descriptor) || descriptor.getVisibility() != Visibilities.PRIVATE) return
@@ -47,8 +47,8 @@ public class CallableDescriptorCollectors<D : CallableDescriptor>(val collectors
Iterable<CallableDescriptorCollector<D>> {
override fun iterator(): Iterator<CallableDescriptorCollector<D>> = collectors.iterator()
[suppress("UNCHECKED_CAST")]
class object {
[suppress("UNCHECKED_CAST")] default
object {
public val FUNCTIONS_AND_VARIABLES: CallableDescriptorCollectors<CallableDescriptor> =
CallableDescriptorCollectors(listOf(
FUNCTIONS_COLLECTOR as CallableDescriptorCollector<CallableDescriptor>,
@@ -38,7 +38,7 @@ import kotlin.platform.platformStatic
public class ConstantExpressionEvaluator private (val trace: BindingTrace) : JetVisitor<CompileTimeConstant<*>, JetType>() {
class object {
default object {
platformStatic public fun evaluate(expression: JetExpression, trace: BindingTrace, expectedType: JetType? = TypeUtils.NO_EXPECTED_TYPE): CompileTimeConstant<*>? {
val evaluator = ConstantExpressionEvaluator(trace)
return evaluator.evaluate(expression, expectedType)
@@ -36,7 +36,7 @@ public trait Diagnostics : Iterable<Diagnostic> {
override fun iterator() = all().iterator()
class object {
default object {
public val EMPTY: Diagnostics = object : Diagnostics {
override fun noSuppression(): Diagnostics = this
override val modificationTracker: ModificationTracker = ModificationTracker.NEVER_CHANGED
@@ -55,7 +55,7 @@ class LazyFileScope private(
}
}
class object Factory {
default object Factory {
public fun create(
resolveSession: ResolveSession,
file: JetFile,
@@ -35,7 +35,7 @@ public abstract class DeclarationProviderFactoryService {
filesScope: GlobalSearchScope
): DeclarationProviderFactory
class object {
default object {
public platformStatic fun createDeclarationProviderFactory(
project: Project,
storageManager: StorageManager,
@@ -298,7 +298,7 @@ public open class LazyClassMemberScope(
// Do not add details here, they may compromise the laziness during debugging
override fun toString() = "lazy scope for class ${thisDescriptor.getName()}"
class object {
default object {
private val GENERATE_CONSTRUCTORS_FOR = setOf(ClassKind.CLASS,
ClassKind.ANNOTATION_CLASS,
ClassKind.OBJECT,
@@ -87,7 +87,7 @@ public class KotlinCodeBlockModificationListener(modificationTracker: PsiModific
}
}
class object {
default object {
private val LOG = Logger.getInstance("#org.jetbrains.kotlin.asJava.JetCodeBlockModificationListener")
private fun containsClassesInside(element: PsiElement?): Boolean {
@@ -65,7 +65,7 @@ public class KotlinLightClassForPackage private(
}
}
class object {
default object {
public fun getInstance(project: Project): FileStubCache {
return ServiceManager.getService<FileStubCache>(project, javaClass<FileStubCache>())
}
@@ -214,7 +214,7 @@ public class KotlinLightClassForPackage private(
}
}
class object Factory {
default object Factory {
public fun create(
manager: PsiManager,
qualifiedName: FqName,
@@ -21,7 +21,7 @@ import org.jetbrains.kotlin.config.CompilerConfigurationKey
import org.jetbrains.kotlin.config.CompilerConfiguration
public trait ComponentRegistrar {
class object {
default object {
public val PLUGIN_COMPONENT_REGISTRARS: CompilerConfigurationKey<MutableList<ComponentRegistrar>> = CompilerConfigurationKey.create("plugin component registrars")
}
@@ -165,7 +165,7 @@ public class MultiModuleJavaAnalysisCustomTest : UsefulTestCase() {
)
}
class object {
default object {
val PATH_TO_TEST_ROOT_DIR = "compiler/testData/multiModule/java/custom"
}
}
@@ -108,7 +108,7 @@ public abstract class AbstractEvaluateExpressionTest : AbstractAnnotationDescrip
}
}
class object {
default object {
val pattern = Pattern.compile(".+(?=:)")
}
}
@@ -19,7 +19,7 @@ package org.jetbrains.kotlin.config
import java.util.HashMap
public class Services private(private val map: Map<Class<*>, Any>) {
class object {
default object {
public val EMPTY: Services = Builder().build()
}
@@ -22,7 +22,7 @@ import org.jetbrains.kotlin.name.Name
// The purpose of this class is to hold a unique signature of either a method or a field, so that annotations on a member can be put
// into a map indexed by these signatures
data class MemberSignature private(private val signature: String) {
class object {
default object {
platformStatic public fun fromMethodNameAndDesc(nameAndDesc: String): MemberSignature {
return MemberSignature(nameAndDesc)
}
@@ -26,7 +26,7 @@ public trait Annotations : Iterable<AnnotationDescriptor> {
public fun findAnnotation(fqName: FqName): AnnotationDescriptor?
class object {
default object {
public val EMPTY: Annotations = object : Annotations {
override fun isEmpty() = true
@@ -76,7 +76,7 @@ public trait JetScope {
}
}
class object {
default object {
public val ALL_NAME_FILTER: (Name) -> Boolean = { true }
}
}
@@ -141,7 +141,7 @@ public class DescriptorKindFilter(
}
}
class object {
default object {
public val NON_SINGLETON_CLASSIFIERS_MASK: Int = 0x01
public val SINGLETON_CLASSIFIERS_MASK: Int = 0x02
public val PACKAGES_MASK: Int = 0x04
@@ -33,7 +33,7 @@ public trait FlexibleTypeCapabilities {
}
public trait Flexibility : TypeCapability, SubtypingRepresentatives {
class object {
default object {
// This is a "magic" classifier: when type resolver sees it in the code, e.g. ft<Foo, Foo?>, instead of creating a normal type,
// it creates a flexible type, e.g. (Foo..Foo?).
// This is used in tests and Evaluate Expression to have flexible types in the code,
@@ -145,7 +145,7 @@ public open class DelegatingFlexibleType protected (
override val upperBound: JetType,
override val extraCapabilities: FlexibleTypeCapabilities
) : DelegatingType(), NullAwareness, Flexibility, FlexibleTypeDelegation, Approximation {
class object {
default object {
platformStatic fun create(lowerBound: JetType, upperBound: JetType, extraCapabilities: FlexibleTypeCapabilities): JetType {
if (lowerBound == upperBound) return lowerBound
return DelegatingFlexibleType(lowerBound, upperBound, extraCapabilities)
@@ -30,7 +30,7 @@ enum class PrimitiveType {
BOOLEAN
val capitalized: String get() = name().toLowerCase().capitalize()
class object {
default object {
val exceptBoolean: Iterable<PrimitiveType> by Delegates.lazy { PrimitiveType.values().filterNot { it == BOOLEAN } }
}
}
@@ -48,7 +48,7 @@ public class ReferenceVariantsHelper(
public val receivers: Collection<ReceiverValue>,
public val callType: CallType
) {
class object {
default object {
val Empty = ReceiversData(listOf(), CallType.NORMAL)
}
}
@@ -216,7 +216,7 @@ public class ReferenceVariantsHelper(
return resolutionScope.getDescriptorsFiltered(DescriptorKindFilter.PACKAGES, nameFilter).filter(visibilityFilter)
}
class object {
default 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 {
default object {
private fun JetElement.blocks(): Collection<JetBlockExpression> {
val result = ArrayList<JetBlockExpression>(1)
this.accept(object : JetVisitorVoid() {
@@ -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 default 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 {
default 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>()
@@ -45,7 +45,7 @@ import kotlin.platform.platformStatic
private val LOG = Logger.getInstance(javaClass<KotlinCacheService>())
public class KotlinCacheService(val project: Project) {
class object {
default object {
platformStatic public fun getInstance(project: Project): KotlinCacheService = ServiceManager.getService(project, javaClass<KotlinCacheService>())!!
}
@@ -31,7 +31,7 @@ import com.intellij.codeInsight.ExternalAnnotationsListener
import com.intellij.psi.PsiModifierListOwner
class LibraryModificationTracker(project: Project) : SimpleModificationTracker() {
class object {
default object {
platformStatic fun getInstance(project: Project) = ServiceManager.getService(project, javaClass<LibraryModificationTracker>())!!
}
@@ -43,7 +43,7 @@ private class ExceptionTrackerWithProcessCanceledReport() : ExceptionTracker() {
}
class object {
default 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 {
default object {
platformStatic fun getInstance(project: Project) = ServiceManager.getService(project, javaClass<ModuleTypeCacheManager>())
}
@@ -87,7 +87,7 @@ public class KotlinClsStubBuilder : ClsStubBuilder() {
return ClsStubBuilderComponents(classDataFinder, annotationLoader)
}
class object {
default object {
val LOG = Logger.getInstance(javaClass<KotlinClsStubBuilder>())
}
}
@@ -113,7 +113,7 @@ public class DeserializerForDecompiler(val packageDirectory: VirtualFile, val di
return MutablePackageFragmentDescriptor(moduleDescriptor, fqName)
}
class object {
default object {
private val LOG = Logger.getInstance(javaClass<DeserializerForDecompiler>())
}
}
@@ -218,7 +218,7 @@ public open class JetPsiChecker : Annotator, HighlightRangeExtension {
}
}
class object {
default object {
var namesHighlightingEnabled = true
[TestOnly] set
@@ -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 {
default object {
private fun isApplicablePrefix(element: JetPrefixExpression): Boolean {
return when (element.getOperationReference().getReferencedNameElementType()) {
JetTokens.PLUS, JetTokens.MINUS, JetTokens.PLUSPLUS, JetTokens.MINUSMINUS, JetTokens.EXCL -> true
@@ -41,7 +41,7 @@ public class JetForLoopInReference(element: JetForExpression) : JetMultiReferenc
return LOOP_RANGE_KEYS.map { key -> context.get(key, loopRange)?.getCandidateDescriptor() }.filterNotNull()
}
class object {
default object {
private val LOOP_RANGE_KEYS = array(
BindingContext.LOOP_RANGE_ITERATOR_RESOLVED_CALL,
BindingContext.LOOP_RANGE_NEXT_RESOLVED_CALL,
@@ -57,7 +57,7 @@ public data class UsagesSearchLocation(
val inStrings: Boolean = false,
val inPlainText: Boolean = true
) {
class object {
default object {
public val DEFAULT: UsagesSearchLocation = UsagesSearchLocation()
public val EVERYWHERE: UsagesSearchLocation = UsagesSearchLocation(true, true, true, true)
}
@@ -78,7 +78,7 @@ public class SubpackagesIndexService(private val project: Project) {
}
}
class object {
default 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 {
default 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 {
default object {
val DEFAULT = Options()
}
}
class object {
default object {
val DEFAULT = ShortenReferences()
private fun DeclarationDescriptor.asString()
@@ -22,7 +22,7 @@ import com.intellij.psi.PsiElement
import org.jetbrains.kotlin.psi.JetPsiFactory
public trait SimpleNameReferenceExtension {
class object {
default 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 {
default 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 {
default object {
protected fun addImport(element: PsiElement, project: Project, selectedVariant: Variant) {
PsiDocumentManager.getInstance(project).commitAllDocuments()
@@ -73,7 +73,7 @@ public class KotlinReferenceData(
}
}
class object {
default 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 {
default 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 {
default 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 {
default object {
private val LEAF_CLASS_FILTER = ClassFilter(javaClass<LeafPsiElement>())
}
}
@@ -255,7 +255,7 @@ public class LookupElementFactory(
}
}
class object {
default object {
public fun getDefaultInsertHandler(descriptor: DeclarationDescriptor): InsertHandler<LookupElement> {
return when (descriptor) {
is FunctionDescriptor -> {
@@ -217,7 +217,7 @@ public class KotlinFunctionInsertHandler(val caretPosition : CaretPosition, val
return caretPosition == CaretPosition.IN_BRACKETS
}
class object {
default 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 {
default 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 {
default 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 {
default object {
val notMatches = ExpectedInfoClassification(null, false)
fun matches(substitutor: TypeSubstitutor) = ExpectedInfoClassification(substitutor, false)
fun matchesIfNotNullable(substitutor: TypeSubstitutor) = ExpectedInfoClassification(substitutor, true)
@@ -180,7 +180,7 @@ public class ConvertJavaCopyPastePostProcessor() : CopyPastePostProcessor<TextBl
return dialog.isOK()
}
class object {
default 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 {
default object {
val DATA_FLAVOR: DataFlavor = DataFlavor(javaClass<ConvertJavaCopyPastePostProcessor>(), "class: ConvertJavaCopyPastePostProcessor")
}
}
@@ -116,7 +116,7 @@ public class KotlinCoverageExtension(): JavaCoverageEngineExtension() {
return false
}
class object {
default object {
private val LOG = Logger.getInstance(javaClass<KotlinCoverageExtension>())
fun collectGeneratedClassQualifiedNames(outputRoot: VirtualFile?, file: JetFile): List<String>? {
@@ -218,7 +218,7 @@ public class JetPositionManager(private val myDebugProcess: DebugProcess) : Posi
myTypeMappers.put(key, value)
}
class object {
default object {
public fun createTypeMapper(file: JetFile, moduleInfo: IdeaModuleInfo): JetTypeMapper {
val project = file.getProject()
val packageFacadeScope = moduleInfo.contentScope()
@@ -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 {
default object {
public fun getInstance(): KotlinDebuggerSettings {
return XDebuggerUtil.getInstance()?.getDebuggerSettings(javaClass<KotlinDebuggerSettings>())!!
}
@@ -52,7 +52,7 @@ class KotlinEditorTextProvider : EditorTextProvider {
return Pair(expression, expression.getTextRange())
}
class object {
default object {
fun findExpressionInner(element: PsiElement, allowMethodCalls: Boolean): JetExpression? {
if (PsiTreeUtil.getParentOfType(element, javaClass<JetUserType>(), javaClass<JetImportDirective>(), javaClass<JetPackageDirective>()) != null) {
return null
@@ -95,7 +95,7 @@ class KotlinCodeFragmentFactory: CodeFragmentFactory() {
override fun getEvaluatorBuilder() = KotlinEvaluationBuilder
class object {
default object {
fun getContextElement(elementAt: PsiElement?): PsiElement? {
if (elementAt == null) return null
@@ -40,7 +40,7 @@ class KotlinEvaluateExpressionCache(val project: Project) {
MultiMap.create(), PsiModificationTracker.MODIFICATION_COUNT)
}, false)
class object {
default object {
private val LOG = Logger.getLogger(javaClass<KotlinEvaluateExpressionCache>())!!
fun getInstance(project: Project) = ServiceManager.getService(project, javaClass<KotlinEvaluateExpressionCache>())!!
@@ -149,7 +149,7 @@ class KotlinEvaluator(val codeFragment: JetCodeFragment,
return null
}
class object {
default object {
private fun extractAndCompile(codeFragment: JetCodeFragment, sourcePosition: SourcePosition, context: EvaluationContextImpl): CompiledDataDescriptor {
codeFragment.checkForErrors()
@@ -80,7 +80,7 @@ public abstract class KotlinRuntimeTypeEvaluator(
throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.surrounded.expression.null"))
}
class object {
default 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 {
default 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 {
default 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 {
default object {
public val KOTLIN_GROUP_NAME: String = "Kotlin"
}
@@ -72,7 +72,7 @@ import java.awt.GridBagLayout
import javax.swing.JPanel
public class UnusedSymbolInspection : AbstractKotlinInspection() {
class object {
default 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 {
default 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 {
default 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 {
default object {
fun createTypeArguments(element: JetCallExpression): JetTypeArgumentList? {
val context = element.analyze()
val resolvedCall = element.getResolvedCall(context)
@@ -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 {
default object {
val INSTANCE = RemoveCurlyBracesFromTemplateIntention()
val pattern = Pattern.compile("[a-zA-Z0-9_].*")
}
@@ -68,7 +68,7 @@ public class ReplaceItWithExplicitFunctionLiteralParamIntention() : PsiElementBa
return JetBundle.message("replace.it.with.explicit.function.literal.param.family")
}
class object {
default 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 {
default 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() +
@@ -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 {
default object {
val BACKUP_DIR_NAME = ".backup"
val PATCHES_TO_CREATE = 5
@@ -164,7 +164,7 @@ public class AutoImportFix(element: JetSimpleNameExpression) : JetHintAction<Jet
PsiShortNamesCache.getInstance(jetFile.getProject())
}
class object {
default object {
private val ERRORS = setOf(Errors.UNRESOLVED_REFERENCE, Errors.UNRESOLVED_REFERENCE_WRONG_RECEIVER)
public fun createFactory(): JetSingleIntentionActionFactory {
@@ -183,7 +183,7 @@ abstract class OutputValueBoxer(val outputValues: List<OutputValue>) {
assert(outputValues.size() <= 3, "At most 3 output values are supported")
}
class object {
default 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 {
default object {
fun checkNotTrait(descriptor: ExtractableCodeDescriptor): Boolean {
val parent = descriptor.extractionData.targetSibling.getStrictParentOfType<JetDeclaration>()
return !(parent is JetClass && parent.isTrait())
@@ -365,7 +365,7 @@ data class ExtractionGeneratorOptions(
val target: ExtractionTarget = ExtractionTarget.FUNCTION,
val flexibleTypesAllowed: Boolean = false
) {
class object {
default object {
val DEFAULT = ExtractionGeneratorOptions()
}
}
@@ -49,7 +49,7 @@ data class ExtractionOptions(
val extractAsProperty: Boolean = false,
val allowSpecialClassNames: Boolean = false
) {
class object {
default object {
val DEFAULT = ExtractionOptions()
}
}
@@ -50,7 +50,7 @@ public open class ExtractionEngineHelper {
continuation(ExtractionGeneratorConfiguration(descriptorWithConflicts.descriptor, ExtractionGeneratorOptions.DEFAULT))
}
class object {
default object {
public val DEFAULT: ExtractionEngineHelper = ExtractionEngineHelper()
}
}
@@ -96,7 +96,7 @@ public class MoveKotlinTopLevelDeclarationsProcessor(
val project: Project,
val options: MoveKotlinTopLevelDeclarationsOptions,
val mover: Mover = Mover.Default) : BaseRefactoringProcessor(project) {
class object {
default 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 {
default object {
val DEFAULT = JetPsiUnifier()
}
@@ -21,7 +21,7 @@ import com.intellij.psi.PsiElement
import com.intellij.find.findUsages.FindUsagesHandler
public trait KotlinFindUsagesHandlerDecorator {
class object {
default object {
public val EP_NAME: ExtensionPointName<KotlinFindUsagesHandlerDecorator> = ExtensionPointName.create("org.jetbrains.kotlin.findUsagesHandlerDecorator")!!
}
@@ -25,7 +25,7 @@ import org.junit.Assert
import junit.framework.AssertionFailedError
public abstract class AbstractReferenceResolveInLibrarySourcesTest : JetLightCodeInsightFixtureTestCase() {
class object {
default object {
private val REF_CARET_MARKER = "<ref-caret>"
}
@@ -57,7 +57,7 @@ class Converter private(
public val specialContext: PsiElement? = personalState.specialContext
class object {
default object {
public fun create(elementToConvert: PsiElement, settings: ConverterSettings, conversionScope: ConversionScope,
referenceSearcher: ReferenceSearcher, resolverForConverter: ResolverForConverter, postProcessor: PostProcessor?,
usageProcessingsCollector: (UsageProcessing) -> Unit): Converter {
@@ -23,7 +23,7 @@ public data class ConverterSettings(
var openByDefault: Boolean
) {
class object {
default object {
public val defaultSettings: ConverterSettings = ConverterSettings(
forceNotNullTypes = true,
specifyLocalVariableTypeByDefault = false,
@@ -94,7 +94,7 @@ object DocCommentConverter {
private class HtmlToMarkdownConverter() : XmlRecursiveElementVisitor() {
private enum class ListType { Ordered; Unordered }
data class MarkdownSpan(val prefix: String, val suffix: String) {
class object {
default object {
val Empty = MarkdownSpan("", "")
fun wrap(text: String) = MarkdownSpan(text, text)
@@ -489,7 +489,7 @@ class DefaultExpressionConverter : JavaElementVisitor(), ExpressionConverter {
return ""
}
class object {
default object {
private val needQualifierNameSet = setOf("java.lang.Byte", "java.lang.Double", "java.lang.Float", "java.lang.Long", "java.lang.Short")
}
}
@@ -410,7 +410,7 @@ class TypeConverter(val converter: Converter) {
}
}
class object {
default object {
private val boxingTypes: Set<String> = setOf(
CommonClassNames.JAVA_LANG_BYTE,
CommonClassNames.JAVA_LANG_CHARACTER,
@@ -115,7 +115,7 @@ class TypeVisitor(
return VarArgType(typeConverter.convertType(ellipsisType.getComponentType()))
}
class object {
default object {
private val toKotlinTypesMap: Map<String, String> = mapOf(
CommonClassNames.JAVA_LANG_OBJECT to "kotlin.Any",
CommonClassNames.JAVA_LANG_BYTE to "kotlin.Byte",

Some files were not shown because too many files have changed in this diff Show More