Rename: ClassKind.TRAIT -> ClassKind.INTERFACE

This commit is contained in:
Alexey Sedunov
2015-07-28 16:17:31 +03:00
parent 5bc2a4b14c
commit c11f1807bc
4 changed files with 7 additions and 7 deletions
@@ -487,7 +487,7 @@ class CallableBuilder(val config: CallableBuilderConfiguration) {
val openMod = if (open) "open " else ""
val innerMod = if (inner) "inner " else ""
val typeParamList = when (kind) {
ClassKind.PLAIN_CLASS, ClassKind.TRAIT -> "<>"
ClassKind.PLAIN_CLASS, ClassKind.INTERFACE -> "<>"
else -> ""
}
psiFactory.createDeclaration<JetClassOrObject>(
@@ -38,12 +38,12 @@ public object CreateClassFromTypeReferenceActionFactory : CreateClassFromUsageFa
val typeRefParent = element.parent?.parent
if (typeRefParent is JetConstructorCalleeExpression) return Collections.emptyList()
val traitExpected = typeRefParent is JetDelegatorToSuperClass
val interfaceExpected = typeRefParent is JetDelegatorToSuperClass
val isQualifier = (element.parent as? JetUserType)?.let { it.qualifier == element } ?: false
return when {
traitExpected -> Collections.singletonList(ClassKind.TRAIT)
interfaceExpected -> Collections.singletonList(ClassKind.INTERFACE)
else -> ClassKind.values().filter {
val noTypeArguments = element.typeArgumentsAsTypes.isEmpty()
when (it) {
@@ -43,7 +43,7 @@ enum class ClassKind(val keyword: String, val description: String) {
ENUM_CLASS("enum class", "enum"),
ENUM_ENTRY("", "enum constant"),
ANNOTATION_CLASS("annotation class", "annotation"),
TRAIT("interface", "interface"),
INTERFACE("interface", "interface"),
OBJECT("object", "object"),
DEFAULT("", "") // Used as a placeholder and must be replaced with one of the kinds above
}
@@ -119,7 +119,7 @@ public class CreateClassFromUsageFix<E : JetElement>(
val constructorInfo = PrimaryConstructorInfo(classInfo, expectedTypeInfo)
val builder = CallableBuilderConfiguration(
Collections.singletonList(constructorInfo), element as JetElement, file, editor, false, kind == PLAIN_CLASS || kind == TRAIT
Collections.singletonList(constructorInfo), element as JetElement, file, editor, false, kind == PLAIN_CLASS || kind == INTERFACE
).createBuilder()
builder.placement = CallablePlacement.NoReceiver(targetParent)
project.executeCommand(text) { builder.build() }
@@ -106,8 +106,8 @@ private fun JetExpression.getInheritableTypeInfo(
return TypeInfo.ByType(type, Variance.OUT_VARIANCE).noSubstitutions() to { classKind ->
when (classKind) {
ClassKind.ENUM_ENTRY -> isEnum && containingDeclaration == DescriptorToSourceUtils.descriptorToDeclaration(descriptor)
ClassKind.TRAIT -> containingDeclaration !is PsiClass
|| (descriptor as? ClassDescriptor)?.getKind() == ClassDescriptorKind.INTERFACE
ClassKind.INTERFACE -> containingDeclaration !is PsiClass
|| (descriptor as? ClassDescriptor)?.getKind() == ClassDescriptorKind.INTERFACE
else -> canHaveSubtypes
}
}