SonarQube Java
  1. SonarQube Java
  2. SONARJAVA-81

CallToDeprecatedMethod: Improve the violation message

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.3
    • Component/s: Squid
    • Labels:
      None
    • Number of attachments :
      0

      Description

      In the following code:

          Toolkit toolkit = new Toolkit(CobolParser.create(conf),
              Lists.newArrayList((Tokenizer) new CobolSyntaxHighlighterChannel()),
              "SSLR :: COBOL :: Toolkit");
      

      if the call to:

      new CobolSyntaxHighlighterChannel()
      

      is deprecated, then a violation is created on the first line of the snippet:

      Toolkit toolkit = new Toolkit(CobolParser.create(conf),
      

      and that it is fine.

      It indeed is a limitation of the generated bytecode.

      However, the violation message currently is:

      Method '<init>(...)' is deprecated.
      

      whereas we could and should show something a bit more meaningful, such as:

      Constructor 'CobolSyntaxHighlighterChannel()' is deprecated
      

        Activity

        Hide
        Evgeny Mandrikov added a comment -

        Now we distinguish constructors from methods and message contains short name of class in both cases.

        Show
        Evgeny Mandrikov added a comment - Now we distinguish constructors from methods and message contains short name of class in both cases.
        Hide
        Fabrice Bellingard added a comment -

        Tested.

        Show
        Fabrice Bellingard added a comment - Tested.

          People

          • Assignee:
            Evgeny Mandrikov
            Reporter:
            Dinesh Bolkensteyn
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: