Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SonarQube catch 22 with serializable lists

Tags:

java

sonarqube

At first I had a class along the lines of:

public class MyClass implements Serializable {

    private List<Role> roles;

}

SonarQube pointed out that List, a member of a serializable class, is not serializable itself. Fair enough, I'll switch to a serializable implementation of List like ArrayList.

public class MyClass implements Serializable {

    private ArrayList<Role> roles;

}

At this point SonarQube is unhappy because "roles should use an interface such as 'List' rather than an implementation like 'ArrayList'" which brings me back to where I was originally.

Is there a way out of this loop?

like image 891
Bill Avatar asked May 21 '15 20:05

Bill


1 Answers

It looks your issue was solved just two days ago.

https://jira.sonarsource.com/browse/SONARJAVA-808

like image 90
Ezequiel Avatar answered Nov 10 '22 13:11

Ezequiel