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

Bug 496861

Summary: [1.8][content assist] A first Java enum value that takes lambda parameters in the constructor do not support Content Assist inside the lambda, if there is a block in the lambda
Product: [Eclipse Project] JDT Reporter: Greg Fraley <gsfraley>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: noopur_gupta, sewe
Version: 4.6   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard: stalebug

Description Greg Fraley CLA 2016-06-27 12:58:22 EDT
The title covers the bulk of the issue.  One thing to note is that highlighting still works as expected.  Here is an example snippet of affected code:

public enum MyEnum
{
	ONE(() -> {
		return "One!".toUpperCase();
	}),
	
	TWO(() -> {
		return "Two!".toUpperCase();
	});
	
	private MyEnum(Supplier<String> supplier)
	{ }
}

In that example, the ONE value has no Content Assist inside the lambda block.  Content Assist works in any following values (TWO in this instance), or if the first value is not a blocked lambda:

ONE(() -> "One!".toUpperCase)
Comment 1 Andreas Sewe CLA 2016-06-28 07:30:52 EDT
(In reply to Greg Fraley from comment #0)
> The title covers the bulk of the issue.  One thing to note is that
> highlighting still works as expected.  Here is an example snippet of
> affected code:

Hi Greg. Thank you for the very detailed bug report! Much appreciated.

This problem also occurs with Eclipse Code Recommenders *not* installed; I can reproduce with a plain Eclipse 4.6 SDK from [1].

Hence, this seems to be an issue with the core Java Development Tools (which Code Recommenders extends).

I'm reassigning this bug to the JDT team.

[1] <http://download.eclipse.org/eclipse/downloads/drops4/R-4.6-201606061100/>
Comment 2 Noopur Gupta CLA 2016-06-28 07:47:21 EDT
It also does not work in this case:

	TWO(() -> {	Str|
		return "Two!".toUpperCase();
	});

Moving to JDT/Core as no proposals are returned for these cases.
Comment 3 Eclipse Genie CLA 2020-04-02 15:09:21 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. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. 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.