我在Sonar上看到这个警告:
隐藏实用类构造函数:
实用类不应该有公共或默认构造函数
我的类:
public class FilePathHelper {
private static String resourcesPath;
public static String getFilePath(HttpServletRequest request) {
if(resourcesPath == null) {
String serverpath = request.getSession()
.getServletContext()
.getRealPath("");
resourcesPath = serverpath + "/WEB-INF/classes/";
}
return resourcesPath;
}
}
我希望有解决方法能够移除在 Sonar Qube 上出现的这个警告。