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

Bug 284296

Summary: [1.5][compiler] Invalid 'Incompatible conditional operand types' error on instanceof
Product: [Eclipse Project] JDT Reporter: Mark Hobson <hello>
Component: CoreAssignee: Srikanth Sankaran <srikanth_sankaran>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: Olivier_Thomann, srikanth_sankaran
Version: 3.5   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard: stalebug
Attachments:
Description Flags
junit test none

Description Mark Hobson CLA 2009-07-22 12:21:22 EDT
The following code wrongly produces the error "Incompatible conditional operand types List<List<Integer>> and Main2.ListList<?>" on the instanceof operator:

public class Main
{
	private static class ListList<T> extends ArrayList<List<T>>
	{
	}
	
	public static void main(String[] args)
	{
		List<List<Integer>> list = new ListList<Integer>();
		
		System.out.println(list instanceof ListList<?>);
	}
}

It compiles fine with javac 1.5.0_19.

-- Configuration Details --
Product: Eclipse 1.2.0.20090618-0904 (org.eclipse.epp.package.jee.product)
Installed Features:
 org.eclipse.jdt 3.5.0.v20090527-2000-7r88FEeFJePyvYeA33DjZ_c1
Comment 1 Mark Hobson CLA 2009-07-23 07:01:51 EDT
Also affects casting too, using the above example:

ListList<?> listList = (ListList<?>) list;

Produces the error "Cannot cast from List<List<Integer>> to Main2.ListList<?>", although it compiles with javac.
Comment 2 Mark Hobson CLA 2009-07-23 07:03:57 EDT
Typo in error, was meant to be "Cannot cast from List<List<Integer>> to Main.ListList<?>".
Comment 3 Kent Johnson CLA 2009-09-17 16:20:53 EDT
looks like a bug not an enhancement
Comment 4 Srikanth Sankaran CLA 2010-11-03 03:26:34 EDT
I'll follow up on this.
Comment 5 Srikanth Sankaran CLA 2010-11-03 09:04:17 EDT
Created attachment 182291 [details]
junit test

Fails currently.
Comment 6 Eclipse Genie CLA 2019-06-27 12:23:09 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.