-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow nested generic types #129
base: master
Are you sure you want to change the base?
Conversation
@@ -86,7 +86,9 @@ static void checkNotPrimitive(Type type) { | |||
"unexpected owner type for " + rawType + ": " + ownerType); | |||
} | |||
} else if (enclosingClass != null) { | |||
throw new IllegalArgumentException("unexpected owner type for " + rawType + ": null"); | |||
// TODO ? |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are the input values?
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
52cb004
to
2ae5f7c
Compare
@@ -75,7 +75,8 @@ private static boolean hasParameterizedTypeVariable(Type parameterType) { | |||
private TypeUtil.ParameterizedTypeImpl findKeyForParameterizedType( | |||
ParameterizedType parameterType) { | |||
Type[] matchingTypes = matchingParameterizedType(parameterType.getActualTypeArguments()); | |||
return new TypeUtil.ParameterizedTypeImpl(null, parameterType.getRawType(), matchingTypes); | |||
return new TypeUtil.ParameterizedTypeImpl( | |||
parameterType.getOwnerType(), parameterType.getRawType(), matchingTypes); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JakeWharton i wasn't passing in the owner type here which was causing the exception. it is now resolved.
import org.jetbrains.annotations.Nullable; | ||
|
||
@AutoValue | ||
abstract class Key { | ||
static Key of(@Nullable Annotation qualifier, Type type) { | ||
if (containsTypeVariable(type)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JakeWharton I can remove this check if it is causing any second thoughts on merging this PR.
It helps surface unsupported bindings in Dagger Reflect as soon as possible. When a Key which includes <T>
instead of a real type, it immediately throws an error.
It has a bit of a runtime cost since it recursively checks the type and its parameters whenever a Key is constructed.
Dont allow type variables in keys.
2ae5f7c
to
c1d299d
Compare
Dont allow type variables in keys.