Bug 82439

Summary: [compiler] [1.5] internal compiler reports type mismatch
Product: [Eclipse Project] JDT Reporter: Ralf Behle <ralf.be>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: psk
Version: 3.1   
Target Milestone: 3.1 M5   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Ralf Behle CLA 2005-01-09 05:47:08 EST
For this syntactic correct program the internal compiler reports a type mismatch
for the assignment.

import java.util.*;

public class A {

    public <E extends Object,S extends Collection<E>> S test(S param){
            Class<? extends Collection> c = param.getClass();
            return null;
    }
}
Comment 1 Olivier Thomann CLA 2005-01-10 11:21:53 EST
The error is:
----------
1. ERROR in C:\tests_sources\X.java
 (at line 6)
	Class<? extends Collection> c = param.getClass();
	                            ^
Type mismatch: cannot convert from Class<? extends Object> to Class<? extends
Collection>
----------
Comment 2 Ralf Behle CLA 2005-01-11 13:25:01 EST
What does the last comment mean? If it means that the given example is not
syntactilly correct, try runningthe example with sun's javac
Comment 3 Philipe Mulet CLA 2005-01-12 06:56:46 EST
No. Olivier was simply pasting the offending error diagnosis we issue.
It clearly is a bug in our compiler.
Comment 4 Philipe Mulet CLA 2005-01-14 09:08:43 EST
Problem comes from the fact we didn't intercept the Object#getClass() method on
this code path, and did not substitute its return type to be: "Class<? extends
Collection>" in place of "Class <? extends Object>".

Added regression test: GenericTypeTest#test460.
Fixed
Comment 5 Jerome Lanneluc CLA 2005-02-15 05:47:00 EST
Verified in I20050214