Skip to content

Google-style: add '4.8.4.4 Switch expressions' to coverage table #17171

@mohitsatr

Description

@mohitsatr

from #17165 (comment)

I have downloaded the latest cli from: https://checkstyle.org/cmdline.html#Download_and_Run
I have executed the cli and showed it below, as cli describes the problem better than 1,000 words

https://google.github.io/styleguide/javaguide.html#s4.8.4-switch

4.8.4.4 Switch expressions
Switch expressions must be new-style switches

Image

$ cat InputTry.java

/** Test... */
public class InputTry {
  
  /** Test... */
  public static void main(String[] args) {
    int input = 0;
    switch (input) {
      case 1:
      case 2:
        System.out.println("sout");
        break; 
      case 3:
        System.out.println("sout");
        break;
      default:
        System.out.println("sout");
    }  
  }
}

$ java -jar checkstyle-10.25.0-all.jar -c google_checks.xml InputTry.java 
Starting audit...
Audit done.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions