Skip to content

Parsing error for annotations before spread parameter #205

Description

@theawless

Hi folks, thank you for creating this brilliant package! I was parsing some java code when I noticed some errors.

tree-sitter: 0.25.4
tree-sitter-java: 0.23.5

Sample code that is breaking:

public class B38203081 {
    void g(int @A [] @B ... xs) {
    }
}
program [0, 0] - [4, 0]
  class_declaration [0, 0] - [3, 1]
    modifiers [0, 0] - [0, 6]
      public [0, 0] - [0, 6]
    class [0, 7] - [0, 12]
    name: identifier [0, 13] - [0, 22]
    body: class_body [0, 23] - [3, 1]
      { [0, 23] - [0, 24]
      ERROR [1, 4] - [2, 5]
        void_type [1, 4] - [1, 8]
        identifier [1, 9] - [1, 10]
        ( [1, 10] - [1, 11]
        integral_type [1, 11] - [1, 14]
          int [1, 11] - [1, 14]
        marker_annotation [1, 15] - [1, 17]
          @ [1, 15] - [1, 16]
          name: identifier [1, 16] - [1, 17]
        [ [1, 18] - [1, 19]
        ] [1, 19] - [1, 20]
        marker_annotation [1, 21] - [1, 30]
          @ [1, 21] - [1, 22]
          name: scoped_identifier [1, 22] - [1, 30]
            scope: identifier [1, 22] - [1, 23]
            . [1, 24] - [1, 25]
            ERROR [1, 25] - [1, 27]
              . [1, 25] - [1, 26]
              . [1, 26] - [1, 27]
            name: identifier [1, 28] - [1, 30]
        ) [1, 30] - [1, 31]
        { [1, 32] - [1, 33]
        } [2, 4] - [2, 5]
      } [3, 0] - [3, 1]

This is a working java snippet https://ideone.com/83Nz5C and utilizes type use annotations https://docs.oracle.com/javase/tutorial/java/annotations/type_annotations.html which I believe is a rarely used feature.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions