ClassVariableVisibilityCheck on collection


(Ewa Śliwińska) #1

I have following class:

import java.util.LinkedList;
import java.util.List;

public class SomeClass
   public List<String> someList = new LinkedList<>();

This gives me ClassVariableVisibilityCheck which says I could make this final static (I would like to avoid adding accessors). But when I do this, I still have minor vulnerability (just like before) - S2386 - which says to make it protected. So I anyway need to end up having accesors.

In that case it makes no sense to apply rule which says that I can make this static final :frowning:

I’m using SonarLint 3.6 for Eclipse.