Bug 564445 - Incorrect postfix completions for var
Summary: Incorrect postfix completions for var
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 4.17   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Roland Grunberg CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2020-06-18 15:38 EDT by Gayan Perera CLA
Modified: 2022-06-12 08:22 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 Gayan Perera CLA 2020-06-18 15:38:56 EDT
Given the code
String[] leftArguments = t.getTypeParameterSignatures();
Stream.of(leftArguments).filter(s -> s.endsWith("Ljava.lang.Object;")).findFirst().va;

Ends up

String[] leftArguments = String[] typeParameterSignatures = t.getTypeParameterSignatures();
Stream.of(leftArguments).filter(s -> s.endsWith("Ljava.lang.Object;")).findFirst();;


The quick fix assignment works fine.
Comment 1 Roland Grunberg CLA 2020-06-18 16:09:09 EDT
Yup, I see pretty much the same behaviour. I think the difference is that the way postfix completion is set up to work involves JDT Core having to recover statements when things like '.var' are present. However, when you activate the quickfix, the sources are valid and the statements are present.

I wonder if we can keep track of 2 ASTs. The current one that represents the state of the source, and one that represents the code prior to '.var' having been typed. This way we can use the first AST for actually determining proper offsets, but we use the 2nd AST to compute the data we need.
Comment 2 Eclipse Genie CLA 2022-06-12 08:22:47 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.