[JAVA] Code review points
- Are there any exceptions?
- Does the original exception disappear due to the exception generated in the catch block?
- When wrapping an exception with another exception, do you include the original exception?
- ʻE.printStacktrace` is missing (except when permitted by coding standards, etc.)
- Be able to track the information of the exception that occurred, such as e.addSuppressed, which is output to the log.
- In the comments, specify the reason why you can squeeze it if you can squeeze it.
- Are variables overwritten (except in certain circumstances)?
- The only variables that need to be overwritten are usually counters.
- Are you nesting blocks where early returns are applicable?
- If you are processing with an if block such as if (isXXX) {}, consider whether if (! IsXXX) {return;} can be applied.
- Are there any omissions in closing resources?
- Closeable / AutoCloseable such as InputStream / OutputStream actively uses try-with-resources
- If you do not explicitly close, specify in the comment when to close and why not close
- Is there any excessive checking process?
- Specify in Javadoc whether to allow nulls in public methods or not.
- return null; Code returns a constant that represents Empty as much as possible (such as Optional # empty () and Collections # emptyList ()).
- If return null is in an abnormal state, throw an exception, or use the class that represents the status as the return value.
- Are you using the constants defined in the library etc.
- HTTP status code etc.
- Is IN / OUT processing buffered?
- Use BufferedInputStream instead of raw InputStream, etc.
- Is the specific code that appears frequently properly classified and made into a utility?
- In principle, delegation is based on delegation rather than inheritance.
- is --Are there any inheritance that does not become a?
If there are many processes that branch depending on the instance such as * instance of, there is a high possibility that an appropriate inheritance relationship is not maintained.
- Is the resource open in the constructor?
- If you want to open the resource in the constructor, consider static factory method.
- Can constants apply enums?