Sonarlint扫描报出“static“ base class members should not be accessed via derived types

问题描述:

JSONObject.toJSONString()

在Sonarlint检查中发现提示: 

static” base class members should not be accessed via derived types

In the interest of code clarity, static members of a base class should never be accessed using a derived type’s name. Doing so is confusing and could create the illusion that two different static members exist.

意思是如果子类继承了父类的静态成员,不应该通过子类去调用

解决方案:

改成父类的调用:

JSON.toJSONString()

猜你喜欢

转载自blog.csdn.net/gaoshan12345678910/article/details/128838347
今日推荐