Skip to content

Faulty Content Assist Within Blocks #21

@HeikoKlare

Description

@HeikoKlare

Issue: eclipse-jdt/eclipse.jdt.core#1770

Current Behavior

Under specific conditions, content assist provides proposals as expected in the context. Consider the following code:

public boolean doIt() {
	while (true) {
		Integer i = 0;
		i.
		((Object)i).getClass();	
	}
}

Opening auto-completion proposal after the i. does not provide content assist for i but for its context:

Image

The conditions for this problems I found so far are as follows:

  • Be inside a block, such as a condition block or a loop block
  • The line after the incomplete line, in which content assist shall be used, starts with a cast

Expected Behavior

The content assist should provide the methods of i as proposals, same as when one of the conditions above is not fulfilled. For example:

public boolean doIt() {
	Integer i = 0;
	i.
	((Object)i).getClass();	
}

shows:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA Derivation of Expected BehaviorJDTIssues for JDT

    Type

    No type

    Projects

    Status

    🔖 Ready: Atomic

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions