remove requirements for explicit return type for public members
This commit is contained in:
@@ -245,8 +245,6 @@ public interface Errors {
|
||||
|
||||
// Members
|
||||
|
||||
DiagnosticFactory0<JetNamedDeclaration> PUBLIC_MEMBER_SHOULD_SPECIFY_TYPE = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE);
|
||||
|
||||
DiagnosticFactory2<JetDeclaration, CallableMemberDescriptor, String> CONFLICTING_OVERLOADS =
|
||||
DiagnosticFactory2.create(ERROR, DECLARATION_SIGNATURE_OR_DEFAULT);
|
||||
|
||||
|
||||
-2
@@ -217,8 +217,6 @@ public class DefaultErrorMessages {
|
||||
MAP.put(FUNCTION_EXPRESSION_WITH_NAME, "Function expressions with names are deprecated");
|
||||
MAP.put(NON_FINAL_MEMBER_IN_FINAL_CLASS, "\"open\" has no effect in a final class");
|
||||
|
||||
MAP.put(PUBLIC_MEMBER_SHOULD_SPECIFY_TYPE, "Public or protected member should have specified type");
|
||||
|
||||
MAP.put(FUNCTION_EXPRESSION_PARAMETER_WITH_DEFAULT_VALUE, "A function expression is not allowed to specify default values for its parameters");
|
||||
MAP.put(USELESS_VARARG_ON_PARAMETER, "Vararg on this parameter is useless");
|
||||
MAP.put(DEPRECATED_LAMBDA_SYNTAX,
|
||||
|
||||
@@ -327,22 +327,6 @@ public class DeclarationsChecker {
|
||||
}
|
||||
checkPropertyInitializer(property, propertyDescriptor);
|
||||
checkAccessors(property, propertyDescriptor);
|
||||
checkDeclaredTypeInPublicMember(property, propertyDescriptor);
|
||||
}
|
||||
|
||||
private void checkDeclaredTypeInPublicMember(JetNamedDeclaration member, CallableMemberDescriptor memberDescriptor) {
|
||||
boolean hasDeferredType;
|
||||
if (member instanceof JetProperty) {
|
||||
hasDeferredType = ((JetProperty) member).getTypeReference() == null && DescriptorResolver.hasBody((JetProperty) member);
|
||||
}
|
||||
else {
|
||||
assert member instanceof JetFunction;
|
||||
JetFunction function = (JetFunction) member;
|
||||
hasDeferredType = function.getTypeReference() == null && function.hasBody() && !function.hasBlockBody();
|
||||
}
|
||||
if ((memberDescriptor.getVisibility().getIsPublicAPI()) && memberDescriptor.getOverriddenDescriptors().size() == 0 && hasDeferredType) {
|
||||
trace.report(PUBLIC_MEMBER_SHOULD_SPECIFY_TYPE.on(member));
|
||||
}
|
||||
}
|
||||
|
||||
private void checkPropertyAbstractness(
|
||||
@@ -449,7 +433,6 @@ public class DeclarationsChecker {
|
||||
protected void checkFunction(JetNamedFunction function, SimpleFunctionDescriptor functionDescriptor) {
|
||||
DeclarationDescriptor containingDescriptor = functionDescriptor.getContainingDeclaration();
|
||||
boolean hasAbstractModifier = function.hasModifier(JetTokens.ABSTRACT_KEYWORD);
|
||||
checkDeclaredTypeInPublicMember(function, functionDescriptor);
|
||||
if (containingDescriptor instanceof ClassDescriptor) {
|
||||
ClassDescriptor classDescriptor = (ClassDescriptor) containingDescriptor;
|
||||
boolean inTrait = classDescriptor.getKind() == ClassKind.INTERFACE;
|
||||
|
||||
Reference in New Issue
Block a user