Skip to content

Stream chained method call doesn't show up in the AST when there are compiler problems after it #4530

@jjohnstn

Description

@jjohnstn

For the following code:

package tests;

import java.util.List;
import java.util.stream.Stream;

public class TestPostCompletion {
	
	public static void main(String[] args, List<String> x) {
		int a = 4;
		Stream.iterate(0,i -> ++i).limit(10);
		"String".var
	}
}

which is attempting to do a Post completion for "String", the AST viewer is only showing one statement for the block under main and it is the "int a = 4;". It is not attempting any recovery for the "String".var and not showing the ExpressionStatement that precedes it. There shouldn't be any confusion because it is a complete statement with semi-colon. When the Post completion tries to find the best location, it finds the declaration of a and tries to add another in the middle (invalid code).

If the Stream statement is removed, the block now shows 2 statements with the "String".var being recovered and Post completion works because it can find the "String" node to turn into a statement declaration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions