blob: 21655632852ed921614629f72cccc11e3b6e82ce (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
package com.puppycrawl.tools.checkstyle.checks.blocks;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class InputRightCurlySameLambda {
static Runnable r1 = () -> {
String.valueOf("Test rightCurly one!");
};
static Runnable r2 = () -> String.valueOf("Test rightCurly two!");
static Runnable r3 = () -> {String.valueOf("Test rightCurly three!");};
static Runnable r4 = () -> {
String.valueOf("Test rightCurly four!");}; //violation
static Runnable r5 = () ->
{
String.valueOf("Test rightCurly five!");
};
static Runnable r6 = () -> {};
static Runnable r7 = () -> {
};
static Runnable r8 = () ->
{
};
static Runnable r9 = () -> {
String.valueOf("Test rightCurly nine!");
}; int i; // violation
void foo1() {
Stream.of("Hello").filter(s -> {
return s != null;
} // violation
).collect(Collectors.toList());
Stream.of("Hello").filter(s -> {
return s != null;
}).collect(Collectors.toList());
Stream.of("Hello").filter(s -> {return s != null;})
.collect(Collectors.toList());
Stream.of("Hello").filter(s -> {return s != null;}).collect(Collectors.toList());
Stream.of("Hello").filter(s -> {
return s != null;}).collect(Collectors.toList()); // violation
bar(() -> {return;}, () -> {return;});
bar(() -> {
return;
}, () -> {return;});
bar(() -> {
return;
}, () -> {
return;
});
bar(() -> {
return;}, () -> {return;}); // violation
bar(() -> {
return;
}, () -> {
return;}); // violation
}
void bar(Runnable r1, Runnable r2) { }
}
|