ParcelCheck icon indicating copy to clipboard operation
ParcelCheck copied to clipboard

Issue with nested containers

Open look1n opened this issue 9 years ago • 3 comments

Got issue with creating garbage objects when objects has nested containers. I have class which has List field with nested ArrayList elements. Got this stack trace when running my tests:

java.lang.NoSuchMethodException: [] at java.lang.Class.getConstructor(Class.java:531) at java.lang.Class.getDeclaredConstructor(Class.java:510) at com.commit451.parcelcheck.ObjectHelper.getTestObject(ObjectHelper.java:130) at com.commit451.parcelcheck.ObjectHelper.getObjectForClass(ObjectHelper.java:91) at com.commit451.parcelcheck.ObjectHelper.addObjectToCollection(ObjectHelper.java:145) at com.commit451.parcelcheck.ObjectHelper.getObjectForClass(ObjectHelper.java:86) at com.commit451.parcelcheck.ObjectHelper.fillWithGarbage(ObjectHelper.java:52)

look1n avatar May 20 '16 09:05 look1n

So something like this?:

public class Person {
   ArrayList<ArrayList<String>> groceryLists; 
}

Jawnnypoo avatar May 20 '16 13:05 Jawnnypoo

Like this public class Person { ArrayList<GroceryList> groceryLists; } public class GroceryList extends ArrayList<String> { }

look1n avatar May 20 '16 13:05 look1n

Looks like the specific crash you are seeing happens when there is not an empty constructor on your parcelable object (which will be more clear in the next version). However there is an issue that exists when dealing with classes extending a generic type, which is being taken care of.

AlexKGwyn avatar Jun 02 '16 22:06 AlexKGwyn