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

Bug 327289

Summary: Generic method overload clash in Helios
Product: [Eclipse Project] JDT Reporter: Henri Tremblay <henri.tremblay>
Component: CoreAssignee: Srikanth Sankaran <srikanth_sankaran>
Status: CLOSED NOT_ECLIPSE QA Contact:
Severity: blocker    
Priority: P3 CC: Olivier_Thomann
Version: 3.6.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Henri Tremblay CLA 2010-10-07 19:34:50 EDT
Build Identifier: 20100917-0705

Related to bug# 321548 that I thought should have fixed the issue in 3.6.1 (Eclipse SR1).

I still have the issue. Here's a test case:

import java.util.Collections;
import java.util.List;
import org.junit.Test;

public class OverloadTest {

	public boolean foo(List<Boolean> l) {
		return false;
	}
	
	public <T> T foo(List<T> l) {
		return null;
	}
	
	@Test
	public void test() {
		boolean value = foo(Collections.<Boolean>emptyList());
	}
}

In Helios, this code doesn't compile. If works well in Galileo and Javac. 

I need this overload to be able to return false instead of null when a Boolean is used. This will happen if the method taking List<Boolean> in argument is removed (and so the test will throw an NPE).

Reproducible: Always

Steps to Reproduce:
1. Try to compile the test case in Helios (3.6.0 or 3.6.1)
Comment 1 Olivier Thomann CLA 2010-10-07 22:02:09 EDT
This doesn't compile with javac 1.7 anymore.
Srikanth, another one to close as a duplicate.
Comment 2 Henri Tremblay CLA 2010-10-08 19:41:42 EDT
You are sadly right. I just tried. Which is quite unfortunate since this feature was useful.

It means I'll have to deprecate and rename the current methods. But it's unrelated to Eclipse...