Title: Running with --replace does not converge · Issue #562 · google/google-java-format · GitHub
Open Graph Title: Running with --replace does not converge · Issue #562 · google/google-java-format
X Title: Running with --replace does not converge · Issue #562 · google/google-java-format
Description: I'm trying to integrate this tool into my codebase at work, and I came across a curious situation where google-java-format will always add an empty comment. This is probably better shown than explained, so here's a minimal reproduction: ...
Open Graph Description: I'm trying to integrate this tool into my codebase at work, and I came across a curious situation where google-java-format will always add an empty comment. This is probably better shown than expla...
X Description: I'm trying to integrate this tool into my codebase at work, and I came across a curious situation where google-java-format will always add an empty comment. This is probably better shown than e...
Opengraph URL: https://github.com/google/google-java-format/issues/562
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Running with --replace does not converge","articleBody":"I'm trying to integrate this tool into my codebase at work, and I came across a curious situation where `google-java-format` will always add an empty comment. This is probably better shown than explained, so here's a minimal reproduction:\r\n\r\n```sh\r\n$ java -version\r\nopenjdk version \"11.0.9.1\" 2020-11-04\r\nOpenJDK Runtime Environment (build 11.0.9.1+1-Ubuntu-0ubuntu1.18.04)\r\nOpenJDK 64-Bit Server VM (build 11.0.9.1+1-Ubuntu-0ubuntu1.18.04, mixed mode, sharing)\r\n\r\n$ java -jar /tmp/google-java-format-all-deps.jar -version\r\ngoogle-java-format: Version 1.9\r\n\r\n$ cat /tmp/GoogleJavaFormatTest.java # the original\r\npublic class GoogleJavaFormatTest {\r\n //String testString = \" thisisnotaHYPERLINKandsoitshouldntbetruncatedinststeaditshouldbedropppedthisisnotaHYPERLINKandsoitshouldntbetruncatedinststeaditshouldbedropppedthisisnotaHYPERLINKandsoitshouldntbetruncatedinststeaditshouldbedropppedthisisnotaHYPERLINKandsoitshouldntbetruncatedinststeaditshouldbedroppped \\\"http://www.google.com/imgres?imgurl=http://www.mancusogroup.com/images/war%0d%0aehouse_icon.gif&imgrefurl=http://www.mancusogroup.com/&h=60&w=60&%0d%0a;sz=0&tbnid=LvtwKa3nug4J::&tbnh=60&tbnw=60&prev=/images%3Fq%3DWA%0d%0aREHOUSE%2BICON&hl=en&usg=startingfromherestuffshouldstarttobetruncatedandremoved\\\"http://www.mancusogroup.com/\";\r\n}\r\n\r\n$ java -jar /tmp/google-java-format-all-deps.jar --replace /tmp/GoogleJavaFormatTest.java\r\n$ cat /tmp/GoogleJavaFormatTest.java \r\npublic class GoogleJavaFormatTest {\r\n // String testString = \"\r\n // thisisnotaHYPERLINKandsoitshouldntbetruncatedinststeaditshouldbedropppedthisisnotaHYPERLINKandsoitshouldntbetruncatedinststeaditshouldbedropppedthisisnotaHYPERLINKandsoitshouldntbetruncatedinststeaditshouldbedropppedthisisnotaHYPERLINKandsoitshouldntbetruncatedinststeaditshouldbedroppped \\\"http://www.google.com/imgres?imgurl=http://www.mancusogroup.com/images/war%0d%0aehouse_icon.gif&imgrefurl=http://www.mancusogroup.com/&h=60&w=60&%0d%0a;sz=0&tbnid=LvtwKa3nug4J::&tbnh=60&tbnw=60&prev=/images%3Fq%3DWA%0d%0aREHOUSE%2BICON&hl=en&usg=startingfromherestuffshouldstarttobetruncatedandremoved\\\"http://www.mancusogroup.com/\";\r\n}\r\n\r\n$ java -jar /tmp/google-java-format-all-deps.jar --replace /tmp/GoogleJavaFormatTest.java\r\n$ cat /tmp/GoogleJavaFormatTest.java \r\npublic class GoogleJavaFormatTest {\r\n // String testString = \"\r\n //\r\n // thisisnotaHYPERLINKandsoitshouldntbetruncatedinststeaditshouldbedropppedthisisnotaHYPERLINKandsoitshouldntbetruncatedinststeaditshouldbedropppedthisisnotaHYPERLINKandsoitshouldntbetruncatedinststeaditshouldbedropppedthisisnotaHYPERLINKandsoitshouldntbetruncatedinststeaditshouldbedroppped \\\"http://www.google.com/imgres?imgurl=http://www.mancusogroup.com/images/war%0d%0aehouse_icon.gif&imgrefurl=http://www.mancusogroup.com/&h=60&w=60&%0d%0a;sz=0&tbnid=LvtwKa3nug4J::&tbnh=60&tbnw=60&prev=/images%3Fq%3DWA%0d%0aREHOUSE%2BICON&hl=en&usg=startingfromherestuffshouldstarttobetruncatedandremoved\\\"http://www.mancusogroup.com/\";\r\n}\r\n\r\n$ java -jar /tmp/google-java-format-all-deps.jar --replace /tmp/GoogleJavaFormatTest.java\r\n$ cat /tmp/GoogleJavaFormatTest.java \r\npublic class GoogleJavaFormatTest {\r\n // String testString = \"\r\n //\r\n //\r\n // thisisnotaHYPERLINKandsoitshouldntbetruncatedinststeaditshouldbedropppedthisisnotaHYPERLINKandsoitshouldntbetruncatedinststeaditshouldbedropppedthisisnotaHYPERLINKandsoitshouldntbetruncatedinststeaditshouldbedropppedthisisnotaHYPERLINKandsoitshouldntbetruncatedinststeaditshouldbedroppped \\\"http://www.google.com/imgres?imgurl=http://www.mancusogroup.com/images/war%0d%0aehouse_icon.gif&imgrefurl=http://www.mancusogroup.com/&h=60&w=60&%0d%0a;sz=0&tbnid=LvtwKa3nug4J::&tbnh=60&tbnw=60&prev=/images%3Fq%3DWA%0d%0aREHOUSE%2BICON&hl=en&usg=startingfromherestuffshouldstarttobetruncatedandremoved\\\"http://www.mancusogroup.com/\";\r\n}\r\n```\r\n\r\nAs you can see, each time I run with `--replace` is adds a new line just containing ` //\\n`. I have no idea why this particular string is breaking it -- I tried others and they didn't seem to break it.\r\n\r\nPlease let me know if there's any more information I can provide!","author":{"url":"https://github.com/kmurphy4","@type":"Person","name":"kmurphy4"},"datePublished":"2021-02-05T19:20:42Z","url":"https://github.com/google/google-java-format/issues/562"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:e15a7dc4-76a0-0393-5b82-845fd626f259 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DFCC:EDE7B:742DFB:9AFDDC:6AFBD035 |
| html-safe-nonce | f1c8c89c45b441e6eaf64407fd1041fc1c009ad55331d2ab784e209a7b9cfa52 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERkNDOkVERTdCOjc0MkRGQjo5QUZEREM6NkFGQkQwMzUiLCJ2aXNpdG9yX2lkIjoiMzA4MTc3NDA0NDY3Njg3MDE5NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | e65b830acb06ce856d299b14c3e55be367e4a8230298c99ad3ee273f0b1d4465 |
| hovercard-subject-tag | issue:802413357 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/google/google-java-format/562/issue_layout |
| twitter:image | https://opengraph.githubassets.com/edcffb1dbe7d13535aacc615a01b9ed73ea51da515cb3c2c62db5747406bb19f/google/google-java-format/issues/562 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/edcffb1dbe7d13535aacc615a01b9ed73ea51da515cb3c2c62db5747406bb19f/google/google-java-format/issues/562 |
| og:image:alt | I'm trying to integrate this tool into my codebase at work, and I came across a curious situation where google-java-format will always add an empty comment. This is probably better shown than expla... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | kmurphy4 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 18742cb872ec73544356e60359266b67aafece70c4ce008042e06227924cdd07 |
| turbo-cache-control | no-preview |
| go-import | github.com/google/google-java-format git https://github.com/google/google-java-format.git |
| octolytics-dimension-user_id | 1342004 |
| octolytics-dimension-user_login | |
| octolytics-dimension-repository_id | 35448780 |
| octolytics-dimension-repository_nwo | google/google-java-format |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 35448780 |
| octolytics-dimension-repository_network_root_nwo | google/google-java-format |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 820be804f18e1ef3940bd74a00d41d73d02e2b91 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width