Diagnostic 'final property in interface' deleted because it's redundant

This commit is contained in:
Mikhail Glukhikh
2015-11-17 19:11:59 +03:00
parent cd1b58f2eb
commit b5610eebae
6 changed files with 2 additions and 8 deletions
@@ -361,7 +361,6 @@ public interface Errors {
DiagnosticFactory0<KtExpression> EXTENSION_PROPERTY_WITH_BACKING_FIELD = DiagnosticFactory0.create(ERROR);
DiagnosticFactory0<KtExpression> PROPERTY_INITIALIZER_NO_BACKING_FIELD = DiagnosticFactory0.create(ERROR);
DiagnosticFactory0<KtExpression> PROPERTY_INITIALIZER_IN_INTERFACE = DiagnosticFactory0.create(ERROR);
DiagnosticFactory0<KtProperty> FINAL_PROPERTY_IN_INTERFACE = DiagnosticFactory0.create(ERROR, FINAL_MODIFIER);
DiagnosticFactory0<KtProperty> PRIVATE_PROPERTY_IN_INTERFACE = DiagnosticFactory0.create(ERROR, PRIVATE_MODIFIER);
DiagnosticFactory0<KtProperty> BACKING_FIELD_IN_INTERFACE = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE);
@@ -214,7 +214,6 @@ public class DefaultErrorMessages {
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_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");
MAP.put(PROPERTY_INITIALIZER_NO_BACKING_FIELD, "Initializer is not allowed here because this property has no backing field");
@@ -683,9 +683,6 @@ public class DeclarationsChecker {
if (!error && property.getTypeReference() == null) {
trace.report(PROPERTY_WITH_NO_TYPE_NO_INITIALIZER.on(property));
}
if (inTrait && property.hasModifier(KtTokens.FINAL_KEYWORD) && backingFieldRequired) {
trace.report(FINAL_PROPERTY_IN_INTERFACE.on(property));
}
return;
}
@@ -3,7 +3,7 @@ package a
interface T {
<!FINAL_FUNCTION_WITH_NO_BODY, WRONG_MODIFIER_CONTAINING_DECLARATION!>final<!> fun foo()
<!FINAL_PROPERTY_IN_INTERFACE, WRONG_MODIFIER_CONTAINING_DECLARATION!>final<!> val b : Int
<!WRONG_MODIFIER_CONTAINING_DECLARATION!>final<!> val b : Int
<!WRONG_MODIFIER_CONTAINING_DECLARATION!>final<!> fun bar() {}
<!WRONG_MODIFIER_CONTAINING_DECLARATION!>final<!> val c : Int
@@ -3,7 +3,7 @@ interface My {
<!INCOMPATIBLE_MODIFIERS!>private<!> <!ABSTRACT_MODIFIER_IN_INTERFACE, INCOMPATIBLE_MODIFIERS!>abstract<!> val xx: Int
private val xxx: Int
get() = 0
<!FINAL_PROPERTY_IN_INTERFACE, WRONG_MODIFIER_CONTAINING_DECLARATION!>final<!> val y: Int
<!WRONG_MODIFIER_CONTAINING_DECLARATION!>final<!> val y: Int
<!WRONG_MODIFIER_CONTAINING_DECLARATION!>final<!> val yy: Int
get() = 1
<!PRIVATE_FUNCTION_WITH_NO_BODY!>private<!> fun foo(): Int
@@ -79,7 +79,6 @@ public class QuickFixRegistrar : QuickFixContributor {
val removeFunctionBodyFactory = RemoveFunctionBodyFix.createFactory()
ABSTRACT_FUNCTION_WITH_BODY.registerFactory(removeAbstractModifierFactory, removeFunctionBodyFactory)
FINAL_PROPERTY_IN_INTERFACE.registerFactory(removeFinalModifierFactory)
FINAL_FUNCTION_WITH_NO_BODY.registerFactory(removeFinalModifierFactory)
val addFunctionBodyFactory = AddFunctionBodyFix.createFactory()