Return type of Object.getClass() (original) (raw)
Zhong Yu zhong.j.yu at gmail.com
Thu Jun 30 21:16:41 UTC 2011
- Previous message: hg: jdk8/tl/langtools: 7060926: Attr.PostAttrAnalyzer misses a case
- Next message: hg: jdk8/tl/langtools: 7059905: (javadoc) promote method visibility for netbeans usage
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Why does it return Class<? extends |X|> instead of Class<? extends X>? Quote:
The actual result type is Class<? extends |X|> where |X| is the erasure of the static type of the expression on which getClass is called.
This means the following code does not compile T obj = ...; Class clazz = obj.getClass();
What's the reason for erasure here? Thanks.
Zhong Yu
- Previous message: hg: jdk8/tl/langtools: 7060926: Attr.PostAttrAnalyzer misses a case
- Next message: hg: jdk8/tl/langtools: 7059905: (javadoc) promote method visibility for netbeans usage
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]