Skip to content

Commit

Permalink
Updated native class metadata, needed to fix -Wmissing-field-initiali…
Browse files Browse the repository at this point in the history
…zers warnings;

fixed IOSMappedClass constructor test.
	Change on 2015/12/11 by tball <[email protected]>
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=109997078
  • Loading branch information
tomball committed Dec 14, 2015
1 parent d156673 commit 3349a91
Show file tree
Hide file tree
Showing 14 changed files with 429 additions and 238 deletions.
112 changes: 91 additions & 21 deletions jre_emul/Classes/IOSClass.m
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@
#import "objc/message.h"
#import "objc/runtime.h"

#define IOSClass_serialVersionUID 3206093459760846163LL

J2OBJC_INITIALIZED_DEFN(IOSClass)

@implementation IOSClass
Expand Down Expand Up @@ -1311,30 +1313,98 @@ + (void)load {
J2ObjC_icu_init();
}

+ (long long int)serialVersionUID {
return 3206093459760846163L;
}

// Generated by running the translator over the java.lang.Class stub file.
+ (J2ObjcClassInfo *)__metadata {
static J2ObjcMethodInfo methods[] = {
{ "getClasses", NULL, "[Ljava/lang/Class;", 0x1, NULL },
{ "getDeclaredClasses", NULL, "[Ljava/lang/Class;", 0x1, "Ljava/lang/SecurityException;" },
{ "getDeclaringClass", NULL, "Ljava/lang/Class;", 0x1, NULL },
{ "getGenericSuperclass", NULL, "Ljava/lang/reflect.Type;", 0x1, NULL },
{ "getSigners", NULL, "Ljava/lang/Object;", 0x1, NULL },
{ "isAnnotation", NULL, "Z", 0x1, NULL },
{ "isAnnotationPresent", NULL, "Z", 0x1, NULL },
{ "isLocalClass", NULL, "Z", 0x1, NULL },
{ "isMemberClass", NULL, "Z", 0x1, NULL },
{ "isSynthetic", NULL, "Z", 0x1, NULL },
};
static J2ObjcFieldInfo fields[] = {
{ "serialVersionUID_", NULL, 0x1a, "J" },
+ (const J2ObjcClassInfo *)__metadata {
static const J2ObjcMethodInfo methods[] = {
{ "forName:", "forName", "Ljava.lang.Class;", 0x9, "Ljava.lang.ClassNotFoundException;",
"(Ljava/lang/String;)Ljava/lang/Class<*>;" },
{ "forName:initialize:classLoader:", "forName", "Ljava.lang.Class;", 0x9,
"Ljava.lang.ClassNotFoundException;",
"(Ljava/lang/String;ZLjava/lang/ClassLoader;)Ljava/lang/Class<*>;" },
{ "asSubclass:", "asSubclass", "Ljava.lang.Class;", 0x1, NULL,
"<U:Ljava/lang/Object;>(Ljava/lang/Class<TU;>;)Ljava/lang/Class<+TU;>;" },
{ "cast:", "cast", "TT;", 0x1, NULL, "(Ljava/lang/Object;)TT;" },
{ "desiredAssertionStatus", NULL, "Z", 0x1, NULL, NULL },
{ "getAnnotationWithIOSClass:", "getAnnotation", "TA;", 0x1, NULL,
"<A::Ljava/lang/annotation/Annotation;>(Ljava/lang/Class<TA;>;)TA;" },
{ "getAnnotations", NULL, "[Ljava.lang.annotation.Annotation;", 0x1, NULL, NULL },
{ "getCanonicalName", NULL, "Ljava.lang.String;", 0x1, NULL, NULL },
{ "getClasses", NULL, "[Ljava.lang.Class;", 0x1, NULL, NULL },
{ "getClassLoader", NULL, "Ljava.lang.ClassLoader;", 0x1, NULL, NULL },
{ "getComponentType", NULL, "Ljava.lang.Class;", 0x1, NULL, "()Ljava/lang/Class<*>;" },
{ "getConstructor:", "getConstructor", "Ljava.lang.reflect.Constructor;", 0x81,
"Ljava.lang.NoSuchMethodException;Ljava.lang.SecurityException;",
"([Ljava/lang/Class<*>;)Ljava/lang/reflect/Constructor<TT;>;" },
{ "getConstructors", NULL, "[Ljava.lang.reflect.Constructor;", 0x1,
"Ljava.lang.SecurityException;", NULL },
{ "getDeclaredAnnotations", NULL, "[Ljava.lang.annotation.Annotation;", 0x1, NULL, NULL },
{ "getDeclaredClasses", NULL, "[Ljava.lang.Class;", 0x1, "Ljava.lang.SecurityException;",
NULL },
{ "getDeclaredConstructor:", "getDeclaredConstructor", "Ljava.lang.reflect.Constructor;", 0x81,
"Ljava.lang.NoSuchMethodException;Ljava.lang.SecurityException;",
"([Ljava/lang/Class<*>;)Ljava/lang/reflect/Constructor<TT;>;" },
{ "getDeclaredConstructors", NULL, "[Ljava.lang.reflect.Constructor;", 0x1,
"Ljava.lang.SecurityException;", NULL },
{ "getDeclaredField:", "getDeclaredField", "Ljava.lang.reflect.Field;", 0x1,
"Ljava.lang.NoSuchFieldException;Ljava.lang.SecurityException;", NULL },
{ "getDeclaredFields", NULL, "[Ljava.lang.reflect.Field;", 0x1,
"Ljava.lang.SecurityException;", NULL },
{ "getDeclaredMethod:parameterTypes:", "getDeclaredMethod", "Ljava.lang.reflect.Method;", 0x81,
"Ljava.lang.NoSuchMethodException;Ljava.lang.SecurityException;", NULL },
{ "getDeclaredMethods", NULL, "[Ljava.lang.reflect.Method;", 0x1,
"Ljava.lang.SecurityException;", NULL },
{ "getDeclaringClass", NULL, "Ljava.lang.Class;", 0x1, NULL, "()Ljava/lang/Class<*>;" },
{ "getEnclosingClass", NULL, "Ljava.lang.Class;", 0x1, NULL, "()Ljava/lang/Class<*>;" },
{ "getEnclosingConstructor", NULL, "Ljava.lang.reflect.Constructor;", 0x1, NULL,
"()Ljava/lang/reflect/Constructor<*>;" },
{ "getEnclosingMethod", NULL, "Ljava.lang.reflect.Method;", 0x1, NULL, NULL },
{ "getEnumConstants", NULL, "[Ljava.lang.Object;", 0x1, NULL, NULL },
{ "getField:", "getField", "Ljava.lang.reflect.Field;", 0x1,
"Ljava.lang.NoSuchFieldException;Ljava.lang.SecurityException;", NULL },
{ "getFields", NULL, "[Ljava.lang.reflect.Field;", 0x1, "Ljava.lang.SecurityException;", NULL },
{ "getGenericInterfaces", NULL, "[Ljava.lang.reflect.Type;", 0x1, NULL, NULL },
{ "getGenericSuperclass", NULL, "Ljava.lang.reflect.Type;", 0x1, NULL, NULL },
{ "getInterfaces", NULL, "[Ljava.lang.Class;", 0x1, NULL, NULL },
{ "getMethod:parameterTypes:", "getMethod", "Ljava.lang.reflect.Method;", 0x81,
"Ljava.lang.NoSuchMethodException;Ljava.lang.SecurityException;", NULL },
{ "getMethods", NULL, "[Ljava.lang.reflect.Method;", 0x1, "Ljava.lang.SecurityException;",
NULL },
{ "getModifiers", NULL, "I", 0x1, NULL, NULL },
{ "getName", NULL, "Ljava.lang.String;", 0x1, NULL, NULL },
{ "getPackage", NULL, "Ljava.lang.Package;", 0x1, NULL, NULL },
{ "getProtectionDomain", NULL, "Ljava.security.ProtectionDomain;", 0x1, NULL, NULL },
{ "getResource:", "getResource", "Ljava.net.URL;", 0x1, NULL, NULL },
{ "getResourceAsStream:", "getResourceAsStream", "Ljava.io.InputStream;", 0x1, NULL, NULL },
{ "getSigners", NULL, "[Ljava.lang.Object;", 0x1, NULL, NULL },
{ "getSimpleName", NULL, "Ljava.lang.String;", 0x1, NULL, NULL },
{ "getSuperclass", NULL, "Ljava.lang.Class;", 0x1, NULL, "()Ljava/lang/Class<-TT;>;" },
{ "getTypeParameters", NULL, "[Ljava.lang.reflect.TypeVariable;", 0x1, NULL, NULL },
{ "isAnnotation", NULL, "Z", 0x1, NULL, NULL },
{ "isAnnotationPresentWithIOSClass:", "isAnnotationPresent", "Z", 0x1, NULL,
"(Ljava/lang/Class<+Ljava/lang/annotation/Annotation;>;)Z" },
{ "isAnonymousClass", NULL, "Z", 0x1, NULL, NULL },
{ "isArray", NULL, "Z", 0x1, NULL, NULL },
{ "isAssignableFrom:", "isAssignableFrom", "Z", 0x1, NULL, "(Ljava/lang/Class<*>;)Z" },
{ "isEnum", NULL, "Z", 0x1, NULL, NULL },
{ "isInstance:", "isInstance", "Z", 0x1, NULL, NULL },
{ "isInterface", NULL, "Z", 0x1, NULL, NULL },
{ "isLocalClass", NULL, "Z", 0x1, NULL, NULL },
{ "isMemberClass", NULL, "Z", 0x1, NULL, NULL },
{ "isPrimitive", NULL, "Z", 0x1, NULL, NULL },
{ "isSynthetic", NULL, "Z", 0x1, NULL, NULL },
{ "newInstance", NULL, "TT;", 0x1,
"Ljava.lang.InstantiationException;Ljava.lang.IllegalAccessException;", "()TT;" },
{ "description", "toString", "Ljava.lang.String;", 0x1, NULL, NULL },
{ "init", NULL, NULL, 0x1, NULL, NULL },
};
static J2ObjcClassInfo _IOSClass = {
1, "Class", "java.lang", NULL, 0x11, 10, methods, 1, fields, 0, NULL
static const J2ObjcFieldInfo fields[] = {
{ "serialVersionUID", "serialVersionUID", 0x1a, "J", NULL, NULL,
.constantValue.asLong = IOSClass_serialVersionUID },
};
static const J2ObjcClassInfo _IOSClass = {
2, "Class", "java.lang", NULL, 0x11, 58, methods, 1, fields, 0, NULL, 0, NULL, NULL,
"<T:Ljava/lang/Object;>Ljava/lang/Object;Ljava/lang/reflect/AnnotatedElement;"
"Ljava/lang/reflect/GenericDeclaration;Ljava/io/Serializable;Ljava/lang/reflect/Type;" };
return &_IOSClass;
}

Expand Down
2 changes: 1 addition & 1 deletion jre_emul/Classes/JavaMetadata.m
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ - (IOSObjectArray *)exceptionTypes {
}

- (jboolean)isConstructor {
const char *name = data_->javaName ? data_->javaName : data_->selector;
const char *name = data_->selector;
return strcmp(name, "init") == 0 || strstr(name, "initWith") == name;
}

Expand Down
3 changes: 1 addition & 2 deletions jre_emul/Classes/NSCopying+JavaCloneable.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ @implementation NSCopying

+ (const J2ObjcClassInfo *)__metadata {
static const J2ObjcClassInfo _NSCopying = {
1, "Cloneable", "java.lang", NULL, 0x201, 0, NULL, 0, NULL, 0, NULL
};
2, "Cloneable", "java.lang", NULL, 0x609, 0, NULL, 0, NULL, 0, NULL, 0, NULL, NULL, NULL };
return &_NSCopying;
}

Expand Down
28 changes: 14 additions & 14 deletions jre_emul/Classes/NSNumber+JavaNumber.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,23 @@

@implementation NSNumber (JavaNumber)

+ (J2ObjcClassInfo *)__metadata {
static J2ObjcMethodInfo methods[] = {
{ "charValue", "byteValue", "B", 0x1, NULL },
{ "doubleValue", NULL, "D", 0x401, NULL },
{ "floatValue", NULL, "F", 0x401, NULL },
{ "intValue", NULL, "I", 0x401, NULL },
{ "longLongValue", "longValue", "J", 0x401, NULL },
{ "shortValue", NULL, "S", 0x401, NULL },
+ (const J2ObjcClassInfo *)__metadata {
static const J2ObjcMethodInfo methods[] = {
{ "init", "Number", NULL, 0x1, NULL, NULL },
{ "charValue", "byteValue", "B", 0x1, NULL, NULL },
{ "doubleValue", NULL, "D", 0x401, NULL, NULL },
{ "floatValue", NULL, "F", 0x401, NULL, NULL },
{ "intValue", NULL, "I", 0x401, NULL, NULL },
{ "longLongValue", "longValue", "J", 0x401, NULL, NULL },
{ "shortValue", NULL, "S", 0x1, NULL, NULL },
};
static J2ObjcFieldInfo fields[] = {
{ "serialVersionUID_", NULL, 0x1a, "J", NULL,
static const J2ObjcFieldInfo fields[] = {
{ "serialVersionUID", "serialVersionUID", 0x1a, "J", NULL, NULL,
.constantValue.asLong = JavaLangNumber_serialVersionUID },
};
static J2ObjcClassInfo _JavaLangNumber = {
1, "Number", "java.lang", NULL, 0x401, 6, methods, 1, fields, 0, NULL
};
return &_JavaLangNumber;
static const J2ObjcClassInfo _NSNumber = {
2, "Number", "java.lang", NULL, 0x401, 7, methods, 1, fields, 0, NULL, 0, NULL, NULL, NULL };
return &_NSNumber;
}

@end
Expand Down
31 changes: 16 additions & 15 deletions jre_emul/Classes/NSObject+JavaObject.m
Original file line number Diff line number Diff line change
Expand Up @@ -163,22 +163,23 @@ - (void)waitWithLong:(long long)timeout withInt:(int)nanos {
- (void)__javaClone:(id)original {
}

+ (J2ObjcClassInfo *)__metadata {
static J2ObjcMethodInfo methods[] = {
{ "getClass", NULL, "LIOSClass;", 0x11, NULL },
{ "isEqual:", "equals", "Z", 0x1, NULL },
{ "clone", NULL, "Ljava.lang.Object;", 0x4, "Ljava.lang.CloneNotSupportedException;" },
{ "dealloc", "finalize", "V", 0x4, "Ljava.lang.Throwable;" },
{ "notify", NULL, "V", 0x11, NULL },
{ "notifyAll", NULL, "V", 0x11, NULL },
{ "waitWithLong:", "wait", "V", 0x11, "Ljava.lang.InterruptedException;" },
{ "waitWithLong:withInt:", "wait", "V", 0x11, "Ljava.lang.InterruptedException;" },
{ "wait", NULL, "V", 0x11, "Ljava.lang.InterruptedException;" },
{ "description", "toString", "Ljava.lang.String;", 0x1, NULL },
{ "hash", "hashCode", "I", 0x1, NULL },
+ (const J2ObjcClassInfo *)__metadata {
static const J2ObjcMethodInfo methods[] = {
{ "init", "Object", NULL, 0x1, NULL, NULL },
{ "getClass", NULL, "Ljava.lang.Class;", 0x11, NULL, "()Ljava/lang/Class<*>;" },
{ "hash", "hashCode", "I", 0x1, NULL, NULL },
{ "isEqual:", "equals", "Z", 0x1, NULL, NULL },
{ "clone", NULL, "Ljava.lang.Object;", 0x4, "Ljava.lang.CloneNotSupportedException;", NULL },
{ "description", "toString", "Ljava.lang.String;", 0x1, NULL, NULL },
{ "dealloc", "finalize", "V", 0x4, "Ljava.lang.Throwable;", NULL },
{ "notify", NULL, "V", 0x11, NULL, NULL },
{ "notifyAll", NULL, "V", 0x11, NULL, NULL },
{ "waitWithLong:", "wait", "V", 0x11, "Ljava.lang.InterruptedException;", NULL },
{ "waitWithLong:withInt:", "wait", "V", 0x11, "Ljava.lang.InterruptedException;", NULL },
{ "wait", NULL, "V", 0x11, "Ljava.lang.InterruptedException;", NULL },
};
static J2ObjcClassInfo _JavaLangObject = {
1, "Object", "java.lang", NULL, 0x1, 11, methods, 0, NULL, 0, NULL
static const J2ObjcClassInfo _JavaLangObject = {
2, "Object", "java.lang", NULL, 0x1, 12, methods, 0, NULL, 0, NULL, 0, NULL, NULL, NULL
};
return &_JavaLangObject;
}
Expand Down
Loading

0 comments on commit 3349a91

Please sign in to comment.