Generics Type Variable Resolution
- Dominant language
- Java
- Stars
- 2k
- Forks
- 392
- Avg merge
- 11h 24m
- Merged PRs (30d)
- 36
Description
consider the following
```java
class Generic {
public T field;
}
class UseGeneric extends Generic {
public Generic f;
}
```
is there a way, via TypeFactory (reflection), to obtain `UseGeneric.field` with `T` resolved to the correct type (String)?
the intent is for type resolution of Generics without knowing in advanced what the Type Variable actually is, but being infered from some root class such as `UseGeneric`
eg
`UseGeneric` would resolve
```java
UseGeneric u = new UseGeneric();
u.field == String
u.f.field == Integer
```
either by supplying `UseGeneric.class` or by converting `UseGeneric.class` into abstract source code (with no decompilation of method bodies as we do not need them) which is then analyzed by spoon's java code type analyser to obtain correct types
Contributor guide
Assessment
This issue has not been assessed yet.