Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 142964

Summary: [1.5][compiler] Inferred intersection type not enough specific
Product: [Eclipse Project] JDT Reporter: Philipe Mulet <philippe_mulet>
Component: CoreAssignee: Srikanth Sankaran <srikanth_sankaran>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: hwaite, Olivier_Thomann, philippe_mulet
Version: 3.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard: stalebug

Description Philipe Mulet CLA 2006-05-22 07:03:57 EDT
Build 3.2RC4

The following program is rejected, though it shouldn't.
Javac 1.5 also rejects it, Javac 1.6 accepts it.

public class X {
  public class Inner {
  }
  void foo(boolean b, X1 x1, X2 x2) {
	  Comparable<? extends X> x = b ? x1 : x2;
	  (b ? x1 : x2).new Inner();
  }
}

abstract class X1 extends X implements Comparable<X1> {}
abstract class X2 extends X implements Comparable<X2> {}
Comment 1 Philipe Mulet CLA 2006-05-22 07:04:46 EDT
Inferred intersection type is: X&Comparable<?>, where it should be: X&Comparable<? extends X>
Comment 2 Philipe Mulet CLA 2006-05-22 07:07:41 EDT
Actually, it should be: X&Comparable<? extends X&Comparable<...>>
Comment 3 Philipe Mulet CLA 2006-05-22 07:09:26 EDT
Added GenericTypeTest#test0995 (disabled)
Comment 4 Philipe Mulet CLA 2007-03-27 13:02:45 EDT
Tim, pls have a look at it.
Comment 5 Kent Johnson CLA 2009-09-17 16:13:59 EDT
*** Bug 272783 has been marked as a duplicate of this bug. ***
Comment 6 Eclipse Genie CLA 2019-08-26 13:21:39 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.