Skip to content

Conversation

@carterkozak
Copy link
Contributor

==COMMIT_MSG==
Implement several failing safety-analysis test cases
==COMMIT_MSG==

Getting these out of my head, into a system!

Comment on lines +121 to +160
@Test
void testFunctionSafeType() {
helper().addSourceLines(
"Test.java",
"import com.palantir.logsafe.*;",
"import java.util.function.*;",
"class Test {",
" // BUG: Diagnostic contains: Dangerous",
" Function<@Unsafe String, @Safe String> func = in -> in;",
"}")
.doTest();
}

@Test
void testFunctionConsumesSafetyAnnotatedType_expression() {
helper().addSourceLines(
"Test.java",
"import com.palantir.logsafe.*;",
"import java.util.function.*;",
"class Test {",
" // BUG: Diagnostic contains: Dangerous",
" Consumer<@Unsafe String> func = in -> fun(in);",
" void fun(@Safe Object ob) {}",
"}")
.doTest();
}

@Test
void testFunctionConsumesSafetyAnnotatedType_statement() {
helper().addSourceLines(
"Test.java",
"import com.palantir.logsafe.*;",
"import java.util.function.*;",
"class Test {",
" // BUG: Diagnostic contains: Dangerous",
" Consumer<@Unsafe String> func = in -> { fun(in); };",
" void fun(@Safe Object ob) {}",
"}")
.doTest();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in #3050

Comment on lines +162 to +174
@Test
void testFunctionConsumesSafetyAnnotatedType_reference() {
helper().addSourceLines(
"Test.java",
"import com.palantir.logsafe.*;",
"import java.util.function.*;",
"class Test {",
" // BUG: Diagnostic contains: Dangerous",
" Consumer<@Unsafe String> func = Test::fun;",
" void fun(@Safe Object ob) {}",
"}")
.doTest();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been addressed in #3052

@stale
Copy link

stale bot commented Jun 27, 2025

This PR has been automatically marked as stale because it has not been touched in the last 14 days. If you'd like to keep it open, please leave a comment or add the 'long-lived' label, otherwise it'll be closed in 7 days.

@stale stale bot added the stale label Jun 27, 2025
@aldexis aldexis added long-lived and removed stale labels Jun 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants