Bug 122610

Summary: [1.5][compiler] Qualified this has generic type binding instead of parameterized one
Product: [Eclipse Project] JDT Reporter: Markus Keller <markus.kell.r>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: eclipse, patrikbeno
Version: 3.2   
Target Milestone: 3.2 M5   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Markus Keller CLA 2006-01-04 06:10:47 EST
From the news:
-------------------------------------------------------------
In the following example, the eclipse compiler complains Class1.this
in the assignment statement as being incorrect.  The actual error message
is "Type mismatch: cannot convert from Class1<V,R> to
Class1<V,R>".  I think this is a valid qualified expression. Any clue what
may be wrong?

public class Class1<V, R> {
	
	private class InnerClass1 {
		void foo() {
			Class1<V, R> c = Class1.this;
		}
	}
}
-- Venkatesh Prasad Ranganath, Dept. Computing and Information Science, Kansas State University, US. web: http://www.cis.ksu.edu/~rvprasa
-------------------------------------------------------------

The problem seems to be that Class1.this has a generic type binding instead of a parameterized one. The wrong compile error also appears without the inner type:
class Class1<V, R> {
    void m() {
        Class1<V, R> c2 = this; // correct: isParameterizedType
        Class1<V, R> c3 = Class1.this; //wrong compile error: isGenericType
    }
}
Comment 1 Markus Keller CLA 2006-01-04 06:12:21 EST
I20051220-0800, same in 3.2M4.
Comment 2 Philipe Mulet CLA 2006-01-05 07:06:30 EST
Added GenericTypeTest#test879. Good diagnostic.

This problem only exists in 3.2 stream, as it is a consequence of merge of generic and parameterized bindings. One instance got mistaken.

Fixed in latest. No need to backport to 3.1.2 (where problem doesn't exist).
Comment 3 Jerome Lanneluc CLA 2006-02-14 12:03:23 EST
Verified for 3.2 M5 using build I20060214-0010
Comment 4 Olivier Thomann CLA 2006-11-07 12:02:22 EST
*** Bug 163262 has been marked as a duplicate of this bug. ***