【发布时间】:2019-10-06 09:48:57
【问题描述】:
提到https://dagger.dev/multibindings.html,有一段讲@AutoAnnotation
class MyComponentTest {
@Test void testMyComponent() {
MyComponent myComponent = DaggerMyComponent.create();
assertThat(myComponent.myKeyStringMap()
.get(createMyKey("abc", Abc.class, new int[] {1, 5, 10}))
.isEqualTo("foo");
}
@AutoAnnotation
static MyKey createMyKey(String name, Class<?> implementingClass, int[] thresholds) {
return new AutoAnnotation_MyComponentTest_createMyKey(name, implementingClass, thresholds);
}
}
不知何故,我从来没有让它工作。
我可以添加以下内容
implementation 'com.google.auto.value:auto-value:1.5.2'
annotationProcessor 'com.google.auto.value:auto-value:1.5.2'
还有添加
android.defaultConfig.javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true
【问题讨论】:
标签: java android annotations dagger-2