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

Added semicolon test for Java parser #4565

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

rlsanders4
Copy link

What's changed?

This adds a new unit test to JavaParserTest that validates that the parser is working correctly when a simicolon is specified directly after the final bracket in a method declaration.

What's your motivation?

A semicolon specified in this manner is unnecessary, but it is still valid Java code. The parser is currently unable to parse this, and the unit test gives the following error:

Source file was parsed into an LST that contains non-whitespace characters in its whitespace. This is indicative of a bug in the parser. 
public class Test {
  public static void myMethod() {
  }~~(non-whitespace)~~>;
<~~}

Checklist

  • I've added unit tests to cover both positive and negative cases
  • I've read and applied the recipe conventions and best practices
  • I've used the IntelliJ IDEA auto-formatter on affected files

@timtebeek timtebeek added the bug Something isn't working label Oct 27, 2024
@timtebeek
Copy link
Contributor

Thanks again for reporting this issue @rlsanders4 ; logging some useful context from Slack here as well:

I believe mapping these semicolons to J.Empty statements would be the correct course of action.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working parser-java
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

2 participants