Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
another test
  • Loading branch information
msridhar committed Jun 20, 2025
commit e940a339959b73570e1854ad2a380860d38144f9
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.google.gson.GsonBuilder;
import com.uber.nullaway.javacplugin.HelloPlugin.ClassInfo;
import com.uber.nullaway.javacplugin.HelloPlugin.MethodInfo;
import com.uber.nullaway.javacplugin.HelloPlugin.TypeParamInfo;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
Expand Down Expand Up @@ -176,6 +177,40 @@ public void innerAndAnonymousClasses() {
List.of(new MethodInfo("Inner()", false, false, List.of()))))));
}

@Test
public void typeParameters() {
compilationTestHelper
.addSourceLines(
"Foo.java",
"import org.jspecify.annotations.*;",
"@NullMarked",
"public class Foo<T extends @Nullable Object> {",
" public <U extends @Nullable Object> U make(U u) { throw new RuntimeException(); }",
"}")
.doTest();
Map<String, List<ClassInfo>> moduleClasses = getParsedJSON();
assertThat(moduleClasses)
.containsExactlyEntriesOf(
Map.of(
"unnamed",
List.of(
new ClassInfo(
"Foo",
"Foo<T>",
true,
false,
List.of(new TypeParamInfo("T", List.of(), List.of("@Nullable Object"))),
List.of(
new MethodInfo("Foo()", false, false, List.of()),
new MethodInfo(
"<U>make(U)",
false,
false,
List.of(
new TypeParamInfo(
"U", List.of(), List.of("@Nullable Object")))))))));
}

private Map<String, List<ClassInfo>> getParsedJSON() {
String tempPath = temporaryFolder.getRoot().getAbsolutePath();
// list all json files in the tempPath
Expand Down