Browse Source

Fixed Module using class name instead of annotation name

kindlich 5 years ago
parent
commit
2e09623f39
No known key found for this signature in database

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

262
             String specifiedName = nameAnnotation.value();
262
             String specifiedName = nameAnnotation.value();
263
 			if (specifiedName.startsWith(".")) {
263
 			if (specifiedName.startsWith(".")) {
264
 				classPkg = getPackage(specifiedName);
264
 				classPkg = getPackage(specifiedName);
265
-				className = className.substring(className.lastIndexOf('.') + 1);
265
+				className = specifiedName.substring(specifiedName.lastIndexOf('.') + 1);
266
 			} else if (specifiedName.indexOf('.') >= 0) {
266
 			} else if (specifiedName.indexOf('.') >= 0) {
267
 				if (!specifiedName.startsWith(pkg.fullName))
267
 				if (!specifiedName.startsWith(pkg.fullName))
268
 					throw new IllegalArgumentException("Specified @Name as \"" + specifiedName + "\" for class: \"" + cls.toString() + "\" but it's not in the module root package");
268
 					throw new IllegalArgumentException("Specified @Name as \"" + specifiedName + "\" for class: \"" + cls.toString() + "\" but it's not in the module root package");
269
 
269
 
270
 				classPkg = getPackage(basePackage + specifiedName.substring(pkg.fullName.length()));
270
 				classPkg = getPackage(basePackage + specifiedName.substring(pkg.fullName.length()));
271
-				className = className.substring(className.lastIndexOf('.') + 1);
271
+				className = specifiedName.substring(specifiedName.lastIndexOf('.') + 1);
272
 			} else {
272
 			} else {
273
-                classPkg = getPackage(className);
273
+                classPkg = getPackage(specifiedName);
274
                 className = nameAnnotation.value();
274
                 className = nameAnnotation.value();
275
 			}
275
 			}
276
 		}
276
 		}

Loading…
Cancel
Save