google / google/guice

Annotations @Provides and @Singleton do not work together

Open
#1,670 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
12.7k
Forks
1.7k
Avg merge
11m
Merged PRs (30d)
2

Description

Hello

Annotations ```@Provides``` and ```@Singleton``` do not work together if I try to return class type instead of interface:
```
@Provides @Singleton
InMemoryTransactionLog provideTransactionLog() {
...
}
```
I look through the implementation and noticed, that method ```findScopeAnnotation(Errors, Class)``` just checks whether the provided class was marked by ```@Singleton``` annotation. The problem is that I can't mark by this annotation third party classes.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.