소스 검색

Added better logging in JavaNativeModule

Jared 5 년 전
부모
커밋
191edd6cae
No account linked to committer's email address
1개의 변경된 파일5개의 추가작업 그리고 5개의 파일을 삭제
  1. 5
    5
      JavaIntegration/src/main/java/org/openzen/zencode/java/JavaNativeModule.java

+ 5
- 5
JavaIntegration/src/main/java/org/openzen/zencode/java/JavaNativeModule.java 파일 보기

@@ -214,7 +214,7 @@ public class JavaNativeModule {
214 214
 	
215 215
 	public FunctionalMemberRef loadStaticMethod(Method method) {
216 216
 		if (!isStatic(method.getModifiers()))
217
-			throw new IllegalArgumentException("Method is not static");
217
+			throw new IllegalArgumentException("Method \"" + method.toString() + "\" is not static");
218 218
 		
219 219
 		HighLevelDefinition definition = addClass(method.getDeclaringClass());
220 220
 		JavaClass jcls = JavaClass.fromInternalName(getInternalName(method.getDeclaringClass()), JavaClass.Kind.CLASS);
@@ -241,7 +241,7 @@ public class JavaNativeModule {
241 241
 		else if (className.startsWith(basePackage + "."))
242 242
 			className = className.substring(basePackage.length() + 1);
243 243
 		else
244
-			throw new IllegalArgumentException("Invalid class name: not in the given base package");
244
+            throw new IllegalArgumentException("Invalid class name: \"" + className + "\" not in the given base package: \"" + basePackage + "\"");
245 245
 		
246 246
 		String[] classNameParts = Strings.split(className, '.');
247 247
 		ZSPackage classPkg = pkg;
@@ -253,7 +253,7 @@ public class JavaNativeModule {
253 253
 	
254 254
 	private <T> HighLevelDefinition convertClass(Class<T> cls) {
255 255
 		if ((cls.getModifiers() & Modifier.PUBLIC) == 0)
256
-			throw new IllegalArgumentException("Class must be public");
256
+			throw new IllegalArgumentException("Class \" " + cls.getName() + "\" must be public");
257 257
 		
258 258
 		String className = cls.getName();
259 259
 		boolean isStruct = cls.getAnnotation(ZenCodeType.Struct.class) != null;
@@ -461,7 +461,7 @@ public class JavaNativeModule {
461 461
 	private OperatorMember asOperator(TypeVariableContext context, HighLevelDefinition definition, Method method, ZenCodeType.Operator annotation) {
462 462
 		FunctionHeader header = getHeader(context, method);
463 463
 		if (isStatic(method.getModifiers()))
464
-			throw new IllegalArgumentException("operator method cannot be static");
464
+			throw new IllegalArgumentException("operator method \"" + method.toString() + "\"cannot be static");
465 465
 		
466 466
 		// TODO: check number of parameters
467 467
 		//if (header.parameters.length != annotation.value().parameters)
@@ -488,7 +488,7 @@ public class JavaNativeModule {
488 488
 	
489 489
 	private SetterMember asSetter(TypeVariableContext context, HighLevelDefinition definition, Method method, ZenCodeType.Setter annotation) {
490 490
 		if (method.getParameterCount() != 1)
491
-			throw new IllegalArgumentException("Illegal setter: must have exactly 1 parameter");
491
+			throw new IllegalArgumentException("Illegal setter: \"" + method.toString() + "\"must have exactly 1 parameter");
492 492
 		
493 493
 		StoredType type = loadStoredType(context, method.getAnnotatedParameterTypes()[0]);
494 494
 		String name = null;

Loading…
취소
저장