View Javadoc
1   /*
2   NeedBraces
3   allowSingleLineStatement = true
4   allowEmptyLoopBody = (default)false
5   tokens = LAMBDA
6   
7   
8   */
9   
10  package com.puppycrawl.tools.checkstyle.checks.blocks.needbraces;
11  
12  public class InputNeedBracesTestSingleLineLambda {
13  
14      static Runnable r1 = ()->String.CASE_INSENSITIVE_ORDER.equals("Hello world one!");
15      static Runnable r2 = () -> String.CASE_INSENSITIVE_ORDER.equals("Hello world two!");
16      static Runnable r3 = () -> // violation ''->' construct must use '{}'s'
17          String.CASE_INSENSITIVE_ORDER.equals("Hello world two!");
18      static Runnable r4 = () -> {String.CASE_INSENSITIVE_ORDER.equals("Hello world two!");};
19      Runnable r5 = () -> java.util.Objects.hash(1, 2, // violation ''->' construct must use '{}'s'
20          3,4);
21      Runnable r6 = () -> {java.util.Objects.hash(1, 2,
22          3,4);};
23      {
24          // violation below ''->' construct must use '{}'s'
25          java.util.concurrent.CompletableFuture.runAsync(() -> System.out.println(
26              (Runnable) () -> System.out.println( // violation ''->' construct must use '{}'s'
27                  123)));
28      }
29      {
30          java.util.concurrent.CompletableFuture.runAsync(() -> {System.out.println(
31              (Runnable) () -> {System.out.println(
32                  123);});});
33      }
34  }