Bug 82439 - [compiler] [1.5] internal compiler reports type mismatch
Summary: [compiler] [1.5] internal compiler reports type mismatch
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 3.1 M5   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-01-09 05:47 EST by Ralf Behle CLA
Modified: 2005-02-15 05:47 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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