Summary: | [1.5][compiler] Casted Enum-class is not of correct type in Eclipse | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Volker Renneberg <volker.renneberg.external> |
Component: | Core | Assignee: | Philipe Mulet <philippe_mulet> |
Status: | RESOLVED DUPLICATE | QA Contact: | |
Severity: | normal | ||
Priority: | P3 | ||
Version: | 3.1 | ||
Target Milestone: | 3.1 M7 | ||
Hardware: | PC | ||
OS: | Windows XP | ||
Whiteboard: |
Description
Volker Renneberg
2005-04-06 07:30:43 EDT
Reproduced in 3.1M6. We say: ---------- 1. ERROR in X.java (at line 7) doWithEnumClass((Class<Enum>) cl); ^^^^^^^^^^^^^^^ Bound mismatch: The generic method doWithEnumClass(Class<T>) of type X is not applicable for the arguments (Class<Enum>) since the type Enum is not a valid substitute for the bounded parameter <T extends Enum<T>> ---------- 2. WARNING in X.java (at line 7) doWithEnumClass((Class<Enum>) cl); ^^^^^^^^^^^^^^^^ Type safety: The cast from Class<?> to Class<Enum> is actually checking against the erased type Class ---------- 2 problems (1 error, 1 warning) Javac says: X.java:7: warning: [unchecked] unchecked cast found : java.lang.Class<capture of ?> required: java.lang.Class<java.lang.Enum> doWithEnumClass((Class<Enum>) cl); ^ X.java:7: warning: [unchecked] unchecked method invocation: <T>doWithEnumClass(java.lang.Class<T>) in X is applied to (java.lang.Class<java. lang.Enum>) doWithEnumClass((Class<Enum>) cl); ^ 2 warnings Issue is related to fix for bug 86838. Added GenericTypeTest#test571-572. |