greyblue9 / dexmaker

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

proxy abstract classes but not callSuper to access the original super method #35

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. proxy android.widget.BaseAdapter
2. callsuper method
3. will throw a exception

all code:
InvocationHandler handler = new InvocationHandler() {
     @Override
     public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
         if (method.getName().equals("xxxx")) {
             return null;
         }
         Object result = ProxyBuilder.callSuper(proxy, method, args);
         System.out.println("Method: " + method.getName() + " args: "
                 + Arrays.toString(args) + " result: " + result);
         return result;
     }
 };
 Object foo = ProxyBuilder.forClass(android.widget.BaseAdapter.class)
         .dexCache(getInstrumentation().getTargetContext().getDir("dx", Context.MODE_PRIVATE))
         .handler(handler)
         .build(); 

foo.areAllItemsEnabled(); // will throw a exception!!

What is the expected output? What do you see instead?
can call super method except abstract method

What version of the product are you using? On what operating system?
jdk 1.6, android 4.0

Please provide any additional information below.

Original issue reported on code.google.com by ganger...@gmail.com on 9 Apr 2014 at 2:20

GoogleCodeExporter commented 8 years ago
((BaseAdapter)foo).areAllItemsEnabled(); 

Original comment by ganger...@gmail.com on 9 Apr 2014 at 2:25