question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

prettier breaks try-with-resource with multiple assignment

See original GitHub issue

Applying 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:closed
  • Created 5 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
bd82commented, Dec 10, 2018

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. 😄

1reaction
victornoelcommented, Oct 18, 2018

@misino your point being? Finding bugs is the first step to improve a software, even before fixing the bugs, everybody participates how he can.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found