0
public class ClassName implements Serializable {

private static final long serialVersionUID = 1L;

private Map<String, Object> variableName;

In the above code, the sonarQube is giving CRITICAL level issue because of variableName. I know Object is not serializable but do anyone have any solution to avoid or resolve this issue.

Moeezalikhan
  • 41
  • 3
  • 10
  • Does this answer your question? [Java Serialization with non serializable parts](https://stackoverflow.com/questions/95181/java-serialization-with-non-serializable-parts) – jeprubio Apr 06 '20 at 08:11
  • Not all implementations of `Map` are `Serializable`; also, not all `Object`s are serializable. Change `Map` and `Object` to something that are serializable. – Andy Turner Apr 06 '20 at 08:22
  • @AndyTurner any suggestion. Change Map and Object to what? – Moeezalikhan Apr 06 '20 at 09:38
  • @jeprubio let me implement it. I still have doubts on this how it's working – Moeezalikhan Apr 06 '20 at 09:39
  • @Moeezalikhan for example `HashMap` is serializable, provided its keys and values are serializable. As for an alternative to `Object`: it entirely depends what you're trying to store. – Andy Turner Apr 06 '20 at 09:41

0 Answers0