greyblue9 / dexmaker

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

dexmaker asserts that InvocationHandler.invoke args should be non-null #27

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. fix dalvik to pass a null value to InvocationHandler.invoke args
2. use mockito with an interface method that takes no arguments

What is the expected output? What do you see instead?
Don't want to see IllegalArgumentException

What version of the product are you using? On what operating system?
Using from external/dexmaker in AOSP ToT

Please provide any additional information below.
Fix is trivial, just remove null check. I'm filing this for reference before 
posting patch to AOSP. I'll link to the CL there when it is uploaded.

diff --git 
a/src/mockito/java/com/google/dexmaker/mockito/InvocationHandlerAdapter.java 
b/src/mockito/java/com/google/dexmaker/mockito/InvocationHandlerAdapter.java
index 268f2fd..2775a63 100644
--- a/src/mockito/java/com/google/dexmaker/mockito/InvocationHandlerAdapter.java
+++ b/src/mockito/java/com/google/dexmaker/mockito/InvocationHandlerAdapter.java
@@ -45,11 +45,6 @@ final class InvocationHandlerAdapter implements 
InvocationHandler {
             return System.identityHashCode(proxy);
         }

-        if (args == null) {
-            throw new IllegalArgumentException();
-        }
-
-
         ProxiedMethod proxiedMethod = new ProxiedMethod(method);
         return handler.handle(new InvocationImpl(proxy, proxiedMethod, args, SequenceNumber.next(),
                 proxiedMethod));

Original issue reported on code.google.com by b...@google.com on 9 Oct 2013 at 9:33

GoogleCodeExporter commented 8 years ago
Here is the AOSP CL for review: 
https://android-review.googlesource.com/#/c/67600/

I'm not sure how to otherwise upstream this fix.

Original comment by b...@google.com on 9 Oct 2013 at 9:40

GoogleCodeExporter commented 8 years ago
This issue is already fixed at least in dexmaker-mockito 1.2.

Original comment by yuya.pre...@gmail.com on 24 Jul 2015 at 9:39