/* package whatever; // don't place package name! */
/* package whatever; // don't place package name! */
public class Main {
public static class Lazy<T> {
T field;
public T get() {
return field;
}
}
public static class Whatever<T> {
T field;
public T get() {
return field;
}
}
public static Lazy<Whatever<String>> lazyWhateverString;
java.
lang.
reflect.
Field field
= Main.
class.
getField("lazyWhateverString");
java.lang.reflect.ParameterizedType lazyType = (java.lang.reflect.ParameterizedType) field.getGenericType();
java.lang.reflect.ParameterizedType whateverType = (java.lang.reflect.ParameterizedType) lazyType.getActualTypeArguments()[0];
Class<String> realType = (Class<String>) whateverType.getActualTypeArguments()[0];
System.
out.
println(lazyType.
getRawType()); System.
out.
println(whateverType.
getRawType()); }
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKLyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKcHVibGljIGNsYXNzIE1haW4gewogICAgCiAgICBwdWJsaWMgc3RhdGljIGNsYXNzIExhenk8VD4gewogICAgICAgIFQgZmllbGQ7CiAgICAgICAgcHVibGljIFQgZ2V0KCkgewogICAgICAgICAgICByZXR1cm4gZmllbGQ7CiAgICAgICAgfQogICAgfQogICAgCiAgICBwdWJsaWMgc3RhdGljIGNsYXNzIFdoYXRldmVyPFQ+IHsKICAgICAgICBUIGZpZWxkOwogICAgICAgIHB1YmxpYyBUIGdldCgpIHsKICAgICAgICAgICAgcmV0dXJuIGZpZWxkOwogICAgICAgIH0KICAgIH0KICAgIAogICAgCiAgICAKICAgIHB1YmxpYyBzdGF0aWMgTGF6eTxXaGF0ZXZlcjxTdHJpbmc+PiBsYXp5V2hhdGV2ZXJTdHJpbmc7CiAgICAKICAgIAogICAgcHVibGljIHN0YXRpYyB2b2lkIG1haW4oU3RyaW5nIGFyZ3NbXSkgdGhyb3dzIEV4Y2VwdGlvbiB7CiAgICAgICAgCiAgICAgICAgamF2YS5sYW5nLnJlZmxl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