Bug 574704 - [content assist] incomplete content assist before cast
Summary: [content assist] incomplete content assist before cast
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.20   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: 4.21 M2   Edit
Assignee: Stephan Herrmann CLA
QA Contact:
URL:
Whiteboard:
Keywords: regression
Depends on:
Blocks: 574913
  Show dependency tree
 
Reported: 2021-07-07 04:36 EDT by Julian Honnen CLA
Modified: 2021-08-19 02:47 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 Julian Honnen CLA 2021-07-07 04:36:05 EDT
In a conditional block, immediately before a cast expression content assist is incomplete:

public class Cast {

	Object field;

	void test(Object o) {
		if (true) {
			| // content assist here does not offer o or field
			((String) o).toCharArray();
		}
	}
}

Without the conditional block or after the cast, content assist correctly offers o and field.


Tested in 
Version: 2021-09 (4.21)
Build id: I20210629-1800

4.19 works correctly.
Comment 1 Andrey Loskutov CLA 2021-07-07 05:11:00 EDT
Yep, I see it in I20210706-1800 too, that contains bug 574267 fix.
Comment 2 Eclipse Genie CLA 2021-07-08 13:38:35 EDT
New Gerrit change created: https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/182908
Comment 3 Stephan Herrmann CLA 2021-07-08 13:45:49 EDT
(In reply to Eclipse Genie from comment #2)
> New Gerrit change created:
> https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/182908

The cast was parsed as the argument of a message send (empty selector). Let's simply detect this situation and switch to proposing any variables or methods as an assumed statement start.
Comment 5 Stephan Herrmann CLA 2021-07-11 08:56:01 EDT
(In reply to Eclipse Genie from comment #4)
> Gerrit change https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/182908 was
> merged to [master].
> Commit:
> http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/
> ?id=1131b538846df83fffb032675cb8fcf50e2ae90e

Released to master for 4.21 M2

Thanks, Julian, for reporting.
Comment 6 Manoj N Palat CLA 2021-08-19 02:47:06 EDT
Verified with Eclipse 4.21 M3 Version: 2021-09 (4.21) Build id: I20210818-1800