Code style review and minor issue avoidances

After reviewing the code, apply changes related to the javadoc, and the warning level.

Several parts of the code were updated to detect runtime problems earlier.