From 6cee0c5bca0522022b8cbe594546a240a5176258 Mon Sep 17 00:00:00 2001 From: Eric House Date: Wed, 2 Aug 2017 07:20:48 -0700 Subject: [PATCH] check that all params are serializable DEBUG builds only. --- .../java/org/eehouse/android/xw4/DlgState.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DlgState.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DlgState.java index 1cc94f926..bf38c1a4f 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DlgState.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DlgState.java @@ -24,6 +24,7 @@ import android.os.Bundle; import android.os.Parcel; import android.os.Parcelable; import android.text.TextUtils; +import java.io.Serializable; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -61,7 +62,19 @@ public class DlgState implements Parcelable { public DlgState setAction( Action action ) { m_action = action; return this; } public DlgState setParams( Object... params ) - { m_params = params; return this; } + { + if ( BuildConfig.DEBUG ) { + for ( Object obj : params ) { + if ( null != obj && !(obj instanceof Serializable) ) { + Log.d( TAG, "OOPS: %s not Serializable", + obj.getClass().getName() ); + Assert.assertFalse( BuildConfig.DEBUG ); + } + } + } + m_params = params; + return this; + } public DlgState setActionPair( ActionPair pair ) { m_pair = pair; return this; } public DlgState setOnNA( Action na )