View Javadoc
1   /*
2   RightCurly
3   option = ALONE_OR_SINGLELINE
4   tokens = CLASS_DEF, METHOD_DEF, LITERAL_IF, LITERAL_ELSE, LITERAL_DO, LITERAL_WHILE, \
5            LITERAL_FOR, STATIC_INIT, INSTANCE_INIT, ANNOTATION_DEF, ENUM_DEF, INTERFACE_DEF
6   
7   
8   */
9   
10  package com.puppycrawl.tools.checkstyle.checks.blocks.rightcurly;
11  
12  public class InputRightCurlyWithEmojiAloneOrSingleLine {
13      private String a;
14      private static String b;
15      {  a = "🧐😏"; }
16      static { b = "😧🀩"; }
17  
18  
19      void method2(java.util.HashSet<String> set) {
20          java.util.Map<String, String> map1 = new java.util.LinkedHashMap<String, String>() {{
21              put("Hello", "😧🀩");
22              put("😧🀩", "second" + "😧🀩");
23              put("polysa😧🀩gene", "lubricants");
24              put("alpha", "beticalπŸŽ„");} // violation ''}' at column 38 should be alone on a line.'
25          };
26  
27      }
28  
29      String method4(String a) {
30          if (a.equals("πŸŽ„")) ; return "πŸ˜†πŸ€©"; }
31      // violation above ''}' at column 43 should be alone on a line.'
32      void method5(String a, int b) {
33          while ("πŸ‘ˆπŸ»πŸ§".length() > 5) { ; }
34  
35          if ("πŸ‘‰πŸ»πŸ‘‰πŸΌ".isEmpty()) { ; }
36  
37          do {b--;} while (a.equals("🀩"));
38  
39          for (int i = 1; i < 10; i++) {
40              if("πŸŽ„πŸŽ„πŸŽ„".charAt(i) == 's') i++; }
41              // violation above ''}' at column 45 should be alone on a line.'
42          java.util.List<String> list = new java.util.ArrayList<>();
43          list.stream()
44                  .filter(e -> {return !e.isEmpty() && !"πŸ€©πŸŽ„".equals(e);} )
45                  .collect(java.util.stream.Collectors.toList());
46      }
47  
48      public void foo5() {
49  
50          do {
51              String a = new String("🀣🀣");} // violation ''}' at column 41 should be alone on a line.'
52          while (false);
53          if(true) {
54              String a = ("🀣🀣");} /*some*/ else{
55              // violation above''}' at column 31 should be alone on a line.'
56                  return;
57          }
58      }
59  }