History log of /frameworks/data-binding/compiler/src/main/java/android/databinding/tool/expr/LambdaExpr.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
bb4a033fcd5cd20e5be46ef8ead442dc7db2454d 18-Feb-2016 George Mount <mount@google.com> Have two-way binding use localized variables to prevent NPE.

Bug 26962999

Two-way binding was using the inverted expressions directly
without localizing variables. That meant that if there was
a variable set to null during evaluation, it may get a
NullPointerException even though it checked for null
on the value previously. This CL localizes the variables
so that cannot happen.

Change-Id: Ia55955ce0f1cb750e6a678e72e0cda03f0e3c9b6
/frameworks/data-binding/compiler/src/main/java/android/databinding/tool/expr/LambdaExpr.java
6047998943beebd81e0ae1068df39c0cbee38628 02-Feb-2016 Yigit Boyar <yboyar@google.com> Lambda In da house

This CL adds support for assigning callbacks to listeners using lambda expressions.
These expressions can receive either 0 or N arguments where N is equal to the
number of parameters in the callback function.

These expressions are evaluated when the callback is invoked. In other words, they
are independent from the rest of the ExprModel except the Identifier expressions.

Since these are limited to 1 full expression and they don't have any invalidation
flags; we use a verbose branching code generation mode where we calculate all possible
execution paths, eliminate trivial ones and generate the code. This allows callbacks
to be thread safe as well. See ExecutionPath class for details.
It is not efficient but since these are rere occasions, should be OK.

Callback expressions are still forced to be expressions that return value. To handle
`void` case, I've added `void` and `Void` as acceptable symbols. Also, if the callback
method returns void, the expression is free to return `void` or any other value.
¯\\_(ツ)_/¯

I've also moved kotlin to rc0. Although rc0 is unrelated to this task, it made more
sense to upgrade here because most changes it will ask for were already done in
this branch.

Bug: 26849440
Change-Id: I805b3d470f85df9c2ce3f3ed5ca74925a08bb7a5
/frameworks/data-binding/compiler/src/main/java/android/databinding/tool/expr/LambdaExpr.java