You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: base-test/org.eclipse.jdt.groovy.core.tests.compiler/src/org/eclipse/jdt/groovy/core/tests/basic/GenericsTests.java
+33
Original file line number
Diff line number
Diff line change
@@ -2823,4 +2823,37 @@ public void testUpperBounds5() {
2823
2823
"Groovy:The type Integer is not a valid substitute for the bounded parameter <T extends java.lang.Number & p.I>\n" +
Copy file name to clipboardexpand all lines: base-test/org.eclipse.jdt.groovy.core.tests.compiler/src/org/eclipse/jdt/groovy/core/tests/xform/TypeCheckedTests.java
+79
Original file line number
Diff line number
Diff line change
@@ -695,6 +695,56 @@ public void testTypeChecked28() {
"Groovy:[Static type checking] - Non-static method C#m cannot be called from static context\n" +
720
+
"----------\n");
721
+
}
722
+
723
+
@Test
724
+
publicvoidtestTypeChecked30() {
725
+
//@formatter:off
726
+
String[] sources = {
727
+
"Main.groovy",
728
+
"@groovy.transform.TypeChecked\n" +
729
+
"class C {\n" +
730
+
" def m() {\n" +
731
+
" }\n" +
732
+
" static sm() {\n" +
733
+
" m()\n" +
734
+
" }\n" +
735
+
"}\n",
736
+
};
737
+
//@formatter:on
738
+
739
+
runNegativeTest(sources,
740
+
"----------\n" +
741
+
"1. ERROR in Main.groovy (at line 6)\n" +
742
+
"\tm()\n" +
743
+
"\t^^^\n" +
744
+
"Groovy:[Static type checking] - Non-static method C#m cannot be called from static context\n" +
745
+
"----------\n");
746
+
}
747
+
698
748
@Test
699
749
publicvoidtestTypeChecked5450() {
700
750
//@formatter:off
@@ -2541,6 +2591,35 @@ public void testTypeChecked9412() {
2541
2591
runConformTest(sources);
2542
2592
}
2543
2593
2594
+
@Test
2595
+
publicvoidtestTypeChecked9415() {
2596
+
//@formatter:off
2597
+
String[] sources = {
2598
+
"Main.groovy",
2599
+
"class C {\n" +
2600
+
" static <T> T getAt(T t) { t }\n" +
2601
+
"}\n" +
2602
+
"@groovy.transform.TypeChecked\n" +
2603
+
"void test() {\n" +
2604
+
" print C[1]\n" +
2605
+
"}\n" +
2606
+
"test()\n",
2607
+
};
2608
+
//@formatter:on
2609
+
2610
+
if (isAtLeastGroovy(40)) {
2611
+
runConformTest(sources, "1");
2612
+
} else {
2613
+
runNegativeTest(sources,
2614
+
"----------\n" +
2615
+
"1. ERROR in Main.groovy (at line 6)\n" +
2616
+
"\tprint C[1]\n" +
2617
+
"\t ^^^^\n" +
2618
+
"Groovy:[Static type checking] - Cannot find matching method java.lang.Class#getAt(int). Please check if the declared type is correct and if the method exists.\n" +
0 commit comments