tree-sitter-java
tree-sitter-java copied to clipboard
`local_variable_declaration` is generated instead of method declaration/definition
Problem description
Consider the following file:
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Retention;
import org.junit.Test;
import org.junit.runners.JUnit4;
/** @author [email protected] (Liam Miller-Cushon) */
@RunWith(JUnit4.class)
public class SuggestedFixesTest {
/** Edit modifiers type. */
@Retention(RUNTIME)
public @interface EditModifiers {
String[] value() default {};
EditKind kind() default EditKind.ADD;
/** Kind of edit. */
enum EditKind {
ADD,
REMOVE
}
}
@Test
public void addAtBeginningOfLine() {
}
}
Expected parse tree output (optional)
Parse tree without ERROR nodes
Actual parse tree output (optional)
constant_declarationhas ERROR child node instead ofidentifier.local_variable_declarationwith a fake ';' child node is generated instead of a method definition node foraddAtBeginningOfLine(looks like this error is induced by error # 1).- ERROR node as the parent of
formal_parametersnode foraddAtBeginningOfLinemethod ((looks like this error is induced by error # 1).
Notes
I realize that the code snippet above can be further minimized.