| Modifier and Type | Class and Description |
|---|---|
| private static class | TypeVariables.
Rewrites types such that references to type variables in the given map are replaced by the values of those variables. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv static boolean | canAssignStaticMethodResult(javax.
Tests whether a given parameter can be given to a static method like |
| pack-priv static ImmutableMap | rewriteReturnTypes(javax.
the methods whose return types are to be rewritten. methods,the class containing those methods ( sourceType,Foo in the example).the class to translate the methods into ( targetTypeFoo.Builder<T>) in the
example.Returns a map from methods to return types, where the return types are not necessarily the original return types of the methods. |
| pack-priv static javax. | substituteTypeVariables(javax.
|
| TypeVariables | back to summary |
|---|---|
| private TypeVariables() | |
| canAssignStaticMethodResult | back to summary |
|---|---|
| pack-priv static boolean canAssignStaticMethodResult(javax. Tests whether a given parameter can be given to a static method like For example, suppose we have this method in We will infer K=String, V=Number based on the target type, and then rewrite the
formal parameter type fromMap<? extends K, ? extends V> toMap<? extends String, ? extends Number>. Then we can check whether actualParameter is assignable to that.
The logic makes some simplifying assumptions, which are met for the | |
| rewriteReturnTypes | back to summary |
|---|---|
| pack-priv static ImmutableMap Returns a map from methods to return types, where the return types are not necessarily the original return types of the methods. Consider this example: @AutoValue classWe want to be able to check that the parameter type of setFoo is the same as the return
type of getFoo. But in fact it isn't, because the T of Foo<T> is not
the same as the T of Foo.Builder<T>. So we create a parallel Foo<T>
where the T is the one from Foo.Builder<T>. That way the types do
correspond. This method then returns the return types of the given methods as they appear in
that parallel class, meaning the type given for getFoo() is the T of Foo.Builder<T>.
We do the rewrite this way around (applying the type parameter from
| |
| substituteTypeVariables | back to summary |
|---|---|
| pack-priv static javax. | |
| Modifier and Type | Field and Description |
|---|---|
| private final Function | |
| private final javax. |
| Access | Constructor and Description |
|---|---|
| pack-priv | SubstitutionVisitor(Function<javax.
|
| Modifier and Type | Method and Description |
|---|---|
| protected javax. | |
| public javax. | |
| public javax. | |
| private javax. | |
| public javax. | |
| public javax. |
| substitute | back to summary |
|---|---|
| private final Function<javax. | |
| typeUtils | back to summary |
|---|---|
| private final javax. | |
| SubstitutionVisitor | back to summary |
|---|---|
| pack-priv SubstitutionVisitor(Function<javax. | |
| defaultAction | back to summary |
|---|---|
protected javax.
| |
| visitArray | back to summary |
|---|---|
public javax.
| |
| visitDeclared | back to summary |
|---|---|
public javax.
| |
| visitOrNull | back to summary |
|---|---|
| private javax. | |
| visitTypeVariable | back to summary |
|---|---|
public javax.
| |
| visitWildcard | back to summary |
|---|---|
public javax.
| |