mirror of
https://github.com/corda/corda.git
synced 2025-06-14 13:18:18 +00:00
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:
@ -18,10 +18,12 @@ import avian.Classes;
|
||||
import avian.InnerClassReference;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.GenericDeclaration;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.lang.reflect.Type;
|
||||
import java.lang.reflect.TypeVariable;
|
||||
import java.lang.reflect.Proxy;
|
||||
import java.lang.reflect.InvocationHandler;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
@ -38,7 +40,9 @@ import java.security.ProtectionDomain;
|
||||
import java.security.Permissions;
|
||||
import java.security.AllPermission;
|
||||
|
||||
public final class Class <T> implements Type, AnnotatedElement {
|
||||
public final class Class <T>
|
||||
implements Type, AnnotatedElement, GenericDeclaration
|
||||
{
|
||||
private static final int PrimitiveFlag = 1 << 5;
|
||||
private static final int EnumFlag = 1 << 14;
|
||||
|
||||
@ -96,9 +100,8 @@ public final class Class <T> implements Type, AnnotatedElement {
|
||||
}
|
||||
}
|
||||
|
||||
return new String
|
||||
(replace('/', '.', c.name, 0, c.name.length - 1), 0, c.name.length - 1,
|
||||
false);
|
||||
return Classes.makeString
|
||||
(replace('/', '.', c.name, 0, c.name.length - 1), 0, c.name.length - 1);
|
||||
}
|
||||
|
||||
public String getCanonicalName() {
|
||||
@ -496,6 +499,10 @@ public final class Class <T> implements Type, AnnotatedElement {
|
||||
return (vmClass.flags & Modifier.INTERFACE) != 0;
|
||||
}
|
||||
|
||||
public boolean isAnnotation() {
|
||||
return (vmClass.flags & 0x2000) != 0;
|
||||
}
|
||||
|
||||
public Class getSuperclass() {
|
||||
return (vmClass.super_ == null ? null : SystemClassLoader.getClass(vmClass.super_));
|
||||
}
|
||||
@ -523,8 +530,8 @@ public final class Class <T> implements Type, AnnotatedElement {
|
||||
|
||||
public URL getResource(String path) {
|
||||
if (! path.startsWith("/")) {
|
||||
String name = new String
|
||||
(vmClass.name, 0, vmClass.name.length - 1, false);
|
||||
String name = Classes.makeString
|
||||
(vmClass.name, 0, vmClass.name.length - 1);
|
||||
int index = name.lastIndexOf('/');
|
||||
if (index >= 0) {
|
||||
path = name.substring(0, index) + "/" + path;
|
||||
@ -647,4 +654,12 @@ public final class Class <T> implements Type, AnnotatedElement {
|
||||
public ProtectionDomain getProtectionDomain() {
|
||||
return Classes.getProtectionDomain(vmClass);
|
||||
}
|
||||
|
||||
public TypeVariable<?>[] getTypeParameters() {
|
||||
throw new UnsupportedOperationException("not yet implemented");
|
||||
}
|
||||
|
||||
public Type[] getGenericInterfaces() {
|
||||
throw new UnsupportedOperationException("not yet implemented");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user