2
0
Эх сурвалжийг харах

Merge pull request #102494 from dsnopek/java-class-wrapper-error-non-static-methods

JavaClassWrapper: Give additional error when trying to call non-static method directly on the class
Rémi Verschelde 7 сар өмнө
parent
commit
e01ab79249

+ 3 - 0
platform/android/java_class_wrapper.cpp

@@ -156,6 +156,9 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method,
 	}
 
 	if (!method) {
+		if (r_error.error == Callable::CallError::CALL_ERROR_INSTANCE_IS_NULL) {
+			ERR_PRINT(vformat(R"(Cannot call static function "%s" on Java class "%s" directly. Make an instance instead.)", p_method, java_class_name));
+		}
 		return true; //no version convinces
 	}