Bug 148061 - [1.5][compiler] Unchecked method invocation should rawify all argument types
Summary: [1.5][compiler] Unchecked method invocation should rawify all argument types
Status: RESOLVED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.3 M1   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-06-21 11:39 EDT by Philipe Mulet CLA
Modified: 2006-06-23 19:07 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 Philipe Mulet CLA 2006-06-21 11:39:33 EDT
Build 3.2RC7

The following code should be accepted:
public class X {
	void foo(L l, C<? extends X> c) {
		X x = bar(l, c);
	}
	<T> T bar(L<T> l, C<? extends T> c) { 
		return null;
	}	
}
class C<E> {}
class L<E> {}


considering that the unchecked invocation should denote: #bar(L,C<capture-of ? extend X>), which returns something compatible with X.

Currently the compiler is considering the invocation to be: #bar(L,C), which thus returns an Object.
Comment 1 Philipe Mulet CLA 2006-06-23 19:07:18 EDT
Added GenericTypeTest#test1008-1016.

After looking more into this case, the original testcase should be rejected as we did, since inference against raw types should yield a raw method, thus T should be bound to Object and not X.

On the following invocation, with javac, bar1() invocation seems to return 'X', where bar2() and bar3() are instead doing raw type conversions on return type. 
Our compiler is consistently doing raw conversion here.

public class X {
      void foo(L l, C<X> c) {
            X x = bar1(l, c);
            L<X> lx = bar2(l, c);
            C<X> cx = bar3(l, c);
      }
      <T> T bar1(L<T> l, C<T> c) {
            return null;
      }
      <T> L<T> bar2(L<T> l, C<T> c) {
            return null;
      }
      <T> C<T> bar3(L<T> l, C<T> c) {
            return null;
      }
}
class C<E> {}
class L<E> {}