Skip to content

Commit 869e27f

Browse files
committed
Cleanup
1 parent 1300ee4 commit 869e27f

File tree

1 file changed

+29
-14
lines changed

1 file changed

+29
-14
lines changed

baseline-error-prone/src/test/java/com/palantir/baseline/errorprone/IllegalSafeLoggingLambdaTest.java

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -356,27 +356,42 @@ static void f(@Unsafe Object value) {
356356
void testLambdaConsumesSafetyAnnotatedType_expression() {
357357
helper().addSourceLines(
358358
"Test.java",
359-
"import com.palantir.logsafe.*;",
360-
"import java.util.function.*;",
361-
"class Test {",
362-
" // BUG: Diagnostic contains: Dangerous",
363-
" Consumer<@Unsafe String> func = in -> fun(in);",
364-
" void fun(@Safe Object ob) {}",
365-
"}")
359+
// language=Java
360+
"""
361+
import com.palantir.logsafe.*;
362+
import java.util.function.*;
363+
364+
class Test {
365+
// BUG: Diagnostic contains: Dangerous argument value:
366+
// arg is 'UNSAFE' but the parameter requires 'SAFE'.
367+
Consumer<@Unsafe String> func = in -> fun(in);
368+
369+
void fun(@Safe Object ob) {}
370+
}
371+
""")
366372
.doTest();
367373
}
368374

369375
@Test
370376
void testLambdaConsumesSafetyAnnotatedType_statement() {
371377
helper().addSourceLines(
372378
"Test.java",
373-
"import com.palantir.logsafe.*;",
374-
"import java.util.function.*;",
375-
"class Test {",
376-
" // BUG: Diagnostic contains: Dangerous",
377-
" Consumer<@Unsafe String> func = in -> { fun(in); };",
378-
" void fun(@Safe Object ob) {}",
379-
"}")
379+
// language=Java
380+
"""
381+
import com.palantir.logsafe.*;
382+
import java.util.function.*;
383+
384+
class Test {
385+
Consumer<@Unsafe String> func =
386+
in -> {
387+
// BUG: Diagnostic contains: Dangerous argument value:
388+
// arg is 'UNSAFE' but the parameter requires 'SAFE'.
389+
fun(in);
390+
};
391+
392+
void fun(@Safe Object ob) {}
393+
}
394+
""")
380395
.doTest();
381396
}
382397

0 commit comments

Comments
 (0)