Skip to content

Formatting failure with zero-width space #372

Closed

Description

@thaidn

Test case:

package test;

import com.google.common.util.concurrent.AtomicLongMap;

class Foo {
  AtomicLongMap<String> a = AtomicLongMap.create().getAndIncrement​("foo");
}

Error:

src/Test.java:6:30: error: expected token: 'getAndIncrement​'; generated getAndIncrement instead

Version:

google-java-format --version
google-java-format: Version 1.6

Activity

  1. cushon commented on May 18, 2019

    @cushon
    Collaborator

    If nothing else the formatter should be reported a better diagnostic here, but there's a zero-width space in that example getAndIncrement<200b>("foo"), which is disallowed by the style guide.

    Removing that character should allow the file to be formatted successfully.

  2. changed the title [-]Formatting failure[/-] [+]Formatting failure with zero-width space[/+] on Dec 19, 2019
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