Skip to content

Commit

Permalink
test case for generic instance methods
Browse files Browse the repository at this point in the history
  • Loading branch information
haewiful committed Oct 30, 2024
1 parent 97d6b41 commit 8272843
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,30 @@ public void multipleTypeVariablesMethodCall() {
.doTest();
}

@Test
public void genericInstanceMethods() {
makeHelper()
.addSourceLines(
"Test.java",
"package com.uber;",
"import org.jspecify.annotations.Nullable;",
"class Test {",
" abstract class Foo<T extends @Nullable String, S> {",
" public abstract <U> T test1(U u);",
" public abstract <U> S test2(U u);",
" }",
" public void run(Foo<@Nullable String, Character> f) {",
" String s = f.<Integer>test1(3);",
" // BUG: Diagnostic contains: dereferenced expression",
" s.toString();",
" Character c = f.<Integer>test2(3);",
" // legal, Type S is @NonNull",
" c.toString();",
" }",
"}")
.doTest();
}

@Test
@Ignore("requires generic method support")
public void genericMethodAndVoidType() {
Expand Down

0 comments on commit 8272843

Please sign in to comment.