Skip to content

Commit

Permalink
Add a test for static Function lambdas that are not UPPER_CASED.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 713736769
  • Loading branch information
kluever authored and Error Prone Team committed Jan 9, 2025
1 parent 195988f commit cfd1f79
Showing 1 changed file with 37 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,43 @@ void g() {
.doTest();
}

@Test
public void variable_static_butNotUpperCased() {
testHelper
.addInputLines(
"Test.java",
"""
import java.util.function.Function;
class Test {
private static final Function<String, String> notUpperCased = x -> "hello " + x;
void g() {
Function<String, String> l = Test.notUpperCased;
System.err.println(notUpperCased.apply("world"));
}
}
""")
// TODO: b/388821905 - we should retain the camelCasing of the variable name
.addOutputLines(
"Test.java",
"""
import java.util.function.Function;
class Test {
private static String notuppercased(String x) {
return "hello " + x;
}
void g() {
Function<String, String> l = Test::notuppercased;
System.err.println(notuppercased("world"));
}
}
""")
.doTest();
}

@Test
public void method_shapes() {
testHelper
Expand Down

0 comments on commit cfd1f79

Please sign in to comment.