Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanenicolas committed Oct 3, 2016
1 parent 8e6bb50 commit b168ae3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Expand Up @@ -272,15 +272,15 @@ private boolean isValidProviderOrLazy(Element element) {
return false;
}

Object elementTypeMirror = element.asType();
TypeMirror firstParameterTypeMirror = ((DeclaredType) elementTypeMirror).getTypeArguments().get(0);
TypeMirror firstParameterTypeMirror = declaredType.getTypeArguments().get(0);
if(firstParameterTypeMirror.getKind() == TypeKind.DECLARED) {
int size = ((DeclaredType) firstParameterTypeMirror).getTypeArguments().size();
Element enclosingElement = element.getEnclosingElement();
if(size != 0) {
Element enclosingElement = element.getEnclosingElement();
error(element, "Lazy/Provider %s is not a valid in %s. Lazy/Provider cannot be used on generic types.",
element.getSimpleName(), //
enclosingElement.getSimpleName());
return false;
}
}

Expand Down
Expand Up @@ -449,7 +449,6 @@ public void testNonEmptyConstructorWithGenerics() {
"package test;", //
"import java.util.List;", //
"import javax.inject.Inject;", //
"import toothpick.Lazy;", //
"public class TestNonEmptyConstructor {", //
" @Inject public TestNonEmptyConstructor(List<String> str) {}", //
"}" //
Expand Down

0 comments on commit b168ae3

Please sign in to comment.