Java wildcard generic as return warning in Eclipse and SonarQube
问题 private List gridModel; public List getGridModel() { return gridModel; } Eclipse shows a warning: List is a raw type. References to generic type List should be parameterized. Changing the code to below will remove the warning private List<?> gridModel; public List<?> getGridModel() { return gridModel; } However the above code shows a Major pitfall error in SonarQube which says: Remove usage of generic wildcard type. Generic wildcard types should not be used in return parameters So how can I