rewrite icon indicating copy to clipboard operation
rewrite copied to clipboard

Added semicolon test for Java parser

Open rlsanders4 opened this issue 1 year ago • 0 comments

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

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

rlsanders4 avatar Oct 10 '24 14:10 rlsanders4