Fixed
Status Update
Comments
bo...@gmail.com <bo...@gmail.com> #2
Correction: only the *child* class methods are called.
bo...@gmail.com <bo...@gmail.com> #3
Also: if I remove the android.arch.lifecycle:compiler dependency, it actually works! So I guess this means it is a bug, which only happens when using the annotation processor.
yb...@google.com <yb...@google.com>
se...@google.com <se...@google.com> #4
Can you please provide sample project? I wasn't able to reproduce it with my sample + compiler:
public class Empty extends LifecycleActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_empty);
getLifecycle().addObserver(new C());
}
public static class B implements LifecycleObserver {
@OnLifecycleEvent(Lifecycle.Event.ON_CREATE)
void a() {
System.out.println("!!!!!!!!!!!!!!!!!!!! A");
}
}
public static class C extends B {
void a() {
super.a();
System.out.println("!!!!!!!!!!!!!!!!! A overriden");
}
@OnLifecycleEvent(Lifecycle.Event.ON_CREATE)
void b() {
System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!! B");
}
}
}
public class Empty extends LifecycleActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_empty);
getLifecycle().addObserver(new C());
}
public static class B implements LifecycleObserver {
@OnLifecycleEvent(Lifecycle.Event.ON_CREATE)
void a() {
System.out.println("!!!!!!!!!!!!!!!!!!!! A");
}
}
public static class C extends B {
void a() {
super.a();
System.out.println("!!!!!!!!!!!!!!!!! A overriden");
}
@OnLifecycleEvent(Lifecycle.Event.ON_CREATE)
void b() {
System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!! B");
}
}
}
bo...@gmail.com <bo...@gmail.com> #5
I forgot to mention that the parent and child classes are in 2 different modules - maybe that is the problem.
I will try to find a bit of time to provide a sample project.
I will try to find a bit of time to provide a sample project.
bo...@gmail.com <bo...@gmail.com> #6
Indeed I can reproduce the issue with a simple project (see attachment) where the base class and the child class are in 2 modules. If the annotationProcessor is commented, it works as expected. If it's enabled, only the child class method is called.
se...@google.com <se...@google.com> #7
Thank you, now I can reproduce it, looks we doesn't correctly different modules in our annotation processor.
Description
Version used: 1.0.0-alpha3
Devices/Android versions reproduced on: N/A
I am trying to have a base class that has @OnLifecycleEvent annotated methods, and a child class that also has them. When I do that, only the base class methods get called.
Is this a known restriction? If yes, I couldn't find it documented anywhere.