New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FallThrough check doesn't handle synchronized blocks #5037

Closed
cushon opened this Issue Aug 31, 2017 · 3 comments

Comments

Projects
None yet
3 participants
@cushon
Contributor

cushon commented Aug 31, 2017

Fall through does not occur in this example, but checkstyle reports a warning.

class Test {
  void synchronizedStatement() {
    switch (hashCode()) {
      case 1:
        synchronized (this) {
          break;
        }
      default:
    }
  }
}
java -jar checkstyle-8.2-all.jar -c google_checks.xml Test.java
...
[WARN] Test.java:8:7: Fall through from previous branch of the switch statement. [FallThrough]

Config:

<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
          "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
          "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">


<module name = "Checker">
    <property name="charset" value="UTF-8"/>
    <property name="severity" value="warning"/>
    <property name="haltOnException" value="false"/>
    <module name="TreeWalker">
		<module name="FallThrough"/>
    </module>
</module>
@romani

This comment has been minimized.

Show comment
Hide comment
@romani

romani Aug 31, 2017

Member

@Vladlis , as you approved this issue, please update description to follow our rules.
config should be provided.

Member

romani commented Aug 31, 2017

@Vladlis , as you approved this issue, please update description to follow our rules.
config should be provided.

@Vladlis

This comment has been minimized.

Show comment
Hide comment
@Vladlis

Vladlis Aug 31, 2017

Member

@romani Updated

Member

Vladlis commented Aug 31, 2017

@romani Updated

cushon added a commit to cushon/checkstyle that referenced this issue Sep 1, 2017

cushon added a commit to cushon/checkstyle that referenced this issue Sep 1, 2017

Vladlis added a commit that referenced this issue Sep 1, 2017

@Vladlis

This comment has been minimized.

Show comment
Hide comment
@Vladlis

Vladlis Sep 1, 2017

Member

Fix is merged

Member

Vladlis commented Sep 1, 2017

Fix is merged

@Vladlis Vladlis added this to the 8.3 milestone Sep 1, 2017

@Vladlis Vladlis closed this Sep 1, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment