Standardize the development process of programmers through plug-ins (2) (Eclipse code assistant new function release)

The assistant continues to update and adds the following functions. For other functions of this plugin, please refer to the first blog post

 

The main function of this assistant is to unify code specifications and reduce version problems when production goes online.

The following prompts, using Ctrl+F1 will generally prompt the automatic modification of quickFix, in general, you can modify it according to the suggestions.

 

 

Add the following hints to the Java code

1: java.net.URLEncoder.encode adds a prompt without encoding

2: getBytes adds a prompt without encoding

3: System.out.println prompts the following content. This method will cause the log to be too large in the production environment, but the out log cannot generate files according to the date, which will cause the log to be too large and difficult to operate and maintain.

4: System.exit prompts the following content This method will cause the program to exit abnormally, please delete this statement

5: System.err.println prompts the following: This method will cause the log to be too large in the production environment, but the out log cannot generate files according to the date, which will cause the log to be too large and difficult to operate and maintain

6:java.net.URLDecoder.decode The following content method is not recommended. This method will obtain the system variable as the character set. There will be potential problems in the system connection, etc. The character set needs to be specified.

7: The printStackTrace method of Exception prompts the following content. This method will cause the log to be too large in the production environment, but the out log cannot generate files according to the date, which will cause the log to be too large and difficult to operate and maintain.

8: java.util.Locale.getDefault prompts the following: java.util.Locale.getDefault() is to obtain the value of the system environment variable, this method is not recommended, it is recommended to use Locale.SIMPLIFIED_CHINESE, the output value is zh_CN, or ask from the top and bottom , the program will read the properties file ending with zh_CN

9: If the class in the source file is the same as the class of the Jar package, the prompt package has the same package path and class name. In different environments, the loading order will cause the production to call the classes of different packages, which will lead to production exceptions. , please modify the Java class name

10: Prompt the following for java.lang.Double: java.lang.Double is an inexact numeric type, please use java.math.BigDecimal() instead

11:java.lang.Float prompts the following: java.lang.Float is an inexact numeric type, please use java.math.BigDecimal() instead

12:float prompts the following: float is an inexact numeric type, please use java.math.BigDecimal() instead

13: double prompts the following: double is an inexact number type, please use java.math.BigDecimal() instead

14: java.util.Random prompts the following: java.util.Random type is not secure enough, please use java.security.SecureRandom instead

15: Use startBatch and executeBatch in the doInSqlMapClient method to prompt the following:

In the doInSqlMapClient method, the batch submission method has been used, and there is no need to use startBatch again. At the same time, this will cause the execution process to be in a suspended state in the Oracle database and cannot be automatically terminated. Just remove this code.

16: Prompt the following for new String(): The new String(byte[]) method is not recommended, it will get the system default character set, you need to specify the character set corresponding to the byte[] array, the character set in the system is UTF-8, Other system character set is GBK, please select the corresponding character set to fill in

17: At present, most of them are using the spring framework. Generally, singleton methods are used in classes to prompt the code that is prone to memory confusion.

This class is a singleton. In the case of concurrency, there will be memory confusion, so this variable cannot be assigned a value in the class. If you confirm that this method is indeed called only once during the entire system operation, please add Method_Once_Invoke in the method annotation, The solution needs to be confirmed by the project manager or team leader

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326622620&siteId=291194637