File tree Expand file tree Collapse file tree 1 file changed +65
-0
lines changed
src/test/java/org/openrewrite/staticanalysis Expand file tree Collapse file tree 1 file changed +65
-0
lines changed Original file line number Diff line number Diff line change @@ -120,4 +120,69 @@ int world(int i) {
120
120
""" ));
121
121
}
122
122
123
+ @ Test
124
+ void notChangingLambdas () {
125
+ //language=java
126
+ rewriteRun (
127
+ java (
128
+ """
129
+ class Hello {
130
+ java.util.function.Consumer<Integer> c = i -> {
131
+ return;
132
+ };
133
+ }
134
+ """ ));
135
+ }
136
+
137
+ @ Test
138
+ void notChangingLoops () {
139
+ //language=java
140
+ rewriteRun (
141
+ java (
142
+ """
143
+ class Main {
144
+ public static void main(String[] argv) {
145
+ while (true) {
146
+ return;
147
+ }
148
+ }
149
+ }
150
+ """ ));
151
+ }
152
+
153
+ @ Test
154
+ void newClass () {
155
+ //language=java
156
+ rewriteRun (
157
+ java (
158
+ """
159
+ import java.util.concurrent.Callable;
160
+ class Hello {
161
+ Callable<String> callable = new Callable<>() {
162
+ @Override
163
+ public String call() throws Exception {
164
+ otherMethod();
165
+ return "success";
166
+ }
167
+ private void otherMethod() {
168
+ return;
169
+ }
170
+ };
171
+ }
172
+ """ ,
173
+ """
174
+ import java.util.concurrent.Callable;
175
+ class Hello {
176
+ Callable<String> callable = new Callable<>() {
177
+ @Override
178
+ public String call() throws Exception {
179
+ otherMethod();
180
+ return "success";
181
+ }
182
+ private void otherMethod() {
183
+ }
184
+ };
185
+ }
186
+ """ ));
187
+ }
123
188
}
You can’t perform that action at this time.
0 commit comments