Skip to content
This repository has been archived by the owner on Apr 30, 2019. It is now read-only.

Inherrited methods are not counted by Otto #150

Open
kennydude opened this issue Apr 9, 2015 · 5 comments
Open

Inherrited methods are not counted by Otto #150

kennydude opened this issue Apr 9, 2015 · 5 comments

Comments

@kennydude
Copy link

Otto does not check inherited classes for methods which could be annotated with a @Subscribe annotation.

Example:

public class BaseClass{ @Subscribe public void receiveEvent(MyEvent e){ /* ... */ } }
public class MainClass extends BaseClass{  /* receiveEvent is not seen by register, even if register is called in BaseClass */  }

Use case for this is for a project I am working on, I want SnackBar notifications to appear on any activity when a certain event is received.

@JakeWharton
Copy link
Member

This is by design.

Otto will not traverse the class hierarchy and add methods from base classes or interfaces that are annotated.

I'll leave this issue open as a feature request, but it's unlikely to be fixed.

@kennydude
Copy link
Author

I managed to work around it for now (using a manager class per activity for the bus), but thanks anyway I assume this is so that it isn't slowing things down too much.

@JakeWharton
Copy link
Member

That is much more efficient than supporting inheritance!

@KleinerHacker
Copy link

Sorry, but if this problem won't fix the framework is not usable with android annotations.

@JakeWharton
Copy link
Member

That is an acceptable trade-off for us.

On Mon, May 23, 2016, 7:14 AM KleinerHacker [email protected]
wrote:

Sorry, but if this problem won't fix the framework is not usable with
android annotations.


You are receiving this because you commented.
Reply to this email directly or view it on GitHub
#150 (comment)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants