Bug 108497 - ClassCastException from code executed during varargs invocation
Summary: ClassCastException from code executed during varargs invocation
Status: RESOLVED DUPLICATE of bug 99260
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-31 14:42 EDT by Tim Hanson CLA
Modified: 2005-08-31 14:51 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tim Hanson CLA 2005-08-31 14:42:38 EDT
Compile the code below and execute Test. You get a stacktrace like the following:

Exception in thread "main" java.lang.ClassCastException: [LType;
        at SubWorker.doit(X.java:1)
        at Test.main(X.java:17)



class Type { }
class SubType extends Type { }
 
class Worker<T extends Type> {
    public void doit(T... ts) {}
}

class SubWorker extends Worker<SubType> {
	public void doit(SubType... ts) {}
}
 
class Test {
 
    public static void main(String args[]) {
        SubType s = new SubType();
        Worker<SubType> w = new SubWorker();
        w.doit(s,s);
        
        Worker<SubType> w2 = new Worker<SubType>();
        w2.doit(s,s);
    } 
}
Comment 1 Tim Hanson CLA 2005-08-31 14:51:10 EDT

*** This bug has been marked as a duplicate of 99260 ***