History log of /frameworks/data-binding/compiler/src/main/java/android/databinding/tool/expr/FieldAccessExpr.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
c0c1dab0b6254e4d27f18c37a72a9e7952e958a0 02-Mar-2016 George Mount <mount@google.com> Support for java 8 method reference syntax.

Bug 26937350

Our event handling syntax is obj.method, where java 8
uses the syntax obj::method. This adds support for
the java 8 syntax and adds a deprecation warning for
the old syntax.

Change-Id: Ideb0570c2646f674da031f642ed3369e8c5fcd3b
/frameworks/data-binding/compiler/src/main/java/android/databinding/tool/expr/FieldAccessExpr.java
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/FieldAccessExpr.java
09f8e10e2a49a075da8bb2f64853377c5e37045a 17-Feb-2016 Yigit Boyar <yboyar@google.com> Allow ObservableFields to be Bindable.

This CL fixes a bug where if a field/accessor is Observable and
Bindable, it would not be assigned a BR id, resulting in
malformed generated code.

Bug: 26922185
Change-Id: Ia3d11204460fc1967f0a7b60ed7cba1d3698098d
/frameworks/data-binding/compiler/src/main/java/android/databinding/tool/expr/FieldAccessExpr.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/FieldAccessExpr.java
d3f2b9229472c9dae9bf4ae8b3e2d653b5653b01 17-Sep-2015 George Mount <mount@google.com> Two-way binding

Bug 1474349
Bug 22460238

This adds two-way data binding for those attributes
on Views that also have event listeners for them.
General use is also supported, but event listeners
are required to notify when those properties change.

Change-Id: Iedc66a604257930265f9d661f69658a0a0c3208b
/frameworks/data-binding/compiler/src/main/java/android/databinding/tool/expr/FieldAccessExpr.java
88ce44ccc65e74a8553244ca246cc9f4c48483e0 15-Oct-2015 Yigit Boyar <yboyar@google.com> Create BR id from Callable

This CL fixes a bug where if an expression maps into a method
with a different name, we would create the BR id from the
expression instead of the referenced method.

Bug: 24973950
Change-Id: Ia57c31d926a737c9fc84775780aeb5e617769d43
/frameworks/data-binding/compiler/src/main/java/android/databinding/tool/expr/FieldAccessExpr.java
793e979f25e190162eacf46d6a4efc3efc1d2f91 31-Jul-2015 George Mount <mount@google.com> Support different event handlers having different API levels.

Bug 22957226

Change-Id: Ia08bcb857872eccad3340c14b8d10b78198b90a6
/frameworks/data-binding/compiler/src/main/java/android/databinding/tool/expr/FieldAccessExpr.java
e52882df6130221462bf07f5f2b52de5c4b0f8de 30-Jul-2015 George Mount <mount@google.com> Move toCode to Expr classes.

It turns out that toCode as part of Java is just
about as readable as in kotlin and it makes much
more sense than using instanceof (equivalent).

Change-Id: Ic2a0de5c4376dafa487d048e6a9420fab9e7f22a
/frameworks/data-binding/compiler/src/main/java/android/databinding/tool/expr/FieldAccessExpr.java
731b74f7f44e67312a1fc4161c4e0aae221b2417 25-Jun-2015 Yigit Boyar <yboyar@google.com> Introduce Scopes to track logical stack traces

This CL introduces a static class called Scope, which is
used the logical processing stack for data binding.
These scopes are used to generate meaningful error messages
when an error is detected.

Bug: 21953001
Change-Id: I5470a8c4ad94401d34a140762baae9d53c5a0402
/frameworks/data-binding/compiler/src/main/java/android/databinding/tool/expr/FieldAccessExpr.java
2611838bffef5a009ca71e3e9e59a93f29b098ed 24-Jun-2015 Yigit Boyar <yboyar@google.com> Remove guava from compiler

This CL removes all dependency from guava and replaces it w/ either plain
java or some utilities.

