Summary: | [1.5] "Type mismatch" error on valid generics construct | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Zorzella Mising name <zorzella> |
Component: | Core | Assignee: | Philipe Mulet <philippe_mulet> |
Status: | RESOLVED DUPLICATE | QA Contact: | |
Severity: | normal | ||
Priority: | P3 | ||
Version: | 3.1 | ||
Target Milestone: | 3.1 M5 | ||
Hardware: | PC | ||
OS: | Windows 2000 | ||
Whiteboard: |
Description
Zorzella Mising name
2004-12-29 14:58:03 EST
Cannot reproduce in latest, given following test case: public class X<E> { public static void main(String[] args) { X<String> xs = new X<String>(); String[] test = xs.getElements (); } public E[] getElements () { return null; } } There is no instance of Object[] in your example, unclear where it comes from. Please reopen if you can still reproduce with latest, and if so, please provide more detailed steps to reproduce. I'm running build 200412162000, or M4. As for "Object" (java.lang.Object), I don't declare anything to be of type Object. The compiler is the one that thinks, somehow, that the right hand side of this call will return Object[] (which it reports as incompatible with String[], as the message suggests): String[] test = myGeneric.getElements (); I'll have to wait for the next milestone, then, I gues... Zorzella Does my example from comment#1 reproduces the problem for you ? It did not for me, even on plain M4 build. I suspect there is an issue, but I may not have reproduced it. Please try to reproduce it using my steps. BTW, are the 2 types involved here in separate files ? Does a full rebuild make the problem go away ? Reopening Oh! You guessed right -- your example per se compiles, but if you simply split the main method to another file (not simply another private class!) it stops working. I don't think it's any refreshing, btw. Zorzella |