Summary: | [1.5] [compiler] genericized getClass() return type is incorrect | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Tom Crockett <Thomas.M.Crockett> |
Component: | Core | Assignee: | Philipe Mulet <philippe_mulet> |
Status: | RESOLVED INVALID | QA Contact: | |
Severity: | normal | ||
Priority: | P3 | ||
Version: | 3.2.1 | ||
Target Milestone: | 3.3 M3 | ||
Hardware: | Macintosh | ||
OS: | Mac OS X - Carbon (unsup.) | ||
Whiteboard: |
Description
Tom Crockett
2006-10-04 18:09:04 EDT
Actually, we were wrong in 3.2.0. We fixed this since then, also see bug 147381. btw javac agrees with us: X.java:3: incompatible types found : java.lang.Class<capture#297 of ? extends java.lang.Object> required: java.lang.Class<? extends T> Class<? extends T> c = x.getClass(); ^ 1 error Closing Upon reviewing the documentation in Object.getClass(), it's also my interpretation that the new behavior (in 3.2.1) is correct. "The result is of type {@code Class<? extends X>} where X is the erasure of the static type of the expression on which <code>getClass</code> is called." In this case, the erasure of T would be Object, so the resulting type would be Class<? extends Object>, as it is in 3.2.1. Changing OS from Mac OS to Mac OS X as per bug 185991 |