Skip to content

Formatting of tabular array initializer confused by negative numbers  #400

Description

@andrewkreid

Negative numbers in the initializer of an array with tabular formatting makes google-java-format not preserve the layout.

$ cat T.java
package foo;

public class FormattingTester {

  private static final double[] flinePoints = {
    95.0, 75.0, 95.0, 75.0,
    95.0, 75.0, 95.0, 75.0
  };

  private static final double[] flinePoints2 = {
    95.0, 75.0, -95.0, 75.0,
    -95.0, 75.0, 95.0, 75.0
  };
}

$ java -jar ~/Downloads/google-java-format-1.7-all-deps.jar T.java
package foo;

public class FormattingTester {

  private static final double[] flinePoints = {
    95.0, 75.0, 95.0, 75.0,
    95.0, 75.0, 95.0, 75.0
  };

  private static final double[] flinePoints2 = {95.0, 75.0, -95.0, 75.0, -95.0, 75.0, 95.0, 75.0};
}

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