Skip to content

Commit e52a18c

Browse files
committed
Add Function.identity failing test case
1 parent 1a15c25 commit e52a18c

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,23 @@ public String safeMethod(@Safe String safeArg) {
685685
.doTest();
686686
}
687687

688+
@Test
689+
void testFunctionIdentityLambda() {
690+
helper().addSourceLines(
691+
"Test.java",
692+
// language=Java
693+
"""
694+
import com.palantir.logsafe.*;
695+
import java.util.function.*;
696+
697+
class Test {
698+
// BUG: Diagnostic contains: Dangerous
699+
Function<@Unsafe String, @Safe String> func = Function.identity();
700+
}
701+
""")
702+
.doTest();
703+
}
704+
688705
private CompilationTestHelper helper() {
689706
return CompilationTestHelper.newInstance(IllegalSafeLoggingArgument.class, getClass());
690707
}

0 commit comments

Comments
 (0)