prettier breaks try-with-resource with multiple assignment
See original GitHub issueApplying prettier-java to https://github.com/yegor256/cactoos/blob/master/src/main/java/org/cactoos/io/BytesOf.java gives me the following diff which doesn’t compile anymore:
@@ -297,17 +299,19 @@ public final class BytesOf implements Bytes {
* @param charset Charset
* @since 0.29
*/
- public BytesOf(final StackTraceElement[] strace,
- final CharSequence charset) {
+ public BytesOf(
+ final StackTraceElement[] strace,
+ final CharSequence charset
+ ) {
this(
() -> {
- try (
- final ByteArrayOutputStream baos =
- new ByteArrayOutputStream();
- final PrintStream stream = new PrintStream(
- baos, true, charset.toString()
- )
- ) {
+ try (final ByteArrayOutputStream baos = new ByteArrayOutputStream(
+
+ )final PrintStream stream = new PrintStream(
+ baos,
+ true,
+ charset.toString()
+ )){
for (final StackTraceElement element : strace) {
stream.append(element.toString());
stream.append("\n");
It seems that a ;
is lost in the process.
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Rationale - Prettier
Prettier collapses multiple blank lines into a single blank line. Empty lines at the start and end of blocks (and whole files) are...
Read more >Is it okay to use try catch inside finally? - Stack Overflow
A somewhat nicer way to do this is to use IOUtils.closeQuiety from Apache commons-io. It keeps your code tidy and eliminates some of...
Read more >Modularization - Javet 2.0.2 documentation
Usually the Java application working directory doesn't contain node_modules . That for sure breaks Node.js. No worry, here are the steps on closing...
Read more >warning | The Object Teams Blog
On the other hand, any value can be assigned to a legacy variable (or method ... Unfortunately, the legacy method printNames() succeeded to...
Read more >Spring Data JDBC - Reference Documentation
The recommended way to do that is a try-with-resource clause . ... of the domain objects without worrying about breaking existing queries.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi.
I am playing around with re-writing the project (or parts of). see: https://github.com/jhipster/prettier-java/pull/109 and #107 #108
So if that track succeeds this issue may become irrelevant (and the other open bugs too). But that does not conflict with diving into the current code base and fixing existing bugs if that interests you. 😄
@misino your point being? Finding bugs is the first step to improve a software, even before fixing the bugs, everybody participates how he can.