Synchronized classes Vector, Hashtable, Stack and StringBuffer should not be used

2021, Sep 09    
sitemap.xml Jekyll Github-Pages

Synchronized classes Vector, Hashtable, Stack and StringBuffer should not be used.

[원인]

java:s1149 룰에 대한 것으로

여기에 위반되는 이유는 static 메소드나 클래스에 StringBuilder가 아닌 StringBuffer등 멀티쓰레드에 적합한 API를 사용했기 떄문이다.

s1149.png

[해결]

나 같은 경우는 StringBuilder로 변경.

[참고]

https://stackoverflow.com/questions/16672730/which-class-to-use-for-this-static-method-stringbuffer-or-stringbuilder