Skip to content

Commit 83c70c8

Browse files
Regression test for #4550 (#4566)
1 parent bcdba5d commit 83c70c8

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_9.java

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1818,6 +1818,44 @@ interface IHelperBCExtends<T, BC extends B<? extends T> & C<? extends T>> {}
18181818
"""
18191819
});
18201820
}
1821+
1822+
// https://github.com/eclipse-jdt/eclipse.jdt.core/issues/4550
1823+
// Static interface methods excluded from type variable membership
1824+
public void testIssue4550() {
1825+
runNegativeTest(new String[] {
1826+
"Tester.java",
1827+
"""
1828+
public class Tester<T extends Thing> {
1829+
public void test() {
1830+
System.out.println("Testing: " + T.getStuff()); // Error is here
1831+
}
1832+
1833+
public static void main(String[] args) {
1834+
Tester<OtherThing> tester = new Tester<>();
1835+
tester.test();
1836+
}
1837+
1838+
}
1839+
1840+
interface Thing {
1841+
static String getStuff() {
1842+
return "Stuff";
1843+
}
1844+
}
1845+
1846+
class OtherThing implements Thing {
1847+
}
1848+
""",
1849+
},
1850+
"----------\n" +
1851+
"1. ERROR in Tester.java (at line 3)\n" +
1852+
" System.out.println(\"Testing: \" + T.getStuff()); // Error is here\n" +
1853+
" ^^^^^^^^\n" +
1854+
"The method getStuff() is undefined for the type T\n" +
1855+
"----------\n"
1856+
);
1857+
}
1858+
18211859
public static Class<GenericsRegressionTest_9> testClass() {
18221860
return GenericsRegressionTest_9.class;
18231861
}

0 commit comments

Comments
 (0)