1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-15 13:51:40 +00:00

Improve android java support

- Use Log.d/Log.w instead of System.printf
- Remove commented code
- Cherry-pick: Manual backport of d698814367
This commit is contained in:
Xavier Sellier
2018-02-22 00:38:04 -05:00
parent 0af3f8e053
commit 88e779cd5e
25 changed files with 127 additions and 433 deletions

View File

@@ -553,7 +553,6 @@ bool JavaClassWrapper::_get_type_sig(JNIEnv *env, jobject obj, uint32_t &sig, St
jstring name2 = (jstring)env->CallObjectMethod(obj, Class_getName);
String str_type = env->GetStringUTFChars(name2, NULL);
print_line("name: " + str_type);
env->DeleteLocalRef(name2);
uint32_t t = 0;
@@ -1116,7 +1115,7 @@ Ref<JavaClass> JavaClassWrapper::wrap(const String &p_class) {
}
if (!valid) {
print_line("Method Can't be bound (unsupported arguments): " + p_class + "::" + str_method);
print_line("Method can't be bound (unsupported arguments): " + p_class + "::" + str_method);
env->DeleteLocalRef(obj);
env->DeleteLocalRef(param_types);
continue;
@@ -1129,7 +1128,7 @@ Ref<JavaClass> JavaClassWrapper::wrap(const String &p_class) {
String strsig;
uint32_t sig = 0;
if (!_get_type_sig(env, return_type, sig, strsig)) {
print_line("Method Can't be bound (unsupported return type): " + p_class + "::" + str_method);
print_line("Method can't be bound (unsupported return type): " + p_class + "::" + str_method);
env->DeleteLocalRef(obj);
env->DeleteLocalRef(param_types);
env->DeleteLocalRef(return_type);
@@ -1139,8 +1138,6 @@ Ref<JavaClass> JavaClassWrapper::wrap(const String &p_class) {
signature += strsig;
mi.return_type = sig;
print_line("METHOD: " + str_method + " SIG: " + signature + " static: " + itos(mi._static));
bool discard = false;
for (List<JavaClass::MethodInfo>::Element *E = java_class->methods[str_method].front(); E; E = E->next()) {
@@ -1172,11 +1169,9 @@ Ref<JavaClass> JavaClassWrapper::wrap(const String &p_class) {
if (new_likeliness > existing_likeliness) {
java_class->methods[str_method].erase(E);
print_line("replace old");
break;
} else {
discard = true;
print_line("old is better");
}
}
@@ -1194,9 +1189,6 @@ Ref<JavaClass> JavaClassWrapper::wrap(const String &p_class) {
env->DeleteLocalRef(obj);
env->DeleteLocalRef(param_types);
env->DeleteLocalRef(return_type);
//args[i] = _jobject_to_variant(env, obj);
// print_line("\targ"+itos(i)+": "+Variant::get_type_name(args[i].get_type()));
};
env->DeleteLocalRef(methods);
@@ -1213,7 +1205,7 @@ Ref<JavaClass> JavaClassWrapper::wrap(const String &p_class) {
jstring name = (jstring)env->CallObjectMethod(obj, Field_getName);
String str_field = env->GetStringUTFChars(name, NULL);
env->DeleteLocalRef(name);
print_line("FIELD: " + str_field);
int mods = env->CallIntMethod(obj, Field_getModifiers);
if ((mods & 0x8) && (mods & 0x10) && (mods & 0x1)) { //static final public!