google / google/google-java-format

Inconsistency between indent level in AOSP and non-aosp

Ouverte
#1,189 2 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Java
Étoiles
6.2k
Forks
937
Merge moyen
6 min
PR mergées (30 j)
3

Description

I am not entirely sure wether this is the intended behavior, so here is an issue. The the continuation of the long string doesn't indent with 8 spaces from the previous line which I would expect in AOSP.

Test.java
```java
public class Test {
String s = "asdfasdfasdfasdf asdfasdfasdfasdfasdfasdffasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasd";
}
```

```bash
❯ java -jar ~/Downloads/google-java-format-1.24.0-all-deps.jar Test.java
public class Test {
String s =
"asdfasdfasdfasdf"
+ " asdfasdfasdfasdfasdfasdffasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasd";
}
```

```bash
❯ java -jar ~/Downloads/google-java-format-1.24.0-all-deps.jar --aosp Test.java
public class Test {
String s =
"asdfasdfasdfasdf"
+ " asdfasdfasdfasdfasdfasdffasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasd";
}
```

I would expect the following output using AOSP style

```java
public class Test {
String s =
"asdfasdfasdfasdf"
+ " asdfasdfasdfasdfasdfasdffasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasd";
}
```

I raised this issue in the spotless repo because I figured that spotless not indenting the same way as GJF would be a spotless bug.

If this is the intended behavior, please let me know, so that I can reraise the issue at spotless.

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.