Uploaded image for project: 'SonarJava'
  1. SonarJava
  2. SONARJAVA-3179

Relying on ECJ Parser, Rule S1190 could support case of "assert" as identifier

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.0
    • Component/s: Rules
    • Labels:
      None

      Description

      In early version of Java, assert (introduced as keyword in Java 1.4) was possible to be used as identifier, before being declared as keyword.

      With introduction of the ECJ parser in SonarJava, which by design requires a java version to be set in order to be able to parse with the adequate level, and which supports old versions of Java, we should be able to improve the rule to cover this case.

      void foo() {
        String assert = "hello";   // Noncompliant - but compiles only with Java < 1.4
      }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                amelie.renard Amélie Renard
                Reporter:
                michael.gumowski Michael Gumowski
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved: