Fixed
Status Update
Comments
[Deleted User] <[Deleted User]> #2
I should probably elaborate on that a bit more here :P. The ideal case would be that data classes written in other modules work the same when consumed. A standard data class (no secondary constructors, `val` properties) works fine when in the same module. The errors produced are also pretty confusing. They'll usually give what they read from the bytecode (constructor params called "var0" or the like) and reports missing setters for fields without names of said fields.
se...@google.com <se...@google.com> #3
I can confirm the bug and the workaround. The same problem arises when you use a data-class from a library with @Embedded
[Deleted User] <[Deleted User]> #5
given that log, looks like kotlin again not generating proper parameter names for methods.
se...@google.com <se...@google.com> #6
so turns out this is not about kotlin.
does not work w/ javac either because parameter names are not part of the class signature unless compiled w/ debug.
We will need to add a new annotation to support this.
does not work w/ javac either because parameter names are not part of the class signature unless compiled w/ debug.
We will need to add a new annotation to support this.
[Deleted User] <[Deleted User]> #7
True on the javac bit, but for kotlin you should be able to read the parameter names from the `@Metadata` annotations (since the param names are part of the public API in kotlin). There's no public API around this today though admittedly :/
se...@google.com <se...@google.com> #8
actually i have a CL that makes this work for java as well but may not work for release builds (didn't try)
but it is shady, uses private APi and someday will break.
on the other hand, kotlin version seems to make sense, I'll ask kotlin folks to see if they have any plans to open it up.
but it is shady, uses private APi and someday will break.
on the other hand, kotlin version seems to make sense, I'll ask kotlin folks to see if they have any plans to open it up.
Description
Version used: 1.0.0-alpha7
Devices/Android versions reproduced on: Nexus 6 (7.0 NBD92D), Emulator Nexus 4 API 25, and possibly any device
- Situation / Use case
App is using LiveData for network calls.
Activity queries the network observing on a newly created LiveData for that call
There is a background data processing that uses `observeForever` and `removeObserver` to observe ALL network calls generated by any activity.
Once called `removeObserver` from this background data processing the activity currently in foreground (resumed) does not receive the callback.
- Attached is a minimum example of it.
In the example:
The Application instantiates a BackgroundDataProcessing (that calls observeForever/removeObserver) that creates a list of the data and a BackgroundDataObserver that observes to the list of data and logs it.
The MainActivity queries the network LiveData that returns a result 1.5 seconds later. As a piece of automation to demo the bug, the MainActivity will start a new MainActivity in 3 seconds.
The BackgroundDataObserver always receives the value updates and the MainActivity never receives it. If comment out the line `source.removeObserver(this);` on the `BackgroundDataProcessing`, the MainActivity starts receiving those events (but we'll also be leaking memory)
I hope it helps.