View Javadoc
1   /*
2   LeftCurly
3   option = eol
4   ignoreEnums = (default)true
5   tokens = (default)ANNOTATION_DEF, CLASS_DEF, CTOR_DEF, ENUM_CONSTANT_DEF, \
6            ENUM_DEF, INTERFACE_DEF, LAMBDA, LITERAL_CASE, LITERAL_CATCH, \
7            LITERAL_DEFAULT, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, \
8            LITERAL_IF, LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, \
9            METHOD_DEF, OBJBLOCK, STATIC_INIT, RECORD_DEF, COMPACT_CTOR_DEF
10  
11  
12  */
13  
14  package com.puppycrawl.tools.checkstyle.checks.blocks.leftcurly;
15  
16  import java.io.IOException;
17  import java.util.HashSet;
18  import java.util.Set;
19  import java.util.regex.Pattern;
20  
21  public class InputLeftCurlyCommentBeforeLeftCurly {
22  
23      void method1 ()
24      /* violation not reported */ { } // ok until #11410
25  
26      InputLeftCurlyCommentBeforeLeftCurly()
27      /* I am comment */ { // ok until #11410
28          System.out.println("Hello CheckStyle");
29      }
30  
31      InputLeftCurlyCommentBeforeLeftCurly(String name)
32      { // violation ''{' at column 5 should be on the previous line'
33          System.out.println("I am int" + name);
34      }
35  
36      private void some() throws Exception {
37          try {
38              throw new IOException();
39          } catch (IOException | NullPointerException | ArithmeticException ex)
40           /* warn */ { // ok until #11410
41          }
42      }
43  
44      public void multipleBlock()
45      /*CheckStyle*/ /* Checkstyle*/ { // ok until #11410
46      }
47  
48      private class Node {
49          int value;
50          Node next;
51  
52          public
53              /**** comment **********/ Node(int value) /*comment*/ {
54              this.value=value;
55          }
56  
57          public Node(int value, Node next)
58          /*********** comment ****/ { // ok until #11410
59              this.value = value;
60              this.next = next;
61          }
62      }
63  
64      public void array() {
65          Integer[] array = null;
66          /*50*/ for/*51*/ (/*52*/Integer/*53*/ i/*54*/:/*55*/ array/*56*/)/*57*/ {/*58*/
67              /*59*/
68          }/*60*/
69      }
70  }
71  
72  class checks implements check
73          /* CheckStyle */ { // ok until #11410
74  
75      public static Set<String> processJavadocTag() {
76          final Set<String> references = new HashSet<>();
77          final String identifier = references.toString();
78          for (Pattern pattern : new Pattern[]
79                  {Pattern.compile(".*"), Pattern.compile(".*")}) {
80  
81          }
82          return references;
83      }
84  
85      class C {
86          void method1 ()
87              /* 😂🥳 */ { } // ok until #11410
88  
89          void method2 ()
90          /* 🥳🥳🥳🥳 */ /* 🥳🥳🥳🥳🥳 */ { } // ok until #11410
91          }
92  
93      private void method() {
94          String b = "🧐🧐🧐ccvb";
95          if (b.equals("🧐🧐")) {
96  
97          }
98          if (b.equals("s🧐d🧐a")) {
99          }
100 
101         while (b == "😂🥳") { /* ok */ }
102     }
103 }
104 
105 interface check {
106 }
107 
108 /*15*/ class /*16*/InputAstTreeStringPrinterFullOfBlockComments /*49*/{/*17*/
109     /*1*/public/*2*/ static/**/ String/*2*/ main/*2*/(/*4*/String/*2*/[/*2*/]/*2*/ args/*2*/)/**/ {
110         /*31*/String /*32*/line /*33*/= /*34*/"/*I'm NOT comment*/blabla"/*35*/;/*36*/
111         /*3*/String/*8*/.CASE_INSENSITIVE_ORDER/*0*/./*1*/equals/*2*/(/*3*/line/*4*/)/*4*/;/*6*/
112         Integer[] array = null;
113         /*50*/for/*51*/ (/*52*/Integer/*53*/ i/*54*/:/*55*/ array/*56*/)/*57*/ {/*58*/
114         }/*60*/
115         return line;
116     }/*47*/
117 }/*48*/