Export to GitHub

mockito - issue #367

ReflectUtils.addAllInterfaces doesn't support immutable lists


Posted on Aug 15, 2012 by Massive Dog

This call fails, because mockito tries to modify the passed in list:

ReflectUtils.addAllInterfaces( MyClass.class, Arrays.asList(new Object[] { Serializable.class }) );

Please clone the list, as it will also allow multiple sequential calls, which are currently not possible. Ex: ReflectUtils.addAllInterfaces(One.class, myNewInterfaces); ReflectUtils.addAllInterfaces(Two.class, myNewInterfaces);

Tested with Mockito 1.9.0

Comment #1

Posted on Aug 20, 2012 by Happy Horse

This class is part of the repackaged cglib & asm. I'm not sure we want to modify this code however the modification is easy, as we might update this code in the future without repatching this or other files. Especially since there is new activity in the project, let's cross fingers!

Anyway just use the copy constructor of an Arraylist, plus it has the benefit that you provide the list implementation!

Cheers Brice

Comment #2

Posted on Nov 27, 2012 by Happy Horse

(No comment was entered for this change.)

Status: WontFix

Labels:
Type-Defect Priority-Medium Serialization