View Javadoc
1   /*
2   LeftCurly
3   option = NLOW
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.lang.annotation.ElementType;
17  import java.lang.annotation.Target;
18  import java.util.ArrayList;
19  import java.util.List;
20  
21  @TestClassAnnotation
22  class InputLeftCurlyTestNlowWithAnnotations
23  { // violation ''{' at column 1 should be on the previous line'
24      private static final int X = 10;
25      @Override
26      public boolean equals(Object other)
27      { // violation ''{' at column 5 should be on the previous line'
28          return false;
29      }
30  
31      @Override
32      @SuppressWarnings("unused")
33      public int hashCode()
34      { // violation ''{' at column 5 should be on the previous line'
35          int a = 10;
36          return 1;
37      }
38  
39      @Override @SuppressWarnings({"unused", "unchecked", "static-access"}) public String toString()
40      { // violation ''{' at column 5 should be on the previous line'
41          Integer i = this.X;
42          List<String> l = new ArrayList();
43          return "SomeString";
44      }
45  }
46  
47  @TestClassAnnotation
48  class InputLeftCurlyAnnotations2TestNlowWithAnnotations {
49      private static final int X = 10;
50      @Override
51      public boolean equals(Object other) {
52          return false;
53      }
54  
55      @Override
56      @SuppressWarnings("unused")
57      public int hashCode() {
58          int a = 10;
59          return 1;
60      }
61  
62      @Override @SuppressWarnings({"unused", "unchecked", "static-access"}) public String toString()
63      { // violation ''{' at column 5 should be on the previous line'
64          Integer i = this.X;
65          List<String> l = new ArrayList();
66          return "SomeString";
67      }
68  
69      @Deprecated
70      @SuppressWarnings({"unused", "unchecked", "static-access"}) public String toString2()
71      { // violation ''{' at column 5 should be on the previous line'
72          Integer i = this.X;
73          List<String> l = new ArrayList();
74          return "SomeString";
75      }
76  }
77  
78  @Target(ElementType.TYPE)
79  @interface TestClassTestNlowWithAnnotation {
80  }