Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 327289 - Generic method overload clash in Helios
Summary: Generic method overload clash in Helios
Status: CLOSED NOT_ECLIPSE
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.6.1   Edit
Hardware: PC Windows 7
: P3 blocker with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Srikanth Sankaran CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-07 19:34 EDT by Henri Tremblay CLA
Modified: 2010-10-08 19:41 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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...