1
2
3
4
5
6
7
8
9
10 package com.puppycrawl.tools.checkstyle.checks.blocks.rightcurly;
11
12 public class InputRightCurlyTestOptionAlone {
13
14 private int a;
15 private static int b;
16 { a = 2; }
17 static { b = 3; }
18
19 void method1() {
20 Thread t = new Thread() {@Override public void run() {
21 int a; int b;}
22 };
23 }
24
25 void method2(java.util.HashSet<String> set) {
26 java.util.Map<String, String> map1 = new java.util.LinkedHashMap<String, String>() {{
27 put("Hello", "World");
28 put("first", "second");
29 put("polygene", "lubricants");
30 put("alpha", "betical");}
31 };
32
33 java.util.Map<String, String> map2 = new java.util.LinkedHashMap<String, String>() {{
34 put("Hello", "World");
35 put("first", "second");
36 put("polygene", "lubricants");
37 put("alpha", "betical");
38 }};
39 }
40
41 void method3() {
42 method2(new java.util.HashSet<String>() {{
43 add("XZ13s");
44 add("AB21/X");
45 add("YYLEX");
46 add("AR5E");
47 }});
48 }
49
50 int method4(int a) {
51 if (a>2) a*=10; return ++a; }
52
53 void method5(int a) {
54 while (a > 5) { a--; }
55
56 if (a > 4) { a++; }
57
58 do {a--;} while (a > 3);
59
60 for (int i = 1; i < 10; i++) { byte b = 10; }
61
62 if (a < 2) { --a; } else if (a > 3) { a++; }
63
64 java.util.List<String> list = new java.util.ArrayList<>();
65 list.stream()
66 .filter(e -> {return !e.isEmpty() && !"null".equals(e);} )
67 .collect(java.util.stream.Collectors.toList());
68 }
69
70 void method6(int a) {
71 java.util.Map<String, String> map3 = new java.util.LinkedHashMap<String, String>() {{
72 put("Hello", "World");
73 put("first", "second");
74 put("polygene", "lubricants");
75 }{};
76 };
77 }
78
79 public @interface TestAnnotation {}
80
81 public @interface TestAnnotation1{ String value(); }
82
83 public @interface TestAnnotation2 {
84 String value();}
85
86 public @interface TestAnnotation3 {
87 String value();
88 }
89
90 public @interface TestAnnottation4 { String value();
91 }
92
93 interface Interface1
94 {
95 int i = 1;
96 public void meth1(); }
97
98 interface Interface2
99 { int i = 1; public void meth1(); }
100
101 interface Interface3 {
102 void display();
103 interface Interface4 {
104 void myMethod();
105 }}
106 }