Formatting code with intellij plugin and using the jar gives different results
@plumpy arbeitet bereits daran.
Seit 23.2.2021.
Bewertung
Dieses Issue wurde noch nicht bewertet.
Beschreibung
If I format the following file using the intellij plugin (IDE version: Ultimate 2020.2.4 / plugin version: google-java-format 1.9.0.0. ) I get different result when compared to using the jar on the command line.
original example file:
package x;
public class test2 {
static final String LONG_STRING = "This is a long string that makes the total line length for this line over 100 characters";
static final String ANOTHER_LONG_STRING =
"This is another long string but this line is under 100 characters "
+ "and this line is also under 100 characters "
+ "but this line is over 100 characters and will not be reformatted to under 100 characters using the intellij plugin but will be reformatted to under 100 characters using the jar.";
public test2() {
int x=1;if(x==1){x=2;}else{x=3;}
}
}
after formatting using intellij plugin (using menu code / reformat code) I get this:
package x;
public class test2 {
static final String LONG_STRING =
"This is a long string that makes the total line length for this line over 100 characters";
static final String ANOTHER_LONG_STRING =
"This is another long string but this line is under 100 characters "
+ "and this line is also under 100 characters "
+ "but this line is over 100 characters and will not be reformatted to under 100 characters using the intellij plugin but will be reformatted to under 100 characters using the jar.";
public test2() {
int x = 1;
if (x == 1) {
x = 2;
} else {
x = 3;
}
}
}
And after formatting on the command line:
/tmp $ java -version
openjdk version "11.0.9" 2020-10-20
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.9+11)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.9+11, mixed mode)
/tmp $ cksum ~/lib/google-java-format-1.9-all-deps.jar
2002751029 3404610 ~/lib/google-java-format-1.9-all-deps.jar
/tmp $ java -jar ~/lib/google-java-format-1.9-all-deps.jar ./test2.java
I get this:
package x;
public class test2 {
static final String LONG_STRING =
"This is a long string that makes the total line length for this line over 100 characters";
static final String ANOTHER_LONG_STRING =
"This is another long string but this line is under 100 characters and this line is also"
+ " under 100 characters but this line is over 100 characters and will not be"
+ " reformatted to under 100 characters using the intellij plugin but will be"
+ " reformatted to under 100 characters using the jar.";
public test2() {
int x = 1;
if (x == 1) {
x = 2;
} else {
x = 3;
}
}
}
- Vorherrschende Sprache
- Java
- Sterne
- 6.2k
- Forks
- 936
- Ø Merge
- 6 Min.
- Gemergte PRs (30 T.)
- 3
Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus google/google-java-format
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
google/google-java-format#1094 · 1 Kommentar ·
-
Complementary Teamups Offen
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 15/100
google/google-java-format#1450 · 1 Reaktion ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 55/100
google/google-java-format#1439 · 1 Kommentar ·
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 62/100
google/google-java-format#1436 · 2 Kommentare ·
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 48/100
google/google-java-format#1428 · 4 Kommentare ·
Alle Issues in google/google-java-format
Ähnliche Issues
-
executions.Query — startDate and timeRange filters are sent with inverted comparison operators Offenarea/plugin
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
kestra-io/plugin-kestra#190 ·
-
litertlm-android AAR ships no consumer ProGuard rules → "mid == null" SIGABRT in minified apps Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
google-ai-edge/LiteRT-LM#3739 ·
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
integra-team-red/meet-map#249 ·
-
[Studio][Bug] Cancelled create-user dialog keeps the password and admin switch for the next attempt Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
apache/rocketmq-dashboard#5064 ·