Bug 547362 - Code Assist does not work with complex syntax
Summary: Code Assist does not work with complex syntax
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.11   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2019-05-15 22:13 EDT by HIRUKAWA Ryo CLA
Modified: 2022-11-07 03:53 EST (History)
5 users (show)

See Also:


Attachments
code-assist-not-work (8.84 KB, image/png)
2019-05-15 22:13 EDT, HIRUKAWA Ryo CLA
no flags Details
code-assist-work (12.21 KB, image/png)
2019-05-15 22:26 EDT, HIRUKAWA Ryo CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description HIRUKAWA Ryo CLA 2019-05-15 22:13:27 EDT
Created attachment 278621 [details]
code-assist-not-work

Code Assist does not work under the following conditions:

1. The field is an instance of an anonymous class.
2. Use instance initializer.
3. Use lambda expression.

Code Assist does not work below lambda expressions.
But above the lambda expression code assist works.
Comment 1 HIRUKAWA Ryo CLA 2019-05-15 22:26:33 EDT
Created attachment 278622 [details]
code-assist-work
Comment 2 Stephan Herrmann CLA 2019-05-16 08:40:45 EDT
Most likely, the CompletionParser has issues with this.

For investigation please paste your code snippet as text (since we cannot copy-paste from the image :) ).
Comment 3 HIRUKAWA Ryo CLA 2019-05-16 20:47:15 EDT
public class Sample {
	
	private Object anonymous = new Object() {
		{
			new Thread(() -> {
				
			});

			// code assist does not work here.
		}
	};
}
Comment 4 HIRUKAWA Ryo CLA 2019-05-16 20:51:27 EDT
# The same problem occurs if you use anonymous classes instead of lambda expressions.

public class Sample {
	
	private Object anonymous = new Object() {
		{
			new Thread(new Runnable() {
				@Override
				public void run() {
				}
			});

			// code assist does not work here.
		}
	};
}


# Code assist works when you separate sentences.

public class Sample {
	
	private Object anonymous = new Object() {
		{
			Runnable r = () -> {};
			new Thread(r);

			// code assist works fine!
		}
	};
}
Comment 5 Jay Arthanareeswaran CLA 2019-05-29 06:31:15 EDT
Here's what the CU looks like in CompletionEngine:

public class Sample {
  private Object anonymous;
  public Sample() {
  }
}

It's disappointing to see the whole block of code, which can simply be ignored is causing all sorts of trouble :(

But if you invoke the completion ahead of the lambda, it is:

public class Sample {
  private Object anonymous = new Object() {
    {
      <CompleteOnName:>;
    }
  };
  public Sample() {
  }
}
Comment 6 Eclipse Genie CLA 2021-05-20 05:43:55 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.
Comment 7 Jay Arthanareeswaran CLA 2021-05-20 06:11:15 EDT
This may still be relevant.

Vikas, would you like to take a look?
Comment 8 Mauro Molinari CLA 2022-11-07 03:53:26 EST
May this be somewhat related to bug #392981?