update to more recent version of Android class library

Lots has changed since we forked Android's libcore, so merging the
latest upstream code has required extensive changes to the
Avian/Android port.

One big change is that we now use Avian's versions of
java.lang.Object, java.lang.Class, java.lang.ClassLoader, some
java.lang.reflect.* classes, etc. instead of the Android versions.
The main reason is that the Android versions have become very
Dex/Dalvik-specific, and since Avian is based on Java class files, not
dex archives, that code doesn't make sense here.  This has the side
benefit that we can share more native code with classpath-avian.cpp
and reduce the amount of Java/C++ code duplication.
This commit is contained in:
Joel Dice
2014-08-21 13:09:42 -06:00
parent ba808a8589
commit b96cc3c575
21 changed files with 556 additions and 1393 deletions

View File

@ -52,7 +52,7 @@ public class Method<T> extends AccessibleObject implements Member {
}
public static String getName(VMMethod vmMethod) {
return new String(vmMethod.name, 0, vmMethod.name.length - 1, false);
return Classes.makeString(vmMethod.name, 0, vmMethod.name.length - 1);
}
private String getSpec() {
@ -60,7 +60,7 @@ public class Method<T> extends AccessibleObject implements Member {
}
public static String getSpec(VMMethod vmMethod) {
return new String(vmMethod.spec, 0, vmMethod.spec.length - 1, false);
return Classes.makeString(vmMethod.spec, 0, vmMethod.spec.length - 1);
}
public Class[] getParameterTypes() {
@ -107,8 +107,8 @@ public class Method<T> extends AccessibleObject implements Member {
if (vmMethod.spec[i] == ')') {
return Classes.forCanonicalName
(vmMethod.class_.loader,
new String
(vmMethod.spec, i + 1, vmMethod.spec.length - i - 2, false));
Classes.makeString
(vmMethod.spec, i + 1, vmMethod.spec.length - i - 2));
}
}
throw new RuntimeException();
@ -149,8 +149,16 @@ public class Method<T> extends AccessibleObject implements Member {
return (getModifiers() & 0x80) != 0;
}
public boolean isSynthetic() {
return (getModifiers() & 0x1000) != 0;
}
public Object getDefaultValue() {
ClassLoader loader = getDeclaringClass().getClassLoader();
return Classes.getAnnotationDefaultValue(loader, vmMethod.addendum);
}
public Class<?>[] getExceptionTypes() {
throw new UnsupportedOperationException("not yet implemented");
}
}