Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incomplete variable declaration not well recovered #1038

Closed
mickaelistria opened this issue Dec 9, 2024 · 2 comments
Closed

Incomplete variable declaration not well recovered #1038

mickaelistria opened this issue Dec 9, 2024 · 2 comments

Comments

@mickaelistria
Copy link

mickaelistria commented Dec 9, 2024

Inspired from CompletionContextTests.test0136

public class X {
  public void foo() {
    final ZZZZ
  }
}

is recovered "weakly" to DOM as

package test;
public class X {
  public void foo(){
  }
}

without variable, while Javac has

package test;

public class X {
    
    public void foo() {
        final ZZZZ <error>;
    }
}

It would be good to recover the Variable Declaration better.

@robstryker
Copy link

@mickaelistria
Copy link
Author

It's indeed quite possible. The reason why some extra checks were added to remove some DOM node is because sometimes, Lombok or other can dynamically add non-existing node to the DOM and the best way I had found so far is checking some index condition. The conditions may not be good enough and may exclude some valid-ish nodes.
I hope the conditions can be refined to work for both excluding Lombok and including such erroneous node.

datho7561 pushed a commit that referenced this issue Dec 13, 2024
Signed-off-by: Rob Stryker <stryker@redhat.com>
mickaelistria pushed a commit that referenced this issue Dec 15, 2024
Signed-off-by: Rob Stryker <stryker@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants