Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

#DescriptionBadGood
1Don't forget to check the copyright (smile)
(add/modify new calendar year to existing copyright if needed)

/*
 *  ============LICENSE_START=======================================================
 *  Copyright (C) 2021 Other Company
 *  Modifications Copyright (C) 2021-2022 Nordix Foundation
2Overuse of constant for String Literals (that don't add value)
Also duplication is not a good reason, it often 'smells like' a method that should be extracted out instead

final static String HELLO = "Hello ";
String message = HELLO + name;

String message = "Hello " + name;

String sayHello(final String name) {
  return "Hello " + name;
}

3Avoid using ! when else block is implemented 

if (x!=null) {
  do something;
} else {
  report error;
}

if (x==null) {
   report error;
} else {
   do something;
}
4No need for else after return statement

if (x==true) {
   return something;
} else {
   return something-else;
}

if (x==true) {
  return something;
}
return something-else;

...