|
@@ -260,27 +260,30 @@ public class JavaNativeModule {
|
260
|
260
|
throw new IllegalArgumentException("Class must be public");
|
261
|
261
|
|
262
|
262
|
String className = cls.getName();
|
263
|
|
- boolean isStruct = cls.getAnnotation(ZenCodeType.Struct.class) != null;
|
|
263
|
+ boolean isStruct = cls.isAnnotationPresent(ZenCodeType.Struct.class);
|
264
|
264
|
|
265
|
|
- ZSPackage classPkg = getPackage(className);
|
266
|
|
- ZenCodeType.Name name = cls.getDeclaredAnnotation(ZenCodeType.Name.class);
|
|
265
|
+ ZSPackage classPkg;
|
|
266
|
+ ZenCodeType.Name nameAnnotation = cls.getDeclaredAnnotation(ZenCodeType.Name.class);
|
267
|
267
|
className = className.contains(".") ? className.substring(className.lastIndexOf('.') + 1) : className;
|
268
|
|
- if (name != null) {
|
269
|
|
- String specifiedName = name.value();
|
|
268
|
+ if (nameAnnotation == null) {
|
|
269
|
+ classPkg = getPackage(className);
|
|
270
|
+ } else {
|
|
271
|
+ String specifiedName = nameAnnotation.value();
|
270
|
272
|
if (specifiedName.startsWith(".")) {
|
271
|
273
|
classPkg = getPackage(specifiedName);
|
272
|
274
|
className = className.substring(className.lastIndexOf('.') + 1);
|
273
|
275
|
} else if (specifiedName.indexOf('.') >= 0) {
|
274
|
276
|
if (!specifiedName.startsWith(pkg.fullName))
|
275
|
277
|
throw new IllegalArgumentException("Specified @Name as " + specifiedName + " but it's not in the module root package");
|
276
|
|
-
|
|
278
|
+
|
277
|
279
|
classPkg = getPackage(basePackage + specifiedName.substring(pkg.fullName.length()));
|
278
|
280
|
className = className.substring(className.lastIndexOf('.') + 1);
|
279
|
281
|
} else {
|
280
|
|
- className = name.value();
|
|
282
|
+ classPkg = getPackage(className);
|
|
283
|
+ className = nameAnnotation.value();
|
281
|
284
|
}
|
282
|
285
|
}
|
283
|
|
-
|
|
286
|
+
|
284
|
287
|
TypeVariableContext context = new TypeVariableContext();
|
285
|
288
|
TypeVariable<Class<T>>[] javaTypeParameters = cls.getTypeParameters();
|
286
|
289
|
TypeParameter[] typeParameters = new TypeParameter[cls.getTypeParameters().length];
|