Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Gin does not respect injection order when subclassing #1

Open
metteo opened this issue Mar 14, 2018 · 1 comment
Open

Gin does not respect injection order when subclassing #1

metteo opened this issue Mar 14, 2018 · 1 comment
Labels

Comments

@metteo
Copy link
Member

metteo commented Mar 14, 2018

Originally reported on Google Code: #199 / #199

What steps will reproduce the problem?
According to the Guice injection points document at: guice/wiki/InjectionPoints injection methods of super classes are called before the methods of a subclass.

In Gin methods are sorted alphabetically meaning that some methods in sub class maybe called before methods from super class.

What is the expected output? What do you see instead?
I expect order of invocation as described in Guice Wiki

What version of the product are you using? On what operating system?
GWT 2.6.1 / GIN 2.1.2

Please provide any additional information below.
zip file with a test case attached in the original issue comments section

metteo pushed a commit that referenced this issue Mar 17, 2018
@metteo metteo added the bug label Apr 14, 2018
@metteo
Copy link
Member Author

metteo commented Apr 28, 2018

The root cause is usage of TreeSet in MemberCollector.java:251. Methods are added to it in the order from super class to subclass and overrides are filtered out by the comparator. Unfortunately the side effect is that the order in which items are added is lost because of the sorting capability of TreeSet.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant