Bug 572359 - Wrong Completion AST resolution on streams after the first operations
Summary: Wrong Completion AST resolution on streams after the first operations
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.19   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2021-03-27 13:18 EDT by Gayan Perera CLA
Modified: 2023-03-22 01:04 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gayan Perera CLA 2021-03-27 13:18:53 EDT
Take the following code

Stream.of("1").filter($)


At $ when invoke completions, you get the correct type signature from org.eclipse.jdt.core.CompletionContext.getExpectedTypesSignatures(), this is because the completion ast node is CompletionOnSingleNameReference where the parent ast node is MessageSend


Now take the following code

Stream.of("1").filter(i -> i != null).map($)

At $ when invoke completions, you don't get the correct type signature from org.eclipse.jdt.core.CompletionContext.getExpectedTypesSignatures(), this is because the completion ast node is CompletionOnMessageSend and parent ast node is null. This is because the Completion parser fails to parse this second MessageSend.

Now if we type something like this

Stream.of("1").filter(i -> i != null).map(n$)

At $ when invoke completions, You will get the correct type signature with correct child and parent AST nodes.

The completion node failure cause implementing more smart completion computers which can suggest lambda statements and method reference according to the context.
Comment 1 Eclipse Genie CLA 2023-03-22 01:04:18 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.