-
Notifications
You must be signed in to change notification settings - Fork 728
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Blacklist setLifecycleOwner method in databinding field parsing, fixes #412 #418
Conversation
setMainThreadExecutor(UiThreadExecutor) | ||
setBackgroundThreadExecutor(AsyncTask.THREAD_POOL_EXECUTOR) | ||
setNotifyExecutor(UiThreadExecutor) | ||
setFetchExecutor(AsyncTask.THREAD_POOL_EXECUTOR) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These methods were renamed, see https://developer.android.com/topic/libraries/architecture/release-notes.html#paging.
val dataBindingClassElement: Element? | ||
get() = getElementByName(dataBindingClassName, elementUtils, typeUtils) | ||
private val dataBindingClassElement: TypeElement? | ||
get() = getElementByName(dataBindingClassName, elementUtils, typeUtils) as TypeElement? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be as? TypeElement
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@elihart I'm thinking: if getElementByName
doesn't return a TypeElement
or null
then something unexpected is happening since we're passing it a ClassName
. In fact maybe it would make more sense to change the return type of getElementByName(ClassName name, Elements elements, Types types)
. Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the return type to TypeElement
and everything still builds and all tests are passing so seems reasonable.
…#412 ViewDataBinding subclasses can now override the setLifecycleOwner method causing it to be erroneously detected as a model property.
d0b0dc5
to
c8c51ff
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! thanks
ViewDataBinding subclasses can now override the setLifecycleOwner method causing it to be erroneously detected as a model field. This fix introduces a field blacklist to ignore this method and possibly others in the future.
To reproduce the issue and create a test for it I had to update the Android plugin version which forced me to also update Gradle, the target SDK, and the paging library. I removed the buildToolsVersion declarations to remove a warning (the build tools version is now provided by the Android plugin from what I understand).