Skip to content

Empty arguments don't get interpreted correctly #17

Open

Description

@CreepyCre

javascript_identifier_ has args.length = 1, while
javascript_identifier_, has args.length = 0

javascript_identifier_,,somevalue has args.length = 3, while
javascript_identifier_somevalue,, has args.length = 1

Expected behaviour would be that args.length = amount of commas + 1 in every case. It seems that it will only parse arguments until the last argument with a non empty string. Empty arguments should be arguments as well for consistency.

Activity

  1. BlitzOffline commented on Aug 30, 2021

    @BlitzOffline
    Member

    I believe every argument that is empty should or is skipped. Or at least that's what this line is telling me.

  2. CreepyCre commented on Aug 30, 2021

    @CreepyCre
    Author

    The individual args ending up as null is not an issue here, it will not influence the length.
    The actual cause is located here.
    If you check the javadocs for String#split, you will see that without specifying a limit it will default to 0, which will drop any trailing empty Strings. The solution here is to use any negative integer as the limit.

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