Bug: 22047836
Change-Id: I94be54ed992ab6b5f27c47a8cf400ae60aef02f8
/frameworks/data-binding/compiler/src/main/java/android/databinding/tool/expr/FieldAccessExpr.java
716ba89e7f459f49ea85070d4710c1d79d715298 18-Jun-2015 George Mount <mount@google.com> Support calling listener methods without interfaces.

Bug 21594573

It is convenient to be able to assign event listeners by just
referencing a method, similar to the way onClick="handler" works.

This adds a whole lot of listeners for the framework. Additional
listeners must be added for support library components.

This isn't perfect in resolving listeners. Perfect resolution
requires that each expression is evaluated in its own context
within the binding statement. If, for example, the same method
name is used for a listener and an accessor, we will assume
that the listener is used always and there will be a compilation
failure.

Change-Id: If4705122b67a451430451b6e7d890eb813af1c5c
/frameworks/data-binding/compiler/src/main/java/android/databinding/tool/expr/FieldAccessExpr.java
ec2f3896c21a504b464bf591cdb45b62692b6760 10-Jun-2015 Yigit Boyar <yboyar@google.com> Improve static method / field handling

Previously, we would allow access to static fields via instance
variables but it would not work for methods. Moreover, the behavior
was not exactly the same with how java handles it. In java, the
instance can be null but our binding code would not evaluate it
if instance is null.

This CL fixes these bugs by adding static resolution support to
methods and replacing their variable identifiers with static
identifiers while the method is being resolved so that the rest
of the system is still consistent.

Bug: 20412284
Change-Id: Id97ce564c312b97d5a0e60d7d7a5bbd06b131071
/frameworks/data-binding/compiler/src/main/java/android/databinding/tool/expr/FieldAccessExpr.java
c4a07bddb4dd5c3bfbecf4d87909c5b447ae56dc 05-Jun-2015 George Mount <mount@google.com> Only create case statements for Bindable attributes.

Bug: 21571818
Change-Id: Id03c7a7de6e39d7f59da6cda11d3311f072addd0
/frameworks/data-binding/compiler/src/main/java/android/databinding/tool/expr/FieldAccessExpr.java
e9b33bac04bb1ce1444d7f1744fcec1ecd3a57da 30-Apr-2015 Yigit Boyar <yboyar@google.com> Support multi-param adapters in code generation

Bug: 19800022

Change-Id: I40c4ac72f24f965db12fd1c7dec6591184160ae5
/frameworks/data-binding/compiler/src/main/java/android/databinding/tool/expr/FieldAccessExpr.java
019c36b97c7c172ac03997f6bf170e65b2ed7fe4 17-Apr-2015 Yigit Boyar <yboyar@google.com> Fix how final fields are handled

There was a bug in Expression analyzer where if a field is final,
it would return dynamic=false although its parent is dynamic.

This CL changes that behavior such that if the parent of a field
access is dynamic, then field access is dynamic unless it is
static & final.
If parent is not dynamic, (e.g. android.view.View) field is
dynamic if an only if itself is dynamic.

This CL also fixes another bug where if you have a bunch of
expressions none of which can be invalidated, there would not
be any flags to set thus we would not generate proper if statements.
We were resolving tree properly but code-generation never worked
in that situation. To overcome this issue, since there should always
be a way to invalidate all bindings, I've added a flag to invalidate
all, which is automatically included in each invalidate flag set.
This does not bring any serious cost because we have flag inheritance
in the generated code.

I've also removed some code from LayoutBinderWriter that may create
duplicate names. This was failing a test where a variable and View
were given the same names. I changed these name uniqueness to be
scope based so that we can create most readable w/o sacrificing
correctness.

Bug: 20341011
Change-Id: I0e98a5e28f250c36ae5de306f5ed99adffd20b59
/frameworks/data-binding/compiler/src/main/java/android/databinding/tool/expr/FieldAccessExpr.java
fead9ca09b117136b35bc5bf137340a754f9eddd 23-Mar-2015 George Mount <mount@google.com> Move to package android.databinding.
/frameworks/data-binding/compiler/src/main/java/android/databinding/tool/expr/FieldAccessExpr.java