summaryrefslogtreecommitdiff
path: root/compiler/src/main/java/android/databinding/tool/reflection
diff options
context:
space:
mode:
authorYigit Boyar <yboyar@google.com>2017-12-21 10:00:25 -0800
committerYigit Boyar <yboyar@google.com>2018-05-18 22:25:47 +0000
commit744db5c5a111d68c30302deae8b4ba1ea9355603 (patch)
treed77df39f15fa9cfffb37ccdf8f1b3fc1471db120 /compiler/src/main/java/android/databinding/tool/reflection
parent24c7c961ba1eb09dccab240bcd18fd71df09a7dc (diff)
downloaddata-binding-744db5c5a111d68c30302deae8b4ba1ea9355603.tar.gz
Fix kotlin.Unit method references in binding layouts.
When there is a binding adapter that receives a kotlin function which does not return, Kotlin converts it to Function0<kotlin.Unit>. But if there is a kotlin class with a method that does not return value, kotlin converts it to void. This becomes a problem for data binding because it cannot match the two when using function references. We cannot simply convert kotlin.Unit to void because we still generate code in java so we have to return a value in the implementation. Instead, this CL changes function matcher to accept the two as equals and also changes the code generators to handle the case manually. Also added a kotlin test app (finally). Bug: 70915745 Bug: 78662035 Test: KotlinTestApp Change-Id: I019ee7eb1dd635b12efd7725ccc22f0c63dc2d72
Diffstat (limited to 'compiler/src/main/java/android/databinding/tool/reflection')
-rw-r--r--compiler/src/main/java/android/databinding/tool/reflection/ModelClass.java4
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/src/main/java/android/databinding/tool/reflection/ModelClass.java b/compiler/src/main/java/android/databinding/tool/reflection/ModelClass.java
index 10218782..557ad25a 100644
--- a/compiler/src/main/java/android/databinding/tool/reflection/ModelClass.java
+++ b/compiler/src/main/java/android/databinding/tool/reflection/ModelClass.java
@@ -698,4 +698,8 @@ public abstract class ModelClass {
}
return false;
}
+
+ public boolean isKotlinUnit() {
+ return "kotlin.Unit".equals(getTypeName().toString());
+ }
}