All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sonar.plugins.vbnet.S927.html Maven / Gradle / Ivy

There is a newer version: 10.5.0.109200
Show newest version

Why is this an issue?

Parameters are part of the method signature and its identity.

Implementing a method from an interface, a base class, or a partial method and changing one of its parameters' names will confuse and impact the method’s readability.

Interface IBankAccount
    Sub AddMoney(money As Integer)
End Interface

Class BankAccount
    Implements IBankAccount

    Private Sub AddMoney(amount As Integer) ' Noncompliant: parameter's name differs from base
        ' ...
    End Sub
End Class

To avoid any ambiguity in the code, a parameter’s name should match the initial declaration, whether its initial declaration is from an interface, a base class, or a partial method.

Interface IBankAccount
    Sub AddMoney(money As Integer)
End Interface

Class BankAccount
    Implements IBankAccount

    Private Sub AddMoney(money As Integer) ' Compliant: parameter's name match base name
        ' ...
    End Sub
End Class

Exceptions

The rule is ignored if both the parameter defined in the initial decalaration is a generic type and the implementing member’s declaration is a non-generic type.

This allows the implementing member to be more specific and provide more information.

Resources

Documentation





© 2015 - 2025 Weber Informatics LLC | Privacy Policy