-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Fixed a number of warnings #286
Conversation
@@ -160,7 +160,7 @@ public void start(String[] args) { | |||
openWindow(loaded); | |||
} | |||
|
|||
private void setupLogHandlerForErrorConsole() { | |||
private static void setupLogHandlerForErrorConsole() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you turn this static? It is not called from a static context.
I find this PR very valuable (we need such improvements). The only thing I am unsure about is turning various methods static (see above). Can you explain the rationale behind this? Why is static needed here? |
The |
As @koppor correctly pointed out, this is based on Eclipse warnings and
Eclipse warnings only. I've trusted it so far, but recently I've noted that
some warnings disappear when I fix other, to me seemingly unrelated,
warnings, so maybe I should read up a bit...
|
I tend to disagree with the warning and would prefer non-static versions. The problem with the use of static is that it leads to a higher degree of coupling within the system. Every user of a static method uses the very same instance (that is, the class) and this transitively couples two users although there might be no need for it. Don't get me wrong, the code works with both versions. Especially if the class is instantiated only once, as is the case in the above line I commented at, there is no difference execution-wise. It is merely a "design smell". I have the opinion that a design with a lot of use of static is "worse" than a more object-oriented design. If we consistently favor static over non-static, we end up with a purely imperative program, which means we are propably using the wrong programming language. @JabRef/developers This is about a coding guideline and concerns everyone. So what are the opinions of the remaining people? Should we consistently fix the Eclipse warning regarding the use of static, or should we turn it off? |
OK, I've read up and see the point. I'd say that maybe one should go through all the static methods and remove the static keyword and add warning removal in case it does not make sense to access the method in a static way. For reference: I've done this in the earlier cleanups as well, so it may be better to go over it once and for all (although I can of course start by changing these ones back). |
I agree with @lenhard - we should try to reduce the usage of
Objections? @lenhard I don't like |
@matthiasgeiger full ack 👍 |
@koppor Looks got to me. I imported the project into Eclipse and am not getting the warning at the above position. I also agree with you on the usage of "this": it should not be mandatory. However, I found another Eclipse warning, we should be aware of here. In the following line new FocusRequester(((BasePanel) JabRef.jrf.tabbedPane.getComponentAt(0)).mainTable); Eclipse warns that |
398aec6
to
0723ae7
Compare
I have removed the statics introduced in this PR. |
b91d5b8
to
6871cca
Compare
Rebased on current master so it should be possible to merge this (unless any other issues arise). |
* @param child | ||
* Sorts the entry list using the values of the string entry variable sort.key$. It has no arguments. | ||
* | ||
* @param |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@param
should be removed here completely
Huh.... requires quite some time to scroll through all your changes 😉 As you can see above I had a few remarks. Apart from those: Good job! Should be ready to merge (which should be easy after your rebasing - bonus kudos for this 🏆) |
Thanks for the review! Should be good to go now. |
Fixed a number of warnings
Got rid of a number of warnings: