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
 			throw new IllegalArgumentException("Class \" " + cls.getName() + "\" must be public");
256
 			throw new IllegalArgumentException("Class \" " + cls.getName() + "\" must be public");
257
 		
257
 		
258
 		String className = cls.getName();
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
 		className = className.contains(".") ? className.substring(className.lastIndexOf('.') + 1) : className;
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
 			if (specifiedName.startsWith(".")) {
268
 			if (specifiedName.startsWith(".")) {
267
 				classPkg = getPackage(specifiedName);
269
 				classPkg = getPackage(specifiedName);
268
 				className = className.substring(className.lastIndexOf('.') + 1);
270
 				className = className.substring(className.lastIndexOf('.') + 1);
273
 				classPkg = getPackage(basePackage + specifiedName.substring(pkg.fullName.length()));
275
 				classPkg = getPackage(basePackage + specifiedName.substring(pkg.fullName.length()));
274
 				className = className.substring(className.lastIndexOf('.') + 1);
276
 				className = className.substring(className.lastIndexOf('.') + 1);
275
 			} else {
277
 			} else {
276
-				className = name.value();
278
+                classPkg = getPackage(className);
279
+                className = nameAnnotation.value();
277
 			}
280
 			}
278
 		}
281
 		}
279
 		
282
 		

Loading…
Cancel
Save