-
Notifications
You must be signed in to change notification settings - Fork 111
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
NonStaticMethodCheck complains about methods that just throw an exception #623
Comments
@mkordas You are right, I update description to give another example. |
@HDouss If you gave an example please show it, if not please close this issue |
@krzyk The examples are in the description:
|
@HDouss but such methods are not correct ones, so the appropriate way of dealing with this is adding an exclude. readObject/writeObject shouldn't be implemented if there is no state. |
@krzyk But NonStaticMethodCheck should alert the developer about methods that are not declared as static but are in fact static. For example:
Why such a method should be static ? |
@HDouss OK, so you are saying that we should exclude the |
@krzyk I would say that in general, if a method just throws an exception shouldn't be considered as static. |
@HDouss please update the description with that clarification |
@HDouss method that only throws exception |
@krzyk Done. |
@HDouss also add an example code, it will be easier to understand and implement |
@krzyk First sentence:
|
@HDouss yes, I noticed that later :), but example would make it even better. |
@davvd valid bug |
@davvd this is postponed |
@HDouss thanks for reporting! I topped your account for 15 mins, transaction 75228386 |
@davvd this is not postponed |
@kitsook OK, I'll reassign |
@davvd the pull request has been submitted. |
@HDouss can you close this issue as it has been fixed? Thanks. |
@gumbelmj it seems that the implementation also excludes such cases: private void data(final String input) {
try {
Class.someStaticMethod(input);
} catch (final IOException ex) {
throw new IllegalStateException(ex);
}
} The example above is a true positive (i.e it should raise a complaint by |
@HDouss I don't think this is a good case, if there is such method it should be definitely static (unless it is an |
@krzyk This is what I said
But the solution provided by the PR will exclude such case. |
@krzyk It will exclude it from the check, but it shouldn't. Such case should make qulice raise an issue. |
@HDouss Sorry, you are right ( I must learn not to read on the phone :) ). |
@gumbelmj yes you should, deploy is just to finish the PR, you will need to create a new one. |
@gumbelmj please add reference to the pull requests here |
@HDouss this has been merged again. Are you satisfied with the code now? |
@gumbelmj Thanks |
NonStaticMethodCheck complains about methods that only throws an exception. This could be fine in cases where a class implementation have a "not yet" supported feature or a serializable object that does not support readObject/writeObject where the method have just to throw an appropriate exception. Example:
The text was updated successfully, but these errors were encountered: