-
Notifications
You must be signed in to change notification settings - Fork 724
Expand file tree
/
Copy pathExtractSetterPropertiesTestData.java
More file actions
114 lines (92 loc) · 2.48 KB
/
ExtractSetterPropertiesTestData.java
File metadata and controls
114 lines (92 loc) · 2.48 KB
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
package checks.spring.s6856;
import lombok.Data;
import lombok.Setter;
class ExtractSetterPropertiesTestData {
// Class with explicit setters
static class ExplicitSetters {
private String name;
private int age;
private boolean active;
public void setName(String name) {
this.name = name;
}
public void setAge(int age) {
this.age = age;
}
public void setActive(boolean active) {
this.active = active;
}
// Not a setter - has wrong return type
public String setInvalid(String value) {
return value;
}
// Not a setter - has no parameters
public void setEmpty() {
}
// Not a setter - has multiple parameters
public void setMultiple(String a, String b) {
}
// Not a setter - is private
private void setPrivate(String value) {
}
// Not a setter - is static
public static void setStatic(String value) {
}
}
// Class with Lombok @Data (generates setters for all non-final fields)
@Data
static class LombokData {
private String project;
private int year;
private String month;
private final String constant = "CONST"; // Should be excluded (final)
private static String staticField; // Should be excluded (static)
}
// Class with Lombok @Setter at class level
@Setter
static class LombokClassLevelSetter {
private String firstName;
private String lastName;
private final String id = "ID"; // Should be excluded (final)
private static int count; // Should be excluded (static)
}
// Class with Lombok @Setter at field level
static class LombokFieldLevelSetter {
@Setter
private String email;
@Setter
private int score;
private String noSetter; // No @Setter, should be excluded
private static String staticField; // Should be excluded (static)
}
// Mixed: explicit setters + Lombok field-level @Setter
static class MixedSetters {
@Setter
private String lombokField;
private String explicitField;
public void setExplicitField(String value) {
this.explicitField = value;
}
}
// Class with no setters
static class NoSetters {
private String field;
public String getField() {
return field;
}
}
// Empty class
static class EmptyClass {
}
// Class with only getters
static class OnlyGetters {
private String name;
private int age;
public String getName() {
return name;
}
public int getAge() {
return age;
}
}
}