Carry annotations from interface into generated implementation
See original GitHub issueHas this been considered? The following is an example use case:
class Foo @AssistedInject constructor(@Assisted val assisted: Bar) {
@Reusable
@AssistedInject.Factory
interface Factory {
fun create(assisted: Bar): Foo
}
}
to generate a factory implementation annotated with @Reusable
:
@Reusable // This line is new
public final class Foo_AssistedFactory implements Foo.Factory {
@Inject
public Foo_AssistedFactory() {
}
@Override
public Foo create(Bar assisted) {
return new Foo(assisted);
}
}
I understand it’s probably a bit questionable since something like this would also leave the interface annotated which may not be desirable, but considering interfaces have no implementation I see no major issue with it, and there may also be other mechanisms to achieve the same goal and don’t have this issue. Thoughts?
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Carry annotations from interface into generated implementation
The following is an example use case: class Foo @AssistedInject ... Carry annotations from interface into generated implementation #158.
Read more >Carry forward annotation from interface to generated java ...
I have created a custom method level annotation called @Primary (denoting which attribute is primary field) that I have used to annotate one...
Read more >An Introduction to Annotations and Annotation Processing in ...
Annotations provide information to a program at compile time or at runtime based on which the program can take further action.
Read more >Chapter 9. Interfaces - Oracle Help Center
An interface declaration introduces a new reference type whose members are classes, interfaces, constants, and methods. This type has no instance variables, ...
Read more >Interface Driven Controllers in Spring - Baeldung
Learn how to create controllers using Spring MVC request annotation on Java interfaces.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ok! It’s not that urgent. There’s three whole days left this week, and Monday would be fine, too.
I have a patch half-way through for annotations in dagger.* packages. Just need to add/update some tests but I’m afk right now, I’ll have it ready in a few hours
On Tue, 10 Nov 2020, 20:50 Jake Wharton, notifications@github.com wrote: