comment after class that has implements cause wrong indentation
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
Research direction
Start by reproducing the issue with the provided Test.java input and google-java-format-1.23.0-all-deps.jar command. Trace the formatter path handling a trailing comment after the class declaration, then add coverage for this example and verify that implements is indented by four spaces and the original structure is preserved.
Written by the indexing model from the issue text.
Description
Indention of implements becomes 0, but should be +4 (as it is line wrap) from 0, so 4.
$ cat Test.java
/** Tetsing. */
public class Test // comment
implements Runnable, Cloneable {
}
$ java -jar google-java-format-1.23.0-all-deps.jar Test.java > TestUpdated.java
$ diff -u Test.java TestUpdated.java
--- Test.java 2024-07-31 06:29:22.086232824 -0700
+++ TestUpdated.java 2024-07-31 06:33:39.001224613 -0700
@@ -1,5 +1,3 @@
/** Tetsing. */
public class Test // comment
- implements Runnable, Cloneable {
-
-}
+implements Runnable, Cloneable {}
$ cat TestUpdated.java
/** Tetsing. */
public class Test // comment
implements Runnable, Cloneable {}
Workaround is to remove trailing comment
but better to handle/format it eventually in proper way.
- Dominant language
- Java
- Stars
- 6.2k
- Forks
- 936
- Avg merge
- 6m
- Merged PRs (30d)
- 3
Getting set up
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from google/google-java-format
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
google/google-java-format#1094 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 15/100
google/google-java-format#1450 · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
google/google-java-format#1439 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 62/100
google/google-java-format#1436 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
google/google-java-format#1428 · 4 comments ·
Maintainers usually reply within 1 day
All issues in google/google-java-format
Similar issues
-
TerminalRow.mSpaceUsed (short) overflows on terminals wider than 1023 columns, crashing setCharOpen
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
termux/termux-app#5340 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
apache/rocketmq-dashboard#5110 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Maintainers usually reply within 4 days
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
TS2502 in shipped .d.ts: `compileHighlightConfig` parameter shadows the de-aliased `Query` typeOpenbug javascript
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day