如何解决 PMD 违规:使用显式范围而不是默认包私有级别

How to solve PMD Violation : Use explicit scoping instead of the default package private level

我想修复我的代码PMD 违规:

Use explicit scoping instead of the default package private level

它出现在我的代码中的这些地方:

File saveFile = new File("C:/Upload/"); 
EmployeImplMetier dbE= new EmployeImplMetier();
DepartementImplMetier dbD = new DepartementImplMetier();
FonctionImplMetier dbF = new FonctionImplMetier();
ServiceImplMetier dbS = new ServiceImplMetier();
TypePaiementImplMetier dbT = new TypePaiementImplMetier();
ModePaiementImplMetier dbM = new ModePaiementImplMetier();

我以前找到过这个LINK,但没用。
谁能建议如何修复它?

这些变量都应该使用private关键字声明:

private File saveFile = new File("C:/Upload/"); 

如果您需要从声明它们的 class 外部访问它们,请实施一些 getXxx 方法。