From a2e5e60c68e72a85c110f99f7a7f81a423a204f9 Mon Sep 17 00:00:00 2001 From: Andrey Breslav Date: Fri, 9 Oct 2015 16:02:10 +0300 Subject: [PATCH] TRAIT -> INTERFACE in diagnostics --- .../codegen/MutableClassDescriptor.java | 2 +- .../jetbrains/kotlin/load/kotlin/native.kt | 2 +- .../checkers/TraitDefaultMethodCallChecker.kt | 2 +- .../diagnostics/DefaultErrorMessagesJvm.java | 4 +- .../resolve/jvm/diagnostics/ErrorsJvm.java | 4 +- .../jetbrains/kotlin/diagnostics/Errors.java | 31 ++++++++------- .../rendering/DefaultErrorMessages.java | 24 ++++++------ .../kotlin/resolve/BodyResolver.java | 12 +++--- .../kotlin/resolve/DeclarationsChecker.java | 12 +++--- .../kotlin/resolve/LazyTopDownAnalyzer.kt | 4 +- .../BasicExpressionTypingVisitor.java | 2 +- .../diagnostics/tests/AbstractInTrait.kt | 38 +++++++++---------- .../tests/AnonymousInitializers.kt | 4 +- .../diagnostics/tests/DeferredTypes.kt | 2 +- .../diagnostics/tests/SupertypeListChecks.kt | 10 ++--- .../tests/TraitOverrideObjectMethods.kt | 2 +- .../diagnostics/tests/TraitWithConstructor.kt | 12 +++--- .../tests/annotations/onInitializer.kt | 4 +- .../tests/backingField/FieldInInterface.kt | 2 +- .../cast/neverSucceeds/NoGenericsRelated.kt | 2 +- .../tests/declarationChecks/kt2397.kt | 2 +- .../tests/delegatedProperty/inTrait.kt | 2 +- .../tests/delegation/DelegationNotTotrait.kt | 4 +- .../tests/delegation/DelegationToJavaIface.kt | 2 +- .../accidentalOverrides/require.kt | 2 +- .../diagnostics/tests/j+k/traitDefaultCall.kt | 2 +- .../tests/modifiers/privateInInterface.kt | 2 +- .../tests/override/MissingDelegate.kt | 2 +- .../diagnostics/tests/override/kt1862.kt | 2 +- .../regressions/TypeParameterAsASupertype.kt | 2 +- .../diagnostics/tests/regressions/kt307.kt | 2 +- .../constructorInTrait.kt | 2 +- .../tests/subtyping/unresolvedSupertype.kt | 2 +- .../thisAndSuper/notAccessibleSuperInTrait.kt | 4 +- .../traitWithRequired/traitRequiresAny.kt | 2 +- .../traitWithRequired/traitSupertypeList.kt | 4 +- .../testsWithStdLib/native/trait.kt | 4 +- .../kotlin/idea/quickfix/QuickFixRegistrar.kt | 4 +- 38 files changed, 110 insertions(+), 111 deletions(-) diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/MutableClassDescriptor.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/MutableClassDescriptor.java index 36e0ddff72a..3462e773521 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/MutableClassDescriptor.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/MutableClassDescriptor.java @@ -114,7 +114,7 @@ public class MutableClassDescriptor extends ClassDescriptorBase implements Class public void addSupertype(@NotNull JetType supertype) { assert !supertype.isError() : "Error types must be filtered out in DescriptorResolver"; if (TypeUtils.getClassDescriptor(supertype) != null) { - // See the Errors.SUPERTYPE_NOT_A_CLASS_OR_TRAIT + // See the Errors.SUPERTYPE_NOT_A_CLASS_OR_INTERFACE supertypes.add(supertype); } } diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/load/kotlin/native.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/load/kotlin/native.kt index 37c7e9d9f52..5c0b3adaf3e 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/load/kotlin/native.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/load/kotlin/native.kt @@ -55,7 +55,7 @@ public class NativeFunChecker : DeclarationChecker { if (!descriptor.hasNativeAnnotation()) return if (DescriptorUtils.isInterface(descriptor.getContainingDeclaration())) { - diagnosticHolder.report(ErrorsJvm.EXTERNAL_DECLARATION_IN_TRAIT.on(declaration)) + diagnosticHolder.report(ErrorsJvm.EXTERNAL_DECLARATION_IN_INTERFACE.on(declaration)) } else if (descriptor is CallableMemberDescriptor && descriptor.getModality() == Modality.ABSTRACT) { diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/calls/checkers/TraitDefaultMethodCallChecker.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/calls/checkers/TraitDefaultMethodCallChecker.kt index 58e89f3b6bc..33fc9434bf5 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/calls/checkers/TraitDefaultMethodCallChecker.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/calls/checkers/TraitDefaultMethodCallChecker.kt @@ -42,7 +42,7 @@ public class TraitDefaultMethodCallChecker : CallChecker { if (classifier != null && DescriptorUtils.isInterface(classifier)) { context.trace.report( - ErrorsJvm.TRAIT_CANT_CALL_DEFAULT_METHOD_VIA_SUPER.on( + ErrorsJvm.INTERFACE_CANT_CALL_DEFAULT_METHOD_VIA_SUPER.on( PsiTreeUtil.getParentOfType(resolvedCall.getCall().getCallElement(), javaClass()) ) ) diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java index 6c3a5bf4683..3ecd8d6ffa1 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java @@ -55,7 +55,7 @@ public class DefaultErrorMessagesJvm implements DefaultErrorMessages.Extension { MAP.put(ErrorsJvm.ILLEGAL_JVM_NAME, "Illegal JVM name"); MAP.put(ErrorsJvm.EXTERNAL_DECLARATION_CANNOT_BE_ABSTRACT, "External declaration can not be abstract"); MAP.put(ErrorsJvm.EXTERNAL_DECLARATION_CANNOT_HAVE_BODY, "External declaration can not have a body"); - MAP.put(ErrorsJvm.EXTERNAL_DECLARATION_IN_TRAIT, "Members of interfaces can not be external"); + MAP.put(ErrorsJvm.EXTERNAL_DECLARATION_IN_INTERFACE, "Members of interfaces can not be external"); MAP.put(ErrorsJvm.EXTERNAL_DECLARATION_CANNOT_BE_INLINED, "Members of interfaces can not be external"); MAP.put(ErrorsJvm.POSITIONED_VALUE_ARGUMENT_FOR_JAVA_ANNOTATION, "Only named arguments are available for Java annotations"); @@ -70,7 +70,7 @@ public class DefaultErrorMessagesJvm implements DefaultErrorMessages.Extension { MAP.put(ErrorsJvm.NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS, "Expected type does not accept nulls in {0}, but the value may be null in {1}", Renderers.TO_STRING, Renderers.TO_STRING); - MAP.put(ErrorsJvm.TRAIT_CANT_CALL_DEFAULT_METHOD_VIA_SUPER, "Interfaces can't call Java default methods via super"); + MAP.put(ErrorsJvm.INTERFACE_CANT_CALL_DEFAULT_METHOD_VIA_SUPER, "Interfaces can't call Java default methods via super"); MAP.put(ErrorsJvm.WHEN_ENUM_CAN_BE_NULL_IN_JAVA, "Enum argument can be null in Java, but exhaustive when contains no null branch"); diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java index bc9ac213ce8..41da0fa12c4 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java @@ -54,7 +54,7 @@ public interface ErrorsJvm { DiagnosticFactory0 EXTERNAL_DECLARATION_CANNOT_BE_ABSTRACT = DiagnosticFactory0.create(ERROR, ABSTRACT_MODIFIER); DiagnosticFactory0 EXTERNAL_DECLARATION_CANNOT_HAVE_BODY = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE); - DiagnosticFactory0 EXTERNAL_DECLARATION_IN_TRAIT = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE); + DiagnosticFactory0 EXTERNAL_DECLARATION_IN_INTERFACE = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE); DiagnosticFactory0 EXTERNAL_DECLARATION_CANNOT_BE_INLINED = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE); DiagnosticFactory0 POSITIONED_VALUE_ARGUMENT_FOR_JAVA_ANNOTATION = DiagnosticFactory0.create(ERROR); @@ -63,7 +63,7 @@ public interface ErrorsJvm { DiagnosticFactory0 NON_SOURCE_REPEATED_ANNOTATION = DiagnosticFactory0.create(ERROR); DiagnosticFactory1 ANNOTATION_IS_NOT_APPLICABLE_TO_MULTIFILE_CLASSES = DiagnosticFactory1.create(ERROR); - DiagnosticFactory0 TRAIT_CANT_CALL_DEFAULT_METHOD_VIA_SUPER = DiagnosticFactory0.create(ERROR); + DiagnosticFactory0 INTERFACE_CANT_CALL_DEFAULT_METHOD_VIA_SUPER = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 INAPPLICABLE_PUBLIC_FIELD = DiagnosticFactory0.create(ERROR); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java index 3829fac7f80..422b1ca2188 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java @@ -19,7 +19,6 @@ package org.jetbrains.kotlin.diagnostics; import com.google.common.collect.ImmutableSet; import com.intellij.openapi.util.TextRange; import com.intellij.psi.PsiElement; -import com.intellij.psi.PsiIdentifier; import com.intellij.psi.impl.source.tree.LeafPsiElement; import org.jetbrains.annotations.NotNull; import org.jetbrains.kotlin.descriptors.*; @@ -87,7 +86,7 @@ public interface Errors { //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Errors/warnings in types - // Note: class/trait declaration is NOT a type. A type is something that may be written on the right-hand side of ":" + // Note: class/interface declaration is NOT a type. A type is something that may be written on the right-hand side of ":" //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -162,7 +161,7 @@ public interface Errors { DiagnosticFactory0 INAPPLICABLE_PARAM_TARGET = DiagnosticFactory0.create(ERROR); DiagnosticFactory1 REDUNDANT_ANNOTATION_TARGET = DiagnosticFactory1.create(WARNING); - // Classes and traits + // Classes and interfaces DiagnosticFactory0 PROJECTION_IN_IMMEDIATE_ARGUMENT_TO_SUPERTYPE = DiagnosticFactory0.create(ERROR, VARIANCE_IN_PROJECTION); @@ -171,8 +170,8 @@ public interface Errors { DiagnosticFactory0 SUPERTYPE_NOT_INITIALIZED = DiagnosticFactory0.create(ERROR); - DiagnosticFactory0 DELEGATION_NOT_TO_TRAIT = DiagnosticFactory0.create(ERROR); - DiagnosticFactory0 SUPERTYPE_NOT_A_CLASS_OR_TRAIT = DiagnosticFactory0.create(ERROR); + DiagnosticFactory0 DELEGATION_NOT_TO_INTERFACE = DiagnosticFactory0.create(ERROR); + DiagnosticFactory0 SUPERTYPE_NOT_A_CLASS_OR_INTERFACE = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 NO_GENERICS_IN_SUPERTYPE_SPECIFIER = DiagnosticFactory0.create(ERROR); @@ -211,19 +210,19 @@ public interface Errors { DiagnosticFactory1 INSTANCE_ACCESS_BEFORE_SUPER_CALL = DiagnosticFactory1.create(ERROR); - // Trait-specific + // Interface-specific - DiagnosticFactory0 ABSTRACT_MODIFIER_IN_TRAIT = DiagnosticFactory0 + DiagnosticFactory0 ABSTRACT_MODIFIER_IN_INTERFACE = DiagnosticFactory0 .create(WARNING, ABSTRACT_MODIFIER); - DiagnosticFactory0 CONSTRUCTOR_IN_TRAIT = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE); + DiagnosticFactory0 CONSTRUCTOR_IN_INTERFACE = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE); DiagnosticFactory0 METHOD_OF_ANY_IMPLEMENTED_IN_INTERFACE = DiagnosticFactory0.create(ERROR); - DiagnosticFactory0 SUPERTYPE_INITIALIZED_IN_TRAIT = DiagnosticFactory0.create(ERROR); + DiagnosticFactory0 SUPERTYPE_INITIALIZED_IN_INTERFACE = DiagnosticFactory0.create(ERROR); - DiagnosticFactory0 DELEGATION_IN_TRAIT = DiagnosticFactory0.create(ERROR); + DiagnosticFactory0 DELEGATION_IN_INTERFACE = DiagnosticFactory0.create(ERROR); - DiagnosticFactory0 TRAIT_WITH_SUPERCLASS = DiagnosticFactory0.create(ERROR); + DiagnosticFactory0 INTERFACE_WITH_SUPERCLASS = DiagnosticFactory0.create(ERROR); // Enum-specific @@ -339,7 +338,7 @@ public interface Errors { DiagnosticFactory0 ABSTRACT_DELEGATED_PROPERTY = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 ACCESSOR_FOR_DELEGATED_PROPERTY = DiagnosticFactory0.create(ERROR); - DiagnosticFactory0 DELEGATED_PROPERTY_IN_TRAIT = DiagnosticFactory0.create(ERROR); + DiagnosticFactory0 DELEGATED_PROPERTY_IN_INTERFACE = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 LOCAL_VARIABLE_WITH_DELEGATE = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 PROPERTY_WITH_NO_TYPE_NO_INITIALIZER = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE); @@ -349,10 +348,10 @@ public interface Errors { DiagnosticFactory0 EXTENSION_PROPERTY_WITH_BACKING_FIELD = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 PROPERTY_INITIALIZER_NO_BACKING_FIELD = DiagnosticFactory0.create(ERROR); - DiagnosticFactory0 PROPERTY_INITIALIZER_IN_TRAIT = DiagnosticFactory0.create(ERROR); + DiagnosticFactory0 PROPERTY_INITIALIZER_IN_INTERFACE = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 FINAL_PROPERTY_IN_INTERFACE = DiagnosticFactory0.create(ERROR, FINAL_MODIFIER); DiagnosticFactory0 PRIVATE_PROPERTY_IN_INTERFACE = DiagnosticFactory0.create(ERROR, PRIVATE_MODIFIER); - DiagnosticFactory0 BACKING_FIELD_IN_TRAIT = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE); + DiagnosticFactory0 BACKING_FIELD_IN_INTERFACE = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE); DiagnosticFactory0 BACKING_FIELD_OLD_SYNTAX = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 BACKING_FIELD_USAGE_FORBIDDEN = DiagnosticFactory0.create(ERROR); @@ -514,7 +513,7 @@ public interface Errors { DiagnosticFactory1 SUPER_IS_NOT_AN_EXPRESSION = DiagnosticFactory1.create(ERROR); DiagnosticFactory1 SUPER_CANT_BE_EXTENSION_RECEIVER = DiagnosticFactory1.create(ERROR); DiagnosticFactory0 SUPER_NOT_AVAILABLE = DiagnosticFactory0.create(ERROR); - DiagnosticFactory0 SUPERCLASS_NOT_ACCESSIBLE_FROM_TRAIT = DiagnosticFactory0.create(ERROR); + DiagnosticFactory0 SUPERCLASS_NOT_ACCESSIBLE_FROM_INTERFACE = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 AMBIGUOUS_SUPER = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 ABSTRACT_SUPER_CALL = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 NOT_A_SUPERTYPE = DiagnosticFactory0.create(ERROR); @@ -715,7 +714,7 @@ public interface Errors { DiagnosticFactory0 NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY = DiagnosticFactory0.create(ERROR, DECLARATION_WITH_BODY); - DiagnosticFactory0 ANONYMOUS_INITIALIZER_IN_TRAIT = DiagnosticFactory0.create(ERROR); + DiagnosticFactory0 ANONYMOUS_INITIALIZER_IN_INTERFACE = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 NO_THIS = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 PACKAGE_IS_NOT_AN_EXPRESSION = DiagnosticFactory0.create(ERROR); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java index eda027aae88..19bd60dc3ff 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java @@ -145,7 +145,7 @@ public class DefaultErrorMessages { MAP.put(REDUNDANT_ANNOTATION_TARGET, "Redundant annotation target ''{0}''", STRING); MAP.put(REDUNDANT_MODIFIER, "Modifier ''{0}'' is redundant because ''{1}'' is present", TO_STRING, TO_STRING); - MAP.put(ABSTRACT_MODIFIER_IN_TRAIT, "Modifier ''abstract'' is redundant in interface"); + MAP.put(ABSTRACT_MODIFIER_IN_INTERFACE, "Modifier ''abstract'' is redundant in interface"); MAP.put(REDUNDANT_MODIFIER_IN_GETTER, "Visibility modifiers are redundant in getter"); MAP.put(TYPE_PARAMETERS_IN_ENUM, "Enum class cannot have type parameters"); MAP.put(TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM, @@ -210,7 +210,7 @@ public class DefaultErrorMessages { MAP.put(ABSTRACT_DELEGATED_PROPERTY, "Delegated property cannot be abstract"); MAP.put(ACCESSOR_FOR_DELEGATED_PROPERTY, "Delegated property cannot have accessors with non-default implementations"); - MAP.put(DELEGATED_PROPERTY_IN_TRAIT, "Delegated properties are not allowed in interfaces"); + MAP.put(DELEGATED_PROPERTY_IN_INTERFACE, "Delegated properties are not allowed in interfaces"); MAP.put(LOCAL_VARIABLE_WITH_DELEGATE, "Local variables are not allowed to have delegates"); MAP.put(INAPPLICABLE_LATEINIT_MODIFIER, "''lateinit'' modifier is allowed only on member properties with a backing field"); @@ -222,10 +222,10 @@ public class DefaultErrorMessages { MAP.put(GETTER_VISIBILITY_DIFFERS_FROM_PROPERTY_VISIBILITY, "Getter visibility must be the same as property visibility"); MAP.put(PRIVATE_SETTER_ON_NON_PRIVATE_LATE_INIT_VAR, "Private setter is not allowed on non-private lateinit property"); - MAP.put(BACKING_FIELD_IN_TRAIT, "Property in an interface cannot have a backing field"); + MAP.put(BACKING_FIELD_IN_INTERFACE, "Property in an interface cannot have a backing field"); MAP.put(MUST_BE_INITIALIZED, "Property must be initialized"); MAP.put(MUST_BE_INITIALIZED_OR_BE_ABSTRACT, "Property must be initialized or be abstract"); - MAP.put(PROPERTY_INITIALIZER_IN_TRAIT, "Property initializers are not allowed in interfaces"); + MAP.put(PROPERTY_INITIALIZER_IN_INTERFACE, "Property initializers are not allowed in interfaces"); MAP.put(FINAL_PROPERTY_IN_INTERFACE, "Abstract property in an interface cannot be final"); MAP.put(PRIVATE_PROPERTY_IN_INTERFACE, "Abstract property in an interface cannot be private"); MAP.put(EXTENSION_PROPERTY_WITH_BACKING_FIELD, "Extension property cannot be initialized because it has no backing field"); @@ -297,8 +297,8 @@ public class DefaultErrorMessages { MAP.put(ENUM_CLASS_CONSTRUCTOR_CALL, "Enum types cannot be instantiated"); MAP.put(SEALED_CLASS_CONSTRUCTOR_CALL, "Sealed types cannot be instantiated"); - MAP.put(DELEGATION_IN_TRAIT, "Interfaces cannot use delegation"); - MAP.put(DELEGATION_NOT_TO_TRAIT, "Only interfaces can be delegated to"); + MAP.put(DELEGATION_IN_INTERFACE, "Interfaces cannot use delegation"); + MAP.put(DELEGATION_NOT_TO_INTERFACE, "Only interfaces can be delegated to"); MAP.put(NO_CONSTRUCTOR, "This class does not have a constructor"); MAP.put(NOT_A_CLASS, "Not a class"); MAP.put(ILLEGAL_ESCAPE_SEQUENCE, "Illegal escape sequence"); @@ -327,7 +327,7 @@ public class DefaultErrorMessages { MAP.put(SETTER_PARAMETER_WITH_DEFAULT_VALUE, "Setter parameters cannot have default values"); MAP.put(NO_THIS, "'this' is not defined in this context"); MAP.put(SUPER_NOT_AVAILABLE, "No supertypes are accessible in this context"); - MAP.put(SUPERCLASS_NOT_ACCESSIBLE_FROM_TRAIT, "Superclass is not accessible from interface"); + MAP.put(SUPERCLASS_NOT_ACCESSIBLE_FROM_INTERFACE, "Superclass is not accessible from interface"); MAP.put(AMBIGUOUS_SUPER, "Many supertypes available, please specify the one you mean in angle brackets, e.g. 'super'"); MAP.put(ABSTRACT_SUPER_CALL, "Abstract member cannot be accessed directly"); MAP.put(NOT_A_SUPERTYPE, "Not a supertype"); @@ -435,12 +435,12 @@ public class DefaultErrorMessages { MAP.put(CYCLIC_GENERIC_UPPER_BOUND, "Type parameter has itself as an upper bound"); MAP.put(MANY_CLASSES_IN_SUPERTYPE_LIST, "Only one class may appear in a supertype list"); - MAP.put(SUPERTYPE_NOT_A_CLASS_OR_TRAIT, "Only classes and interfaces may serve as supertypes"); - MAP.put(SUPERTYPE_INITIALIZED_IN_TRAIT, "Interfaces cannot initialize supertypes"); + MAP.put(SUPERTYPE_NOT_A_CLASS_OR_INTERFACE, "Only classes and interfaces may serve as supertypes"); + MAP.put(SUPERTYPE_INITIALIZED_IN_INTERFACE, "Interfaces cannot initialize supertypes"); MAP.put(CLASS_IN_SUPERTYPE_FOR_ENUM, "Enum class cannot inherit from classes"); - MAP.put(CONSTRUCTOR_IN_TRAIT, "An interface may not have a constructor"); + MAP.put(CONSTRUCTOR_IN_INTERFACE, "An interface may not have a constructor"); MAP.put(METHOD_OF_ANY_IMPLEMENTED_IN_INTERFACE, "An interface may not implement a method of 'kotlin.Any'"); - MAP.put(TRAIT_WITH_SUPERCLASS, "An interface cannot inherit from a class"); + MAP.put(INTERFACE_WITH_SUPERCLASS, "An interface cannot inherit from a class"); MAP.put(SUPERTYPE_APPEARS_TWICE, "A supertype appears twice"); MAP.put(FINAL_SUPERTYPE, "This type is final, so it cannot be inherited from"); MAP.put(DATA_CLASS_CANNOT_HAVE_CLASS_SUPERTYPES, "Data class inheritance from other classes is deprecated"); @@ -471,7 +471,7 @@ public class DefaultErrorMessages { MAP.put(NOT_A_LOOP_LABEL, "The label ''{0}'' does not denote a loop", STRING); MAP.put(NOT_A_RETURN_LABEL, "The label ''{0}'' does not reference to a context from which we can return", STRING); - MAP.put(ANONYMOUS_INITIALIZER_IN_TRAIT, "Anonymous initializers are not allowed in interfaces"); + MAP.put(ANONYMOUS_INITIALIZER_IN_INTERFACE, "Anonymous initializers are not allowed in interfaces"); MAP.put(NULLABLE_SUPERTYPE, "A supertype cannot be nullable"); MAP.put(DYNAMIC_SUPERTYPE, "A supertype cannot be dynamic"); MAP.put(REDUNDANT_NULLABLE, "Redundant '?'"); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/BodyResolver.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/BodyResolver.java index a218d037021..3213dd3dc7a 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/BodyResolver.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/BodyResolver.java @@ -271,7 +271,7 @@ public class BodyResolver { @Override public void visitDelegationByExpressionSpecifier(@NotNull JetDelegatorByExpressionSpecifier specifier) { if (descriptor.getKind() == ClassKind.INTERFACE) { - trace.report(DELEGATION_IN_TRAIT.on(specifier)); + trace.report(DELEGATION_IN_INTERFACE.on(specifier)); } JetType supertype = trace.getBindingContext().get(BindingContext.TYPE, specifier.getTypeReference()); recordSupertype(specifier.getTypeReference(), supertype); @@ -280,7 +280,7 @@ public class BodyResolver { if (declarationDescriptor instanceof ClassDescriptor) { ClassDescriptor classDescriptor = (ClassDescriptor) declarationDescriptor; if (classDescriptor.getKind() != ClassKind.INTERFACE) { - trace.report(DELEGATION_NOT_TO_TRAIT.on(specifier.getTypeReference())); + trace.report(DELEGATION_NOT_TO_INTERFACE.on(specifier.getTypeReference())); } } } @@ -300,7 +300,7 @@ public class BodyResolver { JetValueArgumentList valueArgumentList = call.getValueArgumentList(); PsiElement elementToMark = valueArgumentList == null ? call : valueArgumentList; if (descriptor.getKind() == ClassKind.INTERFACE) { - trace.report(SUPERTYPE_INITIALIZED_IN_TRAIT.on(elementToMark)); + trace.report(SUPERTYPE_INITIALIZED_IN_INTERFACE.on(elementToMark)); } JetTypeReference typeReference = call.getTypeReference(); if (typeReference == null) return; @@ -440,7 +440,7 @@ public class BodyResolver { } else if (supertypeOwner.getKind() == ClassKind.INTERFACE && !classAppeared && !TypesPackage.isDynamic(supertype) /* avoid duplicate diagnostics */) { - trace.report(TRAIT_WITH_SUPERCLASS.on(typeReference)); + trace.report(INTERFACE_WITH_SUPERCLASS.on(typeReference)); addSupertype = false; } else if (jetClass.hasModifier(JetTokens.DATA_KEYWORD)) { @@ -457,7 +457,7 @@ public class BodyResolver { } } else { - trace.report(SUPERTYPE_NOT_A_CLASS_OR_TRAIT.on(typeReference)); + trace.report(SUPERTYPE_NOT_A_CLASS_OR_INTERFACE.on(typeReference)); } TypeConstructor constructor = supertype.getConstructor(); @@ -510,7 +510,7 @@ public class BodyResolver { processModifiersOnInitializer(anonymousInitializer, scopeForInitializers); } else { - trace.report(ANONYMOUS_INITIALIZER_IN_TRAIT.on(anonymousInitializer)); + trace.report(ANONYMOUS_INITIALIZER_IN_INTERFACE.on(anonymousInitializer)); processModifiersOnInitializer(anonymousInitializer, scopeForInitializers); } } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/DeclarationsChecker.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/DeclarationsChecker.java index 36c2d85cfd0..92f6e698ccd 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/DeclarationsChecker.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/DeclarationsChecker.java @@ -372,7 +372,7 @@ public class DeclarationsChecker { private void checkConstructorInInterface(JetClass klass) { JetPrimaryConstructor primaryConstructor = klass.getPrimaryConstructor(); if (primaryConstructor != null) { - trace.report(CONSTRUCTOR_IN_TRAIT.on(primaryConstructor)); + trace.report(CONSTRUCTOR_IN_INTERFACE.on(primaryConstructor)); } } @@ -554,7 +554,7 @@ public class DeclarationsChecker { return; } if (classDescriptor.getKind() == ClassKind.INTERFACE) { - trace.report(ABSTRACT_MODIFIER_IN_TRAIT.on(property)); + trace.report(ABSTRACT_MODIFIER_IN_INTERFACE.on(property)); } } @@ -599,7 +599,7 @@ public class DeclarationsChecker { Boolean.TRUE.equals(trace.getBindingContext().get(BindingContext.BACKING_FIELD_REQUIRED, propertyDescriptor)); if (inTrait && backingFieldRequired && hasAccessorImplementation) { - trace.report(BACKING_FIELD_IN_TRAIT.on(property)); + trace.report(BACKING_FIELD_IN_INTERFACE.on(property)); } if (initializer == null && delegate == null) { @@ -626,10 +626,10 @@ public class DeclarationsChecker { if (inTrait) { if (delegate != null) { - trace.report(DELEGATED_PROPERTY_IN_TRAIT.on(delegate)); + trace.report(DELEGATED_PROPERTY_IN_INTERFACE.on(delegate)); } else { - trace.report(PROPERTY_INITIALIZER_IN_TRAIT.on(initializer)); + trace.report(PROPERTY_INITIALIZER_IN_INTERFACE.on(initializer)); } } else if (delegate == null) { @@ -680,7 +680,7 @@ public class DeclarationsChecker { trace.report(ABSTRACT_FUNCTION_IN_NON_ABSTRACT_CLASS.on(function, functionDescriptor.getName().asString(), classDescriptor)); } if (hasAbstractModifier && inTrait) { - trace.report(ABSTRACT_MODIFIER_IN_TRAIT.on(function)); + trace.report(ABSTRACT_MODIFIER_IN_INTERFACE.on(function)); } boolean hasBody = function.hasBody(); if (hasBody && hasAbstractModifier) { diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/LazyTopDownAnalyzer.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/LazyTopDownAnalyzer.kt index 226736f8c5a..9e424d3fdea 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/LazyTopDownAnalyzer.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/LazyTopDownAnalyzer.kt @@ -22,7 +22,7 @@ import com.intellij.psi.PsiElement import com.intellij.psi.util.PsiTreeUtil import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.diagnostics.Errors.CONSTRUCTOR_IN_OBJECT -import org.jetbrains.kotlin.diagnostics.Errors.CONSTRUCTOR_IN_TRAIT +import org.jetbrains.kotlin.diagnostics.Errors.CONSTRUCTOR_IN_INTERFACE import org.jetbrains.kotlin.diagnostics.Errors.MANY_COMPANION_OBJECTS import org.jetbrains.kotlin.diagnostics.Errors.UNSUPPORTED import org.jetbrains.kotlin.incremental.KotlinLookupLocation @@ -126,7 +126,7 @@ public class LazyTopDownAnalyzer( trace.report(CONSTRUCTOR_IN_OBJECT.on(jetDeclaration)) } else if (classDescriptor.getKind() == ClassKind.INTERFACE) { - trace.report(CONSTRUCTOR_IN_TRAIT.on(jetDeclaration)) + trace.report(CONSTRUCTOR_IN_INTERFACE.on(jetDeclaration)) } } } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/BasicExpressionTypingVisitor.java b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/BasicExpressionTypingVisitor.java index f6dcac401e6..fa361df9d40 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/BasicExpressionTypingVisitor.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/BasicExpressionTypingVisitor.java @@ -408,7 +408,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor { if (result != null) { if (DescriptorUtils.isInterface(thisType.getConstructor().getDeclarationDescriptor())) { if (DescriptorUtils.isClass(result.getConstructor().getDeclarationDescriptor())) { - context.trace.report(SUPERCLASS_NOT_ACCESSIBLE_FROM_TRAIT.on(expression)); + context.trace.report(SUPERCLASS_NOT_ACCESSIBLE_FROM_INTERFACE.on(expression)); } } context.trace.recordType(expression.getInstanceReference(), result); diff --git a/compiler/testData/diagnostics/tests/AbstractInTrait.kt b/compiler/testData/diagnostics/tests/AbstractInTrait.kt index c7295d9f13b..18dc11a0e35 100644 --- a/compiler/testData/diagnostics/tests/AbstractInTrait.kt +++ b/compiler/testData/diagnostics/tests/AbstractInTrait.kt @@ -3,43 +3,43 @@ package abstract interface MyTrait { //properties val a: Int - val a1: Int = 1 - abstract val a2: Int - abstract val a3: Int = 1 + val a1: Int = 1 + abstract val a2: Int + abstract val a3: Int = 1 var b: Int private set - var b1: Int = 0; private set - abstract var b2: Int private set - abstract var b3: Int = 0; private set + var b1: Int = 0; private set + abstract var b2: Int private set + abstract var b3: Int = 0; private set - var c: Int set(v: Int) { field = v } - var c1: Int = 0; set(v: Int) { field = v } - abstract var c2: Int set(v: Int) { field = v } - abstract var c3: Int = 0; set(v: Int) { field = v } + var c: Int set(v: Int) { field = v } + var c1: Int = 0; set(v: Int) { field = v } + abstract var c2: Int set(v: Int) { field = v } + abstract var c3: Int = 0; set(v: Int) { field = v } val e: Int get() = a - val e1: Int = 0; get() = a - abstract val e2: Int get() = a - abstract val e3: Int = 0; get() = a + val e1: Int = 0; get() = a + abstract val e2: Int get() = a + abstract val e3: Int = 0; get() = a //methods fun f() fun g() {} - abstract fun h() - abstract fun j() {} + abstract fun h() + abstract fun j() {} //property accessors var i: Int abstract get abstract set - var i1: Int = 0; abstract get abstract set + var i1: Int = 0; abstract get abstract set var j: Int get() = i; abstract set - var j1: Int = 0; get() = i; abstract set + var j1: Int = 0; get() = i; abstract set var k: Int abstract set - var k1: Int = 0; abstract set + var k1: Int = 0; abstract set var l: Int abstract get abstract set - var l1: Int = 0; abstract get abstract set + var l1: Int = 0; abstract get abstract set var n: Int abstract get abstract set(v: Int) {} } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/AnonymousInitializers.kt b/compiler/testData/diagnostics/tests/AnonymousInitializers.kt index 5b54f982ae5..6e5f5164a8a 100644 --- a/compiler/testData/diagnostics/tests/AnonymousInitializers.kt +++ b/compiler/testData/diagnostics/tests/AnonymousInitializers.kt @@ -1,11 +1,11 @@ interface NoC { - init { + init { } val a : Int get() = 1 - init { + init { } } diff --git a/compiler/testData/diagnostics/tests/DeferredTypes.kt b/compiler/testData/diagnostics/tests/DeferredTypes.kt index 107a25ea17b..5f4c82472be 100644 --- a/compiler/testData/diagnostics/tests/DeferredTypes.kt +++ b/compiler/testData/diagnostics/tests/DeferredTypes.kt @@ -1,3 +1,3 @@ interface T { - val a = Foo.bar() + val a = Foo.bar() } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/SupertypeListChecks.kt b/compiler/testData/diagnostics/tests/SupertypeListChecks.kt index fc282ff139c..6d345ca2bb3 100644 --- a/compiler/testData/diagnostics/tests/SupertypeListChecks.kt +++ b/compiler/testData/diagnostics/tests/SupertypeListChecks.kt @@ -21,20 +21,20 @@ interface T1 {} interface T2 {} -interface Test() { +interface Test() { } -interface Test1 : C2() {} +interface Test1 : C2() {} -interface Test2 : C2 {} +interface Test2 : C2 {} -interface Test3 : C2, C3 {} +interface Test3 : C2, C3 {} interface Test4 : T1 {} interface Test5 : T1, T1 {} -interface Test6 : C1 {} +interface Test6 : C1 {} class CTest1() : OC1() {} diff --git a/compiler/testData/diagnostics/tests/TraitOverrideObjectMethods.kt b/compiler/testData/diagnostics/tests/TraitOverrideObjectMethods.kt index d49911c5101..6f42ea05f9b 100644 --- a/compiler/testData/diagnostics/tests/TraitOverrideObjectMethods.kt +++ b/compiler/testData/diagnostics/tests/TraitOverrideObjectMethods.kt @@ -1,4 +1,4 @@ -interface MyTrait: Object { +interface MyTrait: Object { override fun toString(): String public override fun finalize() public override fun wait() diff --git a/compiler/testData/diagnostics/tests/TraitWithConstructor.kt b/compiler/testData/diagnostics/tests/TraitWithConstructor.kt index 063d9b65f1d..9b85c1b14da 100644 --- a/compiler/testData/diagnostics/tests/TraitWithConstructor.kt +++ b/compiler/testData/diagnostics/tests/TraitWithConstructor.kt @@ -2,17 +2,17 @@ class C(val a: String) {} -interface T1(val x: String) {} +interface T1(val x: String) {} -interface T2 constructor() {} +interface T2 constructor() {} -interface T3 private constructor(a: Int) {} +interface T3 private constructor(a: Int) {} interface T4 { - constructor(a: Int) { + constructor(a: Int) { val b: Int = 1 } } -interface T5 private () : T4 {} -interface T6 private : T5 {} \ No newline at end of file +interface T5 private () : T4 {} +interface T6 private : T5 {} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/annotations/onInitializer.kt b/compiler/testData/diagnostics/tests/annotations/onInitializer.kt index 317f6187acf..9ea6fc65bb1 100644 --- a/compiler/testData/diagnostics/tests/annotations/onInitializer.kt +++ b/compiler/testData/diagnostics/tests/annotations/onInitializer.kt @@ -4,8 +4,8 @@ class A { } interface T { - @ann init {} - @aaa init {} + @ann init {} + @aaa init {} } annotation class ann \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/backingField/FieldInInterface.kt b/compiler/testData/diagnostics/tests/backingField/FieldInInterface.kt index febcda8b7cb..33118847789 100644 --- a/compiler/testData/diagnostics/tests/backingField/FieldInInterface.kt +++ b/compiler/testData/diagnostics/tests/backingField/FieldInInterface.kt @@ -1,4 +1,4 @@ interface My { - val x: Int = 0 + val x: Int = 0 get() = field } diff --git a/compiler/testData/diagnostics/tests/cast/neverSucceeds/NoGenericsRelated.kt b/compiler/testData/diagnostics/tests/cast/neverSucceeds/NoGenericsRelated.kt index da97c3cee27..a36344ba638 100644 --- a/compiler/testData/diagnostics/tests/cast/neverSucceeds/NoGenericsRelated.kt +++ b/compiler/testData/diagnostics/tests/cast/neverSucceeds/NoGenericsRelated.kt @@ -5,7 +5,7 @@ interface T3 open class OC1: T1 open class OC2: OC1(), T2 class FC1: OC2(), T3 -interface T4: OC1 +interface T4: OC1 interface T5: T2 fun test( diff --git a/compiler/testData/diagnostics/tests/declarationChecks/kt2397.kt b/compiler/testData/diagnostics/tests/declarationChecks/kt2397.kt index f201c307352..fa753caa57e 100644 --- a/compiler/testData/diagnostics/tests/declarationChecks/kt2397.kt +++ b/compiler/testData/diagnostics/tests/declarationChecks/kt2397.kt @@ -9,7 +9,7 @@ interface T { final val c : Int get() = 42 - final val d = 1 + final val d = 1 } class A { diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/inTrait.kt b/compiler/testData/diagnostics/tests/delegatedProperty/inTrait.kt index 6f17f79263b..bf5aaca1760 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/inTrait.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/inTrait.kt @@ -1,7 +1,7 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER interface T { - val a: Int by Delegate() + val a: Int by Delegate() } class Delegate { diff --git a/compiler/testData/diagnostics/tests/delegation/DelegationNotTotrait.kt b/compiler/testData/diagnostics/tests/delegation/DelegationNotTotrait.kt index c0361f843a6..8df28758d5c 100644 --- a/compiler/testData/diagnostics/tests/delegation/DelegationNotTotrait.kt +++ b/compiler/testData/diagnostics/tests/delegation/DelegationNotTotrait.kt @@ -2,7 +2,7 @@ open class Foo() { } -class Barrr() : Foo by Foo() {} +class Barrr() : Foo by Foo() {} interface T {} @@ -12,4 +12,4 @@ class Br(t : T) : T by t {} A } -class Test2(e : EN) : EN by e {} +class Test2(e : EN) : EN by e {} diff --git a/compiler/testData/diagnostics/tests/delegation/DelegationToJavaIface.kt b/compiler/testData/diagnostics/tests/delegation/DelegationToJavaIface.kt index ac22a413534..cc41288b3b0 100644 --- a/compiler/testData/diagnostics/tests/delegation/DelegationToJavaIface.kt +++ b/compiler/testData/diagnostics/tests/delegation/DelegationToJavaIface.kt @@ -1,3 +1,3 @@ class TestIface(r : Runnable) : Runnable by r {} -class TestObject(o : Object) : Object by o {} \ No newline at end of file +class TestObject(o : Object) : Object by o {} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/duplicateJvmSignature/accidentalOverrides/require.kt b/compiler/testData/diagnostics/tests/duplicateJvmSignature/accidentalOverrides/require.kt index 9c8dc4b1f62..a5d3de05b1c 100644 --- a/compiler/testData/diagnostics/tests/duplicateJvmSignature/accidentalOverrides/require.kt +++ b/compiler/testData/diagnostics/tests/duplicateJvmSignature/accidentalOverrides/require.kt @@ -2,6 +2,6 @@ open class C { val x = 1 } -interface Tr : C { +interface Tr : C { fun getX() = 1 } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/j+k/traitDefaultCall.kt b/compiler/testData/diagnostics/tests/j+k/traitDefaultCall.kt index 3ee1de5aa45..17060c15e0a 100644 --- a/compiler/testData/diagnostics/tests/j+k/traitDefaultCall.kt +++ b/compiler/testData/diagnostics/tests/j+k/traitDefaultCall.kt @@ -8,7 +8,7 @@ public interface Test { // FILE: test.kt interface KTrait : Test { fun ktest() { - super.test() + super.test() test() } diff --git a/compiler/testData/diagnostics/tests/modifiers/privateInInterface.kt b/compiler/testData/diagnostics/tests/modifiers/privateInInterface.kt index 10b4627523e..987735bf8c5 100644 --- a/compiler/testData/diagnostics/tests/modifiers/privateInInterface.kt +++ b/compiler/testData/diagnostics/tests/modifiers/privateInInterface.kt @@ -1,6 +1,6 @@ interface My { private val x: Int - private abstract val xx: Int + private abstract val xx: Int private val xxx: Int get() = 0 final val y: Int diff --git a/compiler/testData/diagnostics/tests/override/MissingDelegate.kt b/compiler/testData/diagnostics/tests/override/MissingDelegate.kt index 84329cf1c81..0411f893a24 100644 --- a/compiler/testData/diagnostics/tests/override/MissingDelegate.kt +++ b/compiler/testData/diagnostics/tests/override/MissingDelegate.kt @@ -1,3 +1,3 @@ -class C : Base1 by Base2(1) { +class C : Base1 by Base2(1) { fun test() { } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/override/kt1862.kt b/compiler/testData/diagnostics/tests/override/kt1862.kt index 88d385ce68e..36717cfe219 100644 --- a/compiler/testData/diagnostics/tests/override/kt1862.kt +++ b/compiler/testData/diagnostics/tests/override/kt1862.kt @@ -6,6 +6,6 @@ open class Bbb() : Aaa() { override fun foo() = 2 } -interface Ccc : Aaa +interface Ccc : Aaa class Ddd() : Bbb(), Ccc \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/regressions/TypeParameterAsASupertype.kt b/compiler/testData/diagnostics/tests/regressions/TypeParameterAsASupertype.kt index 7ec391494ae..a5f611397ce 100644 --- a/compiler/testData/diagnostics/tests/regressions/TypeParameterAsASupertype.kt +++ b/compiler/testData/diagnostics/tests/regressions/TypeParameterAsASupertype.kt @@ -1 +1 @@ -class A : T {} \ No newline at end of file +class A : T {} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/regressions/kt307.kt b/compiler/testData/diagnostics/tests/regressions/kt307.kt index 4d9355d9d9f..5b79f91fe5f 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt307.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt307.kt @@ -4,7 +4,7 @@ open class AL { fun get(i : Int) : Any? = i } -interface ALE : AL { +interface ALE : AL { fun getOrNull(index: Int, value: T) : T { return get(index) as? T ?: value } diff --git a/compiler/testData/diagnostics/tests/secondaryConstructors/constructorInTrait.kt b/compiler/testData/diagnostics/tests/secondaryConstructors/constructorInTrait.kt index c065db8636a..2e0b7be2912 100644 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/constructorInTrait.kt +++ b/compiler/testData/diagnostics/tests/secondaryConstructors/constructorInTrait.kt @@ -1,3 +1,3 @@ interface A { - constructor() + constructor() } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/subtyping/unresolvedSupertype.kt b/compiler/testData/diagnostics/tests/subtyping/unresolvedSupertype.kt index 8d34086f741..65f308d4f11 100644 --- a/compiler/testData/diagnostics/tests/subtyping/unresolvedSupertype.kt +++ b/compiler/testData/diagnostics/tests/subtyping/unresolvedSupertype.kt @@ -1,6 +1,6 @@ interface A1 : B -interface A2 : B() +interface A2 : B() class A3 : B, B diff --git a/compiler/testData/diagnostics/tests/thisAndSuper/notAccessibleSuperInTrait.kt b/compiler/testData/diagnostics/tests/thisAndSuper/notAccessibleSuperInTrait.kt index c9565beb36d..0f85c8d94ce 100644 --- a/compiler/testData/diagnostics/tests/thisAndSuper/notAccessibleSuperInTrait.kt +++ b/compiler/testData/diagnostics/tests/thisAndSuper/notAccessibleSuperInTrait.kt @@ -2,9 +2,9 @@ open class A { open fun foo() {} } -interface ATrait : A { +interface ATrait : A { override fun foo() { - super.foo() + super.foo() } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/traitWithRequired/traitRequiresAny.kt b/compiler/testData/diagnostics/tests/traitWithRequired/traitRequiresAny.kt index 8f65d3eddf9..4ec702d1006 100644 --- a/compiler/testData/diagnostics/tests/traitWithRequired/traitRequiresAny.kt +++ b/compiler/testData/diagnostics/tests/traitWithRequired/traitRequiresAny.kt @@ -1,4 +1,4 @@ -interface AnyTrait : Any +interface AnyTrait : Any class Foo : AnyTrait diff --git a/compiler/testData/diagnostics/tests/traitWithRequired/traitSupertypeList.kt b/compiler/testData/diagnostics/tests/traitWithRequired/traitSupertypeList.kt index 71873609eb9..f6701593bc8 100644 --- a/compiler/testData/diagnostics/tests/traitWithRequired/traitSupertypeList.kt +++ b/compiler/testData/diagnostics/tests/traitWithRequired/traitSupertypeList.kt @@ -1,9 +1,9 @@ open class bar() -interface Foo() : bar(), bar, bar { +interface Foo() : bar(), bar, bar { } -interface Foo2 : bar, Foo { +interface Foo2 : bar, Foo { } open class Foo1() : bar(), bar, Foo, Foo() {} diff --git a/compiler/testData/diagnostics/testsWithStdLib/native/trait.kt b/compiler/testData/diagnostics/testsWithStdLib/native/trait.kt index d02af9de9c8..d0c3622c48e 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/native/trait.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/native/trait.kt @@ -1,8 +1,8 @@ import kotlin.jvm.* interface Tr { - external fun foo() - external fun bar() {} + external fun foo() + external fun bar() {} companion object { external fun foo() diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixRegistrar.kt b/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixRegistrar.kt index 8ac0bc1a535..fa083240643 100644 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixRegistrar.kt +++ b/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixRegistrar.kt @@ -62,7 +62,7 @@ public class QuickFixRegistrar : QuickFixContributor { ABSTRACT_PROPERTY_WITH_GETTER.registerFactory(removeAbstractModifierFactory, removePartsFromPropertyFactory) ABSTRACT_PROPERTY_WITH_SETTER.registerFactory(removeAbstractModifierFactory, removePartsFromPropertyFactory) - PROPERTY_INITIALIZER_IN_TRAIT.registerFactory(removePartsFromPropertyFactory) + PROPERTY_INITIALIZER_IN_INTERFACE.registerFactory(removePartsFromPropertyFactory) MUST_BE_INITIALIZED_OR_BE_ABSTRACT.registerFactory(addAbstractModifierFactory) ABSTRACT_MEMBER_NOT_IMPLEMENTED.registerFactory(addAbstractModifierFactory) @@ -104,7 +104,7 @@ public class QuickFixRegistrar : QuickFixContributor { val removeRedundantModifierFactory = RemoveModifierFix.createRemoveModifierFactory(true) REDUNDANT_MODIFIER.registerFactory(removeRedundantModifierFactory) - ABSTRACT_MODIFIER_IN_TRAIT.registerFactory(RemoveModifierFix.createRemoveModifierFromListOwnerFactory(ABSTRACT_KEYWORD, true)) + ABSTRACT_MODIFIER_IN_INTERFACE.registerFactory(RemoveModifierFix.createRemoveModifierFromListOwnerFactory(ABSTRACT_KEYWORD, true)) REDUNDANT_PROJECTION.registerFactory(RemoveModifierFix.createRemoveProjectionFactory(true)) INCOMPATIBLE_MODIFIERS.registerFactory(RemoveModifierFix.createRemoveModifierFactory(false))