Skip to content
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

//$FALL-THROUGH$ should suppress "possible fall-through into case" #916

Open
datho7561 opened this issue Oct 30, 2024 · 2 comments
Open
Labels
bug Something isn't working

Comments

@datho7561
Copy link

datho7561 commented Oct 30, 2024

eg. I see this sort of thing in the JDT core code-base

switch (someEnum) {
  case MyEnum.AAA:
    System.out.println("i'm screaming");
    //$FALL-THROUGH$
  case MyEnum.BBB:
    System.out.println("i'm producing honey");
    break;
  default:
    System.out.println("i'm none of the above");
}

Currently, an error "possible fall-through into case" is reported on the entire BBB case block:

case MyEnum.BBB:
    System.out.println("i'm producing honey");
    break;

//$FALL-THROUGH is used to indicate that the fall-through was intentional, so it would be nice to suppress the warning if we encounter //$FALL-THROUGH.

@datho7561 datho7561 added the bug Something isn't working label Oct 30, 2024
@mickaelistria
Copy link

Does Javac provide an interesting alternative to FALL-THROUGH?

@datho7561
Copy link
Author

You can do @SuppressWarnings("fallthrough"). I think that must be done on the method level, but I'll double check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants