Currently, final constants mostly use camel-case for naming, which is wrong.
finalstaticintmaxPlayers=10;
They should instead be all uppercase with underscores as separators.
finalstaticintMAX_PLAYERS=10;
Additionally, we often have methods returning final constants. Following Java best practices, final constants should be public and directly accessible, if that's their scope - not requiring a useless method call that isn't doing any logic (and is ambiguous).
Currently, `final` constants mostly use camel-case for naming, which is wrong.
```java
final static int maxPlayers = 10;
```
They should instead be all uppercase with underscores as separators.
```java
final static int MAX_PLAYERS = 10;
```
Additionally, we often have methods returning final constants. Following Java best practices, final constants should be public and directly accessible, if that's their scope - not requiring a useless method call that isn't doing any logic (and is ambiguous).
bea
added the enhancement label 2023-01-16 02:16:36 +01:00
bea
changed title from Fix final variables treatment to Improve final Objects handling2023-01-16 02:17:13 +01:00
Keep in mind that not all final constants are required to be uppercase. Non-static fields and local variables are often left in camel case.
See: [[Link 1]](https://softwareengineering.stackexchange.com/questions/252243/naming-convention-final-fields-not-static) [[Link 2]](https://stackoverflow.com/questions/46407151/naming-convention-for-java-final-variable-which-is-not-static).
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Currently,
finalconstants mostly use camel-case for naming, which is wrong.They should instead be all uppercase with underscores as separators.
Additionally, we often have methods returning final constants. Following Java best practices, final constants should be public and directly accessible, if that's their scope - not requiring a useless method call that isn't doing any logic (and is ambiguous).
Fix final variables treatmentto Improve final Objects handlingKeep in mind that not all final constants are required to be uppercase. Non-static fields and local variables are often left in camel case.
See: [Link 1] [Link 2].
This was partially addressed in
94037b252f. More checks are due.