Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 433474 - Inference failure with static method and lambda expression
Summary: Inference failure with static method and lambda expression
Status: VERIFIED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.4   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: 4.4 M7   Edit
Assignee: Stephan Herrmann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-24 17:44 EDT by Thomas Schindl CLA
Modified: 2014-04-30 02:43 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Schindl CLA 2014-04-24 17:44:04 EDT
package t;

public class Snippet {
	public interface I {
		public void i(String a);
	}

	public static class B<E> {

	    public static <E> B<E> b(B<E> helper, I listener) {
	    	return null;
	    }
	    
	    public static <E> B<E> b(B<E> helper) {
	    	return null;
	    }
	}
	
	private B<Object> helper;
	
	public void test() {
		// Works
		I i = (String o) -> {throw new RuntimeException();};
		helper = B.b(helper, i);
		
		// Fails
		helper = B.b(helper,(String o) -> {throw new RuntimeException();});
		
		// Succeeds
		helper = (B<Object>) B.b(helper,(String o) -> {throw new RuntimeException();});
		
		// Succeeds
		helper = B.b(helper);
	}
}
Comment 1 Stephan Herrmann CLA 2014-04-25 12:22:00 EDT
Thanks, Tom, interesting case ...

Tentatively scheduling for 4.4, time permitting.
Comment 2 Steve Northover CLA 2014-04-28 15:12:22 EDT
I am running this and it compiles for me (with the JDK8 update):

Eclipse SDK

Version: 4.3.2
Build id: M20140221-1700

(c) Copyright Eclipse contributors and others 2000, 2014.  All rights reserved.
Visit http://www.eclipse.org/platform

This product includes software developed by the
Apache Software Foundation http://www.apache.org/
Comment 3 Stephan Herrmann CLA 2014-04-28 15:29:59 EDT
(In reply to Steve Northover from comment #2)
> I am running this and it compiles for me (with the JDK8 update):

Hi, again. So, we have switched sides? You're no longer reporting Junk but
telling us we already fixed it? :)
Thanks!

@Tom, before I start the chase for a duplicate bug: I cannot even find any version where this is broken. What version JDT were you using?
Comment 4 Thomas Schindl CLA 2014-04-28 15:48:21 EDT
hm - 1.0.0.v20140309-1413 - looks like my build fetched an old version from somewhere - updateing to 1.0.0.v20140317-1956 fixes the problem - sorry :-(
Comment 5 Stephan Herrmann CLA 2014-04-28 16:53:27 EDT
(In reply to Thomas Schindl from comment #4)
> hm - 1.0.0.v20140309-1413 - looks like my build fetched an old version from
> somewhere - updateing to 1.0.0.v20140317-1956 fixes the problem - sorry :-(

Thanks for confirming.

Mh, 1.0.0.v20140309-1413? What kind of version would that be?
Version of a package? At that time we didn't have any packages with J8 support.
Even if I use JDT as of that date I don't get an error.

Ergo: not enough info to find which change fixed this bug => leaving status at WORKSFORME.
Comment 6 Sasikanth Bharadwaj CLA 2014-04-30 01:47:00 EDT
Verified for 4.4 M7 using I20140429-2000 build