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()
}