dhamini-poornachandra / mockito

Automatically exported from code.google.com/p/mockito
0 stars 0 forks source link

ReflectUtils.addAllInterfaces doesn't support immutable lists #367

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
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

Original issue reported on code.google.com by dumitru....@gmail.com on 15 Aug 2012 at 11:55

GoogleCodeExporter commented 8 years ago
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

Original comment by brice.du...@gmail.com on 20 Aug 2012 at 2:01

GoogleCodeExporter commented 8 years ago

Original comment by brice.du...@gmail.com on 27 Nov 2012 at 5:13