Browse Source

Added kindlich's name fix

Jared 5 years ago
parent
commit
cbf1ac90e6
No account linked to committer's email address

+ 10
- 7
JavaIntegration/src/main/java/org/openzen/zencode/java/JavaNativeModule.java View File

@@ -256,13 +256,15 @@ public class JavaNativeModule {
256 256
 			throw new IllegalArgumentException("Class \" " + cls.getName() + "\" must be public");
257 257
 		
258 258
 		String className = cls.getName();
259
-		boolean isStruct = cls.getAnnotation(ZenCodeType.Struct.class) != null;
260
-		
261
-		ZSPackage classPkg = getPackage(className);
262
-		ZenCodeType.Name name = cls.getDeclaredAnnotation(ZenCodeType.Name.class);
259
+        boolean isStruct = cls.isAnnotationPresent(ZenCodeType.Struct.class);
260
+        
261
+        ZSPackage classPkg;
262
+        ZenCodeType.Name nameAnnotation = cls.getDeclaredAnnotation(ZenCodeType.Name.class);
263 263
 		className = className.contains(".") ? className.substring(className.lastIndexOf('.') + 1) : className;
264
-		if (name != null) {
265
-			String specifiedName = name.value();
264
+        if (nameAnnotation == null) {
265
+            classPkg = getPackage(className);
266
+        } else {
267
+            String specifiedName = nameAnnotation.value();
266 268
 			if (specifiedName.startsWith(".")) {
267 269
 				classPkg = getPackage(specifiedName);
268 270
 				className = className.substring(className.lastIndexOf('.') + 1);
@@ -273,7 +275,8 @@ public class JavaNativeModule {
273 275
 				classPkg = getPackage(basePackage + specifiedName.substring(pkg.fullName.length()));
274 276
 				className = className.substring(className.lastIndexOf('.') + 1);
275 277
 			} else {
276
-				className = name.value();
278
+                classPkg = getPackage(className);
279
+                className = nameAnnotation.value();
277 280
 			}
278 281
 		}
279 282
 		

Loading…
Cancel
Save