dexmaker proxy abstract class result in dex2oat failure,phone:HMNOTE2_V7.0.6.0.LHMCNCI
- Dominant language
- Java
- Stars
- 2k
- Forks
- 262
- PR merge metrics
- No merged PRs in 30d
Description
we encounter this question when release apk to app market.
the problem was that dexmaker generated proxy class contains call to super abstract method, which fail the dex2oat tool in MIUI V7.0.6.0.LHMCNCI.
workaround is :
Since build() method checks InvocationHandler not null, and we use InvocationHandler when proxy our class, generated class don’t need call super.XXX if XXX is abstract in baseClass.
dexmaker will generate class like below:(clone method is just an EXAMPLE)
public Object clone() {
Method method = $__methodArray[0];
Object[] objArr = new Object[0];
InvocationHandler invocationHandler = this.$__handler;
if (null == invocationHandler) {
return super.clone();
}
return invocationHandler.invoke(this, method, objArr);
}
Our workaround generated class is like this:
```
public Object clone() {
Method method = $__methodArray[0];
Object[] objArr = new Object[0];
InvocationHandler invocationHandler = this.$__handler;
if (null != invocationHandler) {
return invocationHandler.invoke(this, method, objArr);
}
throw new IllegalStateException();
}
```
Patch file is attached.
[0001-dexmaker-abstract-super-call-abstract-method.txt](https://github.com/crittercism/dexmaker/files/74713/0001-dexmaker-abstract-super-call-abstract-method.txt)
Contributor guide
Research direction
Review the attached 0001-dexmaker-abstract-super-call-abstract-method.txt patch and locate the proxy class generation path it changes. Check how build() handles a non-null InvocationHandler and how generated methods behave when their superclass method is abstract. Done means generated proxies avoid the abstract super call and no longer cause the reported dex2oat failure on the stated MIUI version.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100