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

Enable exception has message check for any exception #434

Closed
Luro02 opened this issue Feb 14, 2024 · 0 comments · Fixed by #522
Closed

Enable exception has message check for any exception #434

Luro02 opened this issue Feb 14, 2024 · 0 comments · Fixed by #522
Labels
bug Something isn't working false-negative A lint should trigger on code that is wrong.

Comments

@Luro02
Copy link
Collaborator

Luro02 commented Feb 14, 2024

Summary

The current implementation is limited to a list of exceptions and does not handle exceptions that are defined by the project.

The problem is that you can do

public class MyException extends Exception {
  public MyException() {
    super("the message is here");
  }
}

So the corresponding throw statement would look like it has no message

throw new MyException();

To set the message one must call a predefined constructor of the parent class, so it should be possible to detect if the exception has a message.

Lint Name

EXCEPTION_WITHOUT_MESSAGE

Reproducer

<code>
@Luro02 Luro02 added bug Something isn't working false-negative A lint should trigger on code that is wrong. labels Feb 14, 2024
Luro02 added a commit to Luro02/autograder that referenced this issue May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working false-negative A lint should trigger on code that is wrong.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